#include <bits/stdc++.h>
using namespace std;
int const MAXN = 2e6 + 9;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    int last = 0;
    for (long long i = 2; i < MAXN; i++) {
      long long x = i * (i - 1) / 2;
      if (x <= n)
        last = i;
      else
        break;
    }
    n -= last * (last - 1) / 2;
    if (n) {
      cout << 133;
      last -= 2;
    } else
      cout << 1;
    string out = string(n, '7') + string(max(last, 0), '3');
    out += '7';
    cout << out << '\n';
  }
}
