#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long cnt2[100010];
void work2(long long v) {
  vector<int> ans;
  int itr = 99999;
  while (v) {
    if (v >= cnt2[itr]) {
      ans.push_back(itr);
      v -= cnt2[itr];
    } else {
      itr--;
    }
  }
  printf("133");
  int itrans = ans.size() - 1;
  for (int i = 2;; i++) {
    while (itrans >= 0) {
      if (ans[itrans] == i) {
        printf("7");
        itrans--;
      } else {
        break;
      }
    }
    if (itrans >= 0) {
      printf("3");
    } else {
      break;
    }
  }
  printf("\n");
}
int main() {
  cnt2[2] = 1;
  for (int i = 3; i < 100000; i++) {
    cnt2[i] = cnt2[i - 1] + i - 1;
  }
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    work2(n);
  }
  return 0;
}
