eolymp
bolt
Try our new interface for solving problems
Problems

The sum from 1 to n

The sum from 1 to n

The sum of all integers from 1 to 100 can be calculated by tricky expedient. We divide all the numbers in pairs 1 and 100, 2 and 99, 3 and 98, etc. The sum of each pair is 101. The number of all pairs is 100 / 2 = 50. Therefore, the sum equals to (1 + 100) * 100 / 2. For an odd number of terms works the same formula, for example: 1 + 2 + 3 = (1 + 3) * 3 / 2 = 6.

Input

One integer n. Number n can be negative.

Output

Print the sum of all integers from 1 to n. It is guaranteed that the sum is 64-bit signed integer type.

Explanation

If n = -3, then the sum equals to 1 + 0 - 1 - 2 - 3 = -5.

Time limit 1 second
Memory limit 128 MiB
Input example #1
100
Output example #1
5050
Input example #2
3
Output example #2
6
Input example #3
-3
Output example #3
-5