#include <bits/stdc++.h>
void print_array(int *a, int n) {
  printf("#");
  for (int i = 0; i < n; i++) printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
}
using namespace std;
const double EPS = 1e-8;
const long long INF = 0x3f3f3f3f3f3f3f3f;
inline long long readll() {
  long long x(0), op(1);
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * op;
}
const int sz = 2e5 + 9;
long long n;
void solve() {
  long long b = (n <= 40009) ? 2 : 282;
  long long bb = (b * (b - 1)) / 2;
  long long a = n / bb;
  long long rem = n - a * bb;
  putchar('1');
  printf("33");
  for (long long i = 0; i < rem; ++i) putchar('7');
  for (long long i = 2; i < b; ++i) putchar('3');
  for (long long i = 0; i < a; ++i) putchar('7');
  puts("");
}
int main() {
  long long _ = readll();
  for (long long i = 0; i < _; ++i) {
    cin >> n;
    solve();
  }
  return 0;
}
