Jeny love Sweets so much. Now she is at famous restaurant and wants to eat **M** pieces of a particular sweet. Cost of **nth** sweet can only be determined by the determinant of matrix of order **n**** x n, **where n = 1 to M. The (i, j)th term of matrix is given as:

A[i][j]= minimum(i, j) *(-1)^{((i-1)*n + (j-1)).}

Matrix indexes starts with 1. The task is to find the cost of M sweets.

**Input: **The First line of input contains a integer T, denoting the total number of test cases. Then T test cases follow. Each test case consists of a single line conataining an integer M denoting the number of Sweets.

**Output: **Print the desired output corresponding to each test case in a separate line.

**Constraints:**

1<=T<=100

1<=M<=1000000

**Example:**

**INPUT :**

2

1

2

**OUTPUT:**

1

0

**EXPLAINATION:**

MAtrix of 1*1 is: |1|

Matrix of 2*2 is: |1 -1|

|1 -2|

Determinant of matrix 1x1 = 1

Determinant of matrix 2x2= -1

Cost of 1 sweet = 1

Cost of 2 sweets = Cost of 1st sweet + Cost of 2nd sweet = 1 + -1 = 0

Author: Mukesh Kumar 5

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

YogeshSharma7479 | 245 |

d_Coder00 | 243 |

VivSisMMM | 236 |

SashaV | 228 |

GustavoMéndez | 210 |

Pulkit__Sharma__ | 794 |

Anirban166 | 682 |

Found_me | 614 |

abducodes | 607 |

Sathvik Avasarala | 518 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.