Initially, Chef is at coordinate 0 on X-axis. For each i = 1, 2, \dots, N in order, Chef does the following:
If Chef is at a non-negative coordinate, he moves i steps backward (i.e, his position's coordinate decreases by i), otherwise he moves i steps forward (i.e, his position's coordinate increases by i). 

You are given the integer N. Find the final position of Chef on the X-axis after N operations.

------ Input Format ------ 

- The first line of input contains an integer T, denoting the number of test cases. The T test cases then follow:
- The first and only line of each test case contains an integer N.

------ Output Format ------ 

For each test case, output in a single line the final position of Chef on the X-axis after N operations.

------ Constraints ------ 

$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{9}$

----- Sample Input 1 ------ 
3
1
2
3

----- Sample Output 1 ------ 
-1
1
-2

----- explanation 1 ------ 
Test case $1$: Initially, Chef is at coordinate $0$ on X-axis. As $0$ is non-negative, during the first operation Chef moves $1$ step backward and reaches the coordinate $-1$.

Test case $2$: Chef is at coordinate $-1$ on X-axis after the first operation. As $-1$ is negative, during the second operation Chef moves $2$ steps forward and reaches the coordinate $1$.

Source: codechef | Difficulty: EASY
Tags: Number theory

Mathematics


Solutions:
for i in range(int(input())):
	A = int(input())
	ans = A / 2
	ans1 = A // 2
	a = -(ans1 + 1)
	if ans > ans1:
		print(a)
	else:
		print(ans1)


for _ in range(int(input())):
	n = int(input())
	print((-1) ** (n % 2) * n // 2)


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2)
	else:
		print(-1 * (n + 1) // 2)


for i in range(int(input())):
	n = int(input())
	c = 0
	k = (n + 1) // 2
	if n % 2 == 0:
		print(k)
	else:
		print(-k)


for i in range(int(input())):
	n = int(input())
	s = 0
	a = (n + 1) // 2
	if n % 2 == 0:
		print(a)
	else:
		print(-a)


goals = int(input())
for distractions in range(goals):
	wife = int(input())
	print((-1) ** (wife % 2) * wife // 2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2)
	else:
		print(-1 * (n + 1) // 2)


for i in range(int(input())):
	n = int(input())
	print((-1) ** (n % 2) * n // 2)


for i in range(int(input())):
	N = int(input())
	print((-1) ** N * (N % 2 + N // 2))


for i in range(int(input())):
	x = 0
	n = int(input())
	if n % 2 != 0:
		print(-(n - n // 2))
	else:
		print(n // 2)


pos = 0
first = True
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2)
	else:
		print(-1 * ((n + 1) // 2))


b = int(input())
for _ in range(b):
	gh = int(input())
	if gh % 2 == 0:
		print(gh // 2)
	else:
		print(-(gh // 2 + 1))


import math
for _ in range(int(input())):
	N = int(input())
	if N % 2 == 0:
		print(N // 2)
	else:
		print(-1 * (N // 2 + 1))


import math
t = int(input())
for i in range(t):
	x = int(input())
	if x % 2 == 0:
		print(math.ceil(x / 2))
	else:
		print(-1 * math.ceil(x / 2))


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2)
	else:
		print(math.floor(-(n / 2)))


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2)
	else:
		print(math.floor(-(n / 2)))


import math
for j in range(int(input())):
	n = int(input())
	x = math.ceil(n / 2)
	if n % 2 == 0:
		print(x)
	else:
		print(-x)


T = int(input())
for i in range(T):
	N = int(input())
	if N % 2 != 0:
		print(-(N + 1) // 2)
	else:
		print(N // 2)


for _ in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		print(a // 2)
	else:
		print(-a // 2)


testcase = int(input())
for t in range(testcase):
	N = int(input())
	if N % 2 != 0:
		position = -((N + 1) // 2)
	else:
		position = N // 2
	print(position)


T = int(input())
for i in range(T):
	n = int(input())
	if n % 2 == 0:
		p = n / 2
		print(int(p))
	else:
		p = (n + 1) / 2
		print(-int(p))


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	if n % 2 == 0:
		sys.stdout.write(str(n // 2) + '\n')
	else:
		sys.stdout.write(str(-(n // 2 + 1)) + '\n')


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(math.ceil(n / 2))
	else:
		print(-1 * math.ceil(n / 2))


import math
for _ in range(int(input())):
	n = int(input())
	a = math.ceil(n / 2) ** 2
	b = n // 2
	c = b * (b + 1)
	print(c - a)


from math import *
t = int(input())
while t:
	t -= 1
	a = int(input())
	if a % 2 == 0:
		print(int(a / 2))
	else:
		temp = ceil(a / 2)
		print(-temp)