#include <bits/stdc++.h>
using namespace std;
long long n;
void solve() {
  cin >> n;
  vector<pair<long long, long long> > pos;
  long long vez = 32000;
  while (n > 0) {
    if (vez * (vez - 1) / 2 <= n) {
      long long k = vez * (vez - 1) / 2, quant = 0;
      while (k <= n) n -= k, quant++;
      pos.push_back({vez, quant});
    }
    vez--;
  }
  long long j = 0;
  for (long long i = pos[0].first; i > 0; i--) {
    if (i == pos[j].first and j < pos.size()) {
      for (long long k = 0; k < pos[j].second; k++) cout << 1;
      j++;
    }
    cout << 3;
  }
  cout << 7 << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  for (long long i = 1; i <= t; i++) solve();
}
