#include <bits/stdc++.h>
using namespace std;
int t, n, x = 0;
vector<int> v;
int main() {
  for (scanf("%d", &t); t--;) {
    scanf("%d", &n);
    v.clear();
    while (n > 0) {
      for (x = 2; x * (x + 1) <= 2 * n; ++x)
        ;
      v.push_back(x);
      n -= (x * (x - 1)) / 2;
    }
    v.push_back(0);
    reverse(v.begin(), v.end());
    printf("1");
    for (int i = 1; i < v.size(); ++i) {
      for (int j = 0; j < v[i] - v[i - 1]; ++j) printf("3");
      printf("7");
    }
    printf("\n");
  }
}
