time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

The subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.

You are given an integer n.

You have to find a sequence s consisting of digits {1,3,7} such that it has exactly n subsequences equal to 1337.

For example, sequence 337133377 has 6 subsequences equal to 1337:


  1. 3371_33_3_77_ (you can remove the second and fifth characters);
  2. 3371_3_33_77_ (you can remove the third and fifth characters);
  3. 3371_3_3_377_ (you can remove the fourth and fifth characters);
  4. 3371_33_3_7_7 (you can remove the second and sixth characters);
  5. 3371_3_33_7_7 (you can remove the third and sixth characters);
  6. 3371_3_3_37_7 (you can remove the fourth and sixth characters).

Note that the length of the sequence s must not exceed 105.

You have to answer t independent queries.

Input

The first line contains one integer t (1≤t≤10) — the number of queries.

Next t lines contains a description of queries: the i-th line contains one integer ni (1≤ni≤109).

Output

For the i-th query print one string si (1≤|si|≤105) consisting of digits {1,3,7}. String si must have exactly ni subsequences 1337. If there are multiple such strings, print any of them.

Example

input

Copy

2
6
1

output

Copy

113337
1337

因为n的范围小于1e9,题目要求字符串最长为1e5,那么不能只加1:11111337这样构造,会超长度。

此时可以发现添加3提供的答案是m*(m-1)/2,1e9,最多1e5个3就可以构造出来了。

于是暴力找出最小的3的个数,可此时m*(m-1)不一定等于n,那么就将m--,然后剩下的用一插在后面俩个三的前面单独提供答案就可以了,形式:133333333...111111....337。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int _;
cin>>_;
while(_--)
{
int n;cin>>n;
ll m;
string ans="1";
for(m=0;;m++)
{
if(m*(m-1)/2>n) break;
}
--m;
//printf("m:%lld\n",m);
ll n1=n-m*(m-1)/2;
ll tmp=m;
while(tmp--) ans+='3';
if(n1)
{
ans.pop_back();
ans.pop_back();
while(n1--) ans+='1';
ans+='3';
ans+='3';
}
ans+='7';
cout<<ans<<endl;
}
}