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