#include <bits/stdc++.h>
using namespace std;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long expo(long long n, long long m, long long p) {
  long long r = 1;
  n = n % p;
  while (m > 0) {
    if (m % 2) r = (r * n) % p;
    n = (n * n) % p;
    m = m / 2;
  }
  return r % p;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  long long tc = 1;
  while (t--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << "1337" << '\n';
    } else if (n == 2) {
      cout << "11337" << '\n';
    } else if (n == 3) {
      cout << "111337" << '\n';
    } else {
      long long m;
      for (long long i = 1; i <= n; i++) {
        long long x = (i * (i - 1)) / 2;
        if (x > n) {
          m = i - 1;
          break;
        }
      }
      long long r = n - (m * (m - 1)) / 2;
      string ans;
      ans.push_back('1');
      ans.push_back('3');
      ans.push_back('3');
      while (r) {
        ans.push_back('7');
        r--;
      }
      m -= 2;
      while (m) {
        ans.push_back('3');
        m--;
      }
      ans.push_back('7');
      cout << ans << '\n';
    }
  }
}
