#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5, mod = 1000000007;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int pro = 1, temp, t, m, n, k, i, j, l, r, mid, x, y, z, rem,
                carry = 0, ind, ans = 0, mx = -LONG_LONG_MAX,
                mn = LONG_LONG_MAX, cnt = 0, curr = 0, prev, sum = 0, flag = 1,
                i1 = -1, i2 = -1;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int n3 = 2, n7 = 1, n1 = 1;
    while ((n3 * (n3 - 1)) / 2 <= n) {
      n3++;
    }
    n3--;
    rem = n - ((n3 * (n3 - 1)) / 2);
    cout << 133;
    while (rem--) {
      cout << 7;
    }
    n3 -= 2;
    while (n3--) {
      cout << 3;
    }
    cout << 7 << '\n';
  }
  return 0;
}
