#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 8, MOD = 1e9 + 7;
const long long INF = 2e16;
using vi = vector<int>;
using vp = vector<pair<long long, long long>>;
mt19937 Flash_new_51(515151);
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vi ans;
    int k = 2, pred = -1;
    while (k * (k - 1) / 2 <= n) {
      pred = k;
      k++;
    }
    k = pred * (pred - 1) / 2;
    n -= k;
    if (n == 0) {
      cout << 1;
      for (int i = 0; i < pred; i++) cout << 3;
      cout << 7 << "\n";
      continue;
    }
    cout << 1 << 3 << 3;
    pred -= 2;
    for (int i = 0; i < n; i++) cout << 7;
    for (int i = 0; i < pred; i++) cout << 3;
    cout << 7;
    cout << "\n";
  }
}
