#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (long long)1e6 + 10;
const long long MOD = (long long)1e9 + 7;
long long t;
long long solve(long long x) { return x * x; }
long long n;
long long num[110000];
int main() {
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    vector<long long> v;
    memset(num, 0, sizeof(num));
    for (long long i = 50000; i >= 1; i--) {
      while (i * (i + 1) / 2 <= n) {
        n -= i * (i + 1) / 2;
        num[i]++;
      }
    }
    v.push_back(7);
    v.push_back(3);
    for (long long i = 1; i <= 50000; i++) {
      v.push_back(3);
      while (num[i]--) v.push_back(1);
    }
    for (long long i = v.size() - 1; i >= 0; i--) cout << v[i];
    cout << endl;
  }
  return 0;
}
