#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD = 1e9 + 7;
void solve(){
int n;
cin >> n;
ll cnt = 2;
ll sum = 1;
int x = 2;
while(sum + x <= n){
sum += x;
x++;
cnt++;
}
int rem = n - sum;
cout << "133";
while(rem--){
cout << "7";
}
cnt -= 2;
while(cnt--){
cout << "3";
}
cout << "7\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin >> t;
for(int i = 1; i <= t; i++){
solve();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1PRCA9IDFlOSArIDc7Cgp2b2lkIHNvbHZlKCl7CglpbnQgbjsKCWNpbiA+PiBuOwoKCWxsIGNudCA9IDI7CglsbCBzdW0gPSAxOwoJaW50IHggPSAyOwoJd2hpbGUoc3VtICsgeCA8PSBuKXsKCQlzdW0gKz0geDsKCQl4Kys7CgkJY250Kys7Cgl9CglpbnQgcmVtID0gbiAtIHN1bTsKCWNvdXQgPDwgIjEzMyI7Cgl3aGlsZShyZW0tLSl7CgkJY291dCA8PCAiNyI7Cgl9CgljbnQgLT0gMjsKCXdoaWxlKGNudC0tKXsKCQljb3V0IDw8ICIzIjsKCX0KCWNvdXQgPDwgIjdcbiI7CgkKfQoKaW50IG1haW4oKXsKCWlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwoJY2luLnRpZShudWxscHRyKTsKCQoJaW50IHQgPSAxOwoJY2luID4+IHQ7CgkKCWZvcihpbnQgaSA9IDE7IGkgPD0gdDsgaSsrKXsKCQlzb2x2ZSgpOwoJfQoJcmV0dXJuIDA7Cn0=