
155  The 2018 ACMICPC Asia Qingdao Regional Contest (Mirror)  A
Consider the following two sequences $P$ and $Q$. We denote $P(i)$ as the $i$th element in sequence $P$, and $Q(i)$ as the $i$th element in sequence $Q$:
Given a positive integer $n$, please calculate the value of $Q(n)$. InputThere are multiple test cases. The first line of the input contains an integer $T$ (about $10^4$), indicating the number of test cases. For each test case: The first and only line contains an integer $n$ ($1 \le n \le 10^{40}$). OutputFor each test case output one line containing one integer, indicating the value of $Q(n)$. Sample Input4 10 100 1000 987654321123456789 Sample Output30 2522 244274 235139898689017607381017686096176798 