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.

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 140 |

xiaoyan_yunche | 139 |

ShameekAgarwal | 116 |

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 166 |

SoumyaKaushik | 146 |

arpit_anshuman | 140 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.