Alternating Sum
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
Python
Given a non-negative integer \(n\), compute the alternating sum
\(S(n) = -1 + 2 - 3 + 4 - \cdots + (-1)^n n\).
For \(n = 0\), define \(S(0) = 0\).
Input
One line containing \(n\).
The input satisfies:
- \(0 \le n \le 10^9\)
Output
Print \(S(n)\).
Example
Input
5
Output
-3
Comments