#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  vector<long long> a;
  a.push_back(8);
  long long last = 8;
  long long j = 3;
  while (last <= 1000005000) {
    long long x = j * (j - 1);
    x /= 2;
    long long y = ((j + 2) * (j + 1));
    y /= 2;
    last = x + y + 1;
    j++;
    a.push_back(last);
  }
  while (t--) {
    long long n;
    cin >> n;
    if (n < 99000) {
      for (long long i = 0; i < n; i++) cout << 1;
      cout << 337 << endl;
    } else {
      long long x = 0, y = 0;
      for (long long i = 0; i < a.size() - 1; i++) {
        if (n >= a[i] && n < a[i + 1]) {
          x = i;
          y = n - a[i];
          break;
        }
      }
      cout << 1;
      for (long long i = 0; i < x + 2; i++) cout << 3;
      cout << 7;
      for (long long i = 0; i <= y; i++) cout << 1;
      cout << 337 << endl;
    }
  }
  return 0;
}
