#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    long long x = 1;
    cin >> n;
    while (x * (x - 1) / 2 < n) x++;
    if (x * (x - 1) / 2 > n) x--;
    int num3 = x;
    n -= x * (x - 1) / 2;
    cout << 133;
    for (int i = 0; i < n; i++) {
      cout << 7;
    }
    for (int i = 0; i < x - 2; i++) cout << 3;
    cout << 7;
    cout << endl;
  }
  return 0;
}
