A professor teaches Computer Science in his University. After the End Semester Examination, he checks all the papers and keeps them in descending order based on marks in the form of a pile. However he realizes that he has kept the papers in the box meant for Chemistry papers. He has to transfer the papers to the actual box that too in a pile with descending order of marks, and with some conditions.

1) He can withdraw a paper from the top of a pile only, and also he can place a paper on the top of a pile only.

2) He can keep a paper only at three places: box meant for computer science paper, box meant for chemistry paper, and he can keep the papers on the table also while withdrawing another paper from the top of a pile.

3) He can't keep the papers upon the table separately, i.e, he has to keep those papers in a single pile upon the table.

4) A paper with lower marks never comes below the paper with higher marks in a pile.

Displacing a paper to any pile would be called a move.

He wants to know in advance how many moves would he require. Compute the number of moves.

**Input**:

The first line of input takes the number of test cases, T.

The next T lines take the number of papers, N.

**Output**:

Print the number of moves required for each test case.

Constraints:

1<=T<=100

1<=N<=100

**Example**:

**Input**:

3

2

4

6

**Output**:

3

15

63

Author: akundusaltlake

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.

VivSisMMM | 182 |

d_Coder00 | 177 |

GustavoMéndez | 167 |

ajayjadhav35 | 153 |

Sathvik Avasarala | 151 |

Pulkit__Sharma__ | 684 |

Anirban166 | 624 |

abducodes | 548 |

Found_me | 526 |

Sathvik Avasarala | 514 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.