Preparing NOJ

Calculating Function

1000ms 262144K

Description:

For a positive integer n let's define a function f:

f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn

Your task is to calculate f(n) for a given integer n.

Input:

The single line contains the positive integer n (1 ≤ n ≤ 1015).

Output:

Print f(n) in a single line.

Sample Input:

4

Sample Output:

2

Sample Input:

5

Sample Output:

-3

Note:

f(4) =  - 1 + 2 - 3 + 4 = 2

f(5) =  - 1 + 2 - 3 + 4 - 5 =  - 3

Info

CodeForces

Provider CodeForces

Origin Codeforces Round #277 (Div. 2)

Code CF486A

Tags

implementationmath

Submitted 82

Passed 17

AC Rate 20.73%

Date 03/03/2019 22:49:21

Related

Nothing Yet