#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long count = 0;
    for (long long i = 2; (i * (i - 1)) / 2 <= n; i++) {
      count = i;
    }
    n -= (count * (count - 1)) / 2;
    cout << "133";
    while (n--) {
      cout << 7;
    }
    count = count - 2;
    while (count--) {
      cout << 3;
    }
    cout << 7 << "\n";
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
