#include <bits/stdc++.h>
using namespace std;
vector<long long> v(100003);
long long solve() {
  long long n;
  vector<long long> u;
  string s;
  cin >> n;
  while (n > 0) {
    auto itr = lower_bound((v).begin(), (v).end(), n);
    long long a = itr - v.begin();
    if (v[a] > n) a--;
    u.push_back(a + 2);
    n = n - v[a];
  }
  s.push_back('1');
  long long j = 1;
  for (long long i = 0; i < u[0]; i++) {
    while (j < u.size() && i + u[j] == u[0]) {
      s.push_back('1');
      j++;
    }
    s.push_back('3');
  }
  s.push_back('7');
  cout << s;
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  v[0] = 1;
  for (long long i = 1; i < 100003; i++) v[i] = v[i - 1] + i + 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
