The sum of all integers from to can be calculated by a clever method. We divide all the numbers into pairs: and , and , and , and so on. The sum of each pair is . The number of such pairs is 100/2 = 50. Therefore, the sum equals (1 + 100) \times 100 / 2. The same formula works for an odd number of terms; for example: 1 + 2 + 3 = (1 + 3) \times 3 / 2 = 6.
One integer . The number can be negative.
Print the sum of all integers from to . It is guaranteed that the sum fits into a -bit signed integer type.
Example 1
Example 2
Example 3
If n = -3, then the sum is 1 + 0 - 1 - 2 - 3 = -5.