#include <iostream>
using namespace std;
int t;
int main()
{
cin >> t;
while (t -- )
{
int n;
cin >> n;
int m = 1;
while (m * (m - 1) / 2 <= n) m ++ ;
m -- ;
cout << "133";
for (int i = 0; i < n - m * (m - 1) / 2; i ++ ) cout << '7';
for (int i = 0; i < m - 2; i ++ ) cout << '3';
cout << '7' << endl;
}
return 0;
}