#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 1e5 + 10;
vector<int> sz;
int t, n, lst;
int main() {
  for (scanf("%d", &t); t--;) {
    scanf("%d", &n), lst = -1;
    printf("1");
    while (n > 0) {
      ;
      int k = 1;
      while (k * (k - 1) / 2 <= n) k++;
      k--;
      if (lst != -1) sz.emplace_back(lst - k);
      lst = k, n -= k * (k - 1) / 2;
    }
    sz.emplace_back(lst);
    ;
    reverse(sz.begin(), sz.end());
    for (auto &x : sz) {
      for (int i = 0; i < x; i++) printf("3");
      printf("7");
    }
    sz.clear();
    printf("\n");
  }
}
