#include <bits/stdc++.h>
const int maxn = 200010;
const int inf = 1e9;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long x = (1 + sqrt(1 + 8 * n)) / 2;
    while (x * (x - 1) / 2 <= n) x++;
    x--;
    long long l = n - x * (x - 1) / 2;
    cout << 133;
    for (int i = 0; i < l; i++) cout << 7;
    for (int i = 0; i < x - 2; i++) cout << 3;
    cout << 7 << '\n';
  }
  return 0;
}
