logo AlgoBeat OnlineJudge
登录 注册

#209471. [ICPC 2018 Qingdao R] Sequence and Sequence

内存限制:256 MiB 时间限制:10000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Consider the following two sequences and . We denote as the -th element in sequence , and as the -th element in sequence :

  • Sequence is a sequence where for all , appears in sequence for times ( is the set of all positive integers). That is to say,
  • Sequence can be derived from the following equations:

That is to say,

Given a positive integer , please calculate the value of .

输入格式

There are multiple test cases. The first line of the input contains an integer (about ), indicating the number of test cases. For each test case:

The first and only line contains an integer ().

输出格式

For each test case output one line containing one integer, indicating the value of .

样例

样例输入 1

4
10
100
1000
987654321123456789

样例输出 1

30
2522
244274
235139898689017607381017686096176798