Assi and Lassi

3.9

20 votes
Very-Easy
Problem

Assi and Lassi fell in love. They like doing experiments . After discovering Merge sort in Pairs , they started thinking about Assi Sequence and Lassi Sequence .
Assi Sequence is defined as number 1,-1,2,-2,3,-3,4,-4 .....
Lassi Sequence is defined as number -1,1,-2,2,-3,3,-4,4.....
They want to find the sum of nth Assi or Lassi Sequence . As Assi and Lassi are busy in doing romance , can you help them ?
1<=t<=10^5
1<=n<=10^18

Input Format
First line will be t denoting no of test cases
next t lines denotes two integer
1) Type 1 or 2 denoting assi or lassi sequence
2) n

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?