#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
const long long xinc[] = {0, 0, 1, -1};
const long long yinc[] = {1, -1, 0, 0};
const long double PI = acos(-1.0);
const long long hell = 1e9 + 7;
const long long INF = INT_MAX / 10;
long long need;
long long f(long long n) { return (n * (n - 1)) / 2; }
void solve() {
  cin >> need;
  long long c3 = -1;
  long long lo = 2, hi = 1e5;
  while (hi - lo > 1) {
    long long mid = (hi + lo) / 2;
    if (f(mid) > need)
      hi = mid;
    else
      lo = mid;
  }
  if (f(hi) <= need)
    c3 = hi;
  else if (f(lo) <= need)
    c3 = lo;
  else
    assert(false);
  need -= f(c3);
  long long extra7 = need;
  string ans = "133";
  for (long long i = 0; i < extra7; i++) ans += '7';
  for (long long i = 0; i < c3 - 2; i++) ans += '3';
  ans += '7';
  assert(ans.size() <= 100000);
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
