Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Calculate The Sum If You Can

By Rajib_119 · Limits 2s, 512 MB

This problem deals with the following expression:

12+12+12+12+12+12+12+... 1-2+1-2+1-2+1-2+1-2+1-2+1-2+...

Given n, you have to determine the sum of the expression up to the n'th term.

Input

The first line of input contains the number of test cases T (1 ≤ T ≤ 100000). The next T lines each contains an integer n (1 ≤ n ≤ 1012).

Output

For each case find the sum up to n'th term of the given series.

Sample

InputOutput
3
1
2
5
1
-1
-1

Discussion

Statistics


91% Solution Ratio

shahed95Earliest, Dec '17

tusharFastest, 0.0s

atiq_143Lightest, 1.2 MB

bokaifShortest, 60B

Submit

Login to submit

Editorial

Toph uses cookies. By continuing you agree to our Cookie Policy.