#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int l = 2, h = 1e5;
    int ans = 2;
    while (l <= h) {
      int m = l + (h - l) / 2;
      if ((long long)m * (m - 1) / 2 <= n) {
        ans = m;
        l = m + 1;
      } else {
        h = m - 1;
      }
    }
    int rem = n - (long long)ans * (ans - 1) / 2;
    cout << "133";
    for (int i = 1; i <= rem; i++) cout << 7;
    for (int i = 1; i <= ans - 2; i++) cout << 3;
    cout << 7 << '\n';
  }
}
