#include <bits/stdc++.h>
using namespace std;
long long int t;
long long int n;
void solve() {
  long long int keep = 0;
  while ((keep * (keep - 1) / 2) <= n) {
    keep++;
  }
  keep--;
  long long int rem = n - ((keep * (keep - 1)) / 2);
  cout << "133";
  while (rem--) {
    cout << "7";
  }
  keep -= 2;
  while (keep--) {
    cout << "3";
  }
  cout << "7\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    solve();
  }
  return 0;
}
