SP1458 BLUEEQ2 - Help Blue Mary Please! (Act II)

Description

Today Mary's math homework is to solve an equation. ![](../../../content/john_jones:blueeq2a.bmp) She knows all ki and pi, and 1

Input Format

There is a single integer T in the very first line of the input denoted the number of tests.T blocks follow. For each test case: The first line contains a single integer n(n

Output Format

For each test case output a single line ,which contains a single integer - the answer.You may assume this number is less than 2^31.