CF1348A.Phoenix and Balance

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Phoenix and Balance

Phoenix has nn coins with weights 21,22,,2n2^1, 2^2, \dots, 2^n. He knows that nn is even.

He wants to split the coins into two piles such that each pile has exactly n2\frac{n}{2} coins and the difference of weights between the two piles is minimized. Formally, let aa denote the sum of weights in the first pile, and bb denote the sum of weights in the second pile. Help Phoenix minimize ab|a-b|, the absolute value of aba-b.

Input

The input consists of multiple test cases. The first line contains an integer tt (1t1001 \le t \le 100) — the number of test cases.

The first line of each test case contains an integer nn (2n302 \le n \le 30; nn is even) — the number of coins that Phoenix has.

Output

For each test case, output one integer — the minimum possible difference of weights between the two piles.

Note

In the first test case, Phoenix has two coins with weights 22 and 44. No matter how he divides the coins, the difference will be 42=24-2=2.

In the second test case, Phoenix has four coins of weight 22, 44, 88, and 1616. It is optimal for Phoenix to place coins with weights 22 and 1616 in one pile, and coins with weights 44 and 88 in another pile. The difference is (2+16)(4+8)=6(2+16)-(4+8)=6.

Samples

2
2
4
2
6

在线编程 IDE

建议全屏模式获得最佳体验