#include <bits/stdc++.h>
using namespace std;
const int maxp = 22;
const long double EPS = 1e-18;
const long long INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 2e5 + 1;
int sum(int n) { return n * (n - 1) / 2; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int l = 2, r = 45000;
    int ans;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (sum(mid) <= n) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    cout << "133";
    int rem = n - sum(ans);
    while (rem--) cout << '7';
    ans -= 2;
    while (ans--) cout << '3';
    cout << '7' << '\n';
  }
}
