#include <bits/stdc++.h>
const long long INF32 = 1e9;
const long long INF64 = 1e17;
const int RANGE = 1e6 + 5;
using namespace std;
template <class T>
void read(T &Val) {
  T tmp = 0;
  char ch = getchar();
  int flag = 1;
  while (!(ch >= '0' && ch <= '9')) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while ((ch >= '0' && ch <= '9')) {
    tmp = tmp * 10 + ch - '0';
    ch = getchar();
  }
  Val = flag * tmp;
}
set<long long> v;
map<long long, long long> data;
long long x = 1;
void solveD() {
  int t;
  read(t);
  while (t--) {
    long long n;
    read(n);
    auto h = v.lower_bound(n);
    if (*h > n) h--;
    int l = data[*h];
    int tmp = n - (*h);
    cout << "1";
    for (int i = 1; i <= 2; i++) cout << "3";
    for (int i = 1; i <= tmp; i++) cout << "7";
    for (int i = 1; i <= l - 2; i++) cout << "3";
    cout << "7";
    cout << '\n';
  }
}
int main() {
  while (1) {
    long long tmp = ((x - 1) * x) / 2;
    v.insert(tmp);
    data[tmp] = x;
    x++;
    if (tmp > 1e9) break;
  }
  solveD();
  return 0;
}
