#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int z = 0; z < t; ++z) {
    int n;
    scanf("%d", &n);
    cout << "133";
    if (n < 50) {
      for (int i = 0; i < n; ++i) cout << "7";
      cout << "\n";
      continue;
    }
    int a = floor(sqrt(n)), b = (n - 6 * a) / a, c = n - a * b - 6 * a;
    for (int i = 0; i < c; ++i) cout << "7";
    for (int i = 0; i < b; ++i) cout << "1";
    cout << "33";
    for (int i = 0; i < a; ++i) cout << "7";
    cout << "\n";
  }
}
