#include <bits/stdc++.h>
using namespace std;
long long int fact(long long int n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return n * fact(n - 1);
}
long long power(long long int base, long long int exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % 998244353;
    base = (base * base) % 998244353;
    exp /= 2;
  }
  return res % 998244353;
}
long long n;
int C2(int n) { return (n * (n - 1)) / 2; }
void solve() {
  cin >> n;
  vector<int> v;
  for (int i = 20000; n > 0;) {
    if (C2(i) <= n) {
      v.push_back(i);
      n -= C2(i);
    } else
      i--;
  }
  v.push_back(0);
  sort((v).begin(), (v).end());
  string ret = "1";
  for (int i = 1; i < v.size(); i++) {
    int diff = v[i] - v[i - 1];
    for (int j = 0; j < diff; j++) ret += '3';
    ret += '7';
  }
  cout << ret << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
