#include <bits/stdc++.h>
using namespace std;
vector<int> res;
string s;
int main() {
  int T, n, x, y;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    s.clear();
    for (x = 2; x * (x - 1) / 2 <= n; x++) {
    }
    x--;
    y = n - x * (x - 1) / 2;
    s += "133";
    for (int i = 0; i < y; i++) {
      s += "7";
    }
    for (int i = 0; i < x - 2; i++) {
      s += "3";
    }
    s += "7";
    printf("%s\n", s.c_str());
  }
  return 0;
}
