#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int INF = 1e9 + 5;
const double PI = acos(-1);
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const int mod = 1e9 + 7;
int t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int k = 2;
    while ((k * 1LL * (k - 1)) / 2 <= n) k++;
    k--;
    int rem = n - ((k * 1LL * (k - 1)) / 2);
    cout << "133";
    while (rem--) cout << "7";
    k -= 2;
    while (k--) cout << "3";
    cout << "7\n";
  }
  return 0;
}
