#include <bits/stdc++.h>
#pragma GCC optimize "O3"
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 4000;
int huh[N + 5];
int ile[N + 5], pt;
void solve() {
  memset(ile, 0, sizeof(ile));
  int n;
  cin >> n;
  pt = N;
  while (n) {
    ile[pt] += n / huh[pt];
    n %= huh[pt];
    pt--;
  }
  cout << "137";
  for (int i = 2; i <= N; i++) {
    cout << '3';
    for (int j = 1; j <= ile[i]; j++) cout << '7';
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 2; i <= N; i++) huh[i] = i * (i - 1) / 2;
  int tt;
  cin >> tt;
  for (int te = 1; te <= tt; te++) solve();
  return 0;
}
