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