#include <bits/stdc++.h>
using namespace std;
int caseno = 0;
void yesno(bool okk) { cout << (okk ? "YES" : "NO") << '\n'; }
const int primemod = 1000000007;
const long long maxsize = 3 * 100000 + 9;
const int N = 210;
long long n, k, x, a, y, b;
void solve() {
  cin >> n;
  long long rem = 0;
  for (long long i = 0;; i++) {
    if ((i * (i - 1)) / 2 > n) {
      x = i - 1;
      break;
    }
  }
  rem = n - (x * (x - 1)) / 2;
  x = ((x - 2) > (0) ? (x - 2) : (0));
  string ans = "";
  ans += "133";
  while (rem--) {
    ans += "7";
  }
  while (x--) {
    ans += "3";
  }
  ans += "7";
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
