#include <bits/stdc++.h>
using namespace std;
inline long long f(long long x) { return (x * (x - 1)) / 2; }
string solve(long long n) {
  long long y = 2;
  while (f(y) <= n) y++;
  --y;
  long long rem = n - f(y);
  string ans = "";
  ans += "133";
  for (long long i = 0; i < rem; i++) ans += "7";
  for (long long i = 0; i < y - 2; i++) ans += "3";
  ans += "7";
  return ans;
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j;
  long long t;
  cin >> t;
  while (t--) {
    long long s;
    cin >> s;
    cout << solve(s) << "\n";
  }
  return 0;
}
