#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long int n;
    cin >> n;
    long long int len = 2;
    while ((len * (len + 1) / 2) <= n) ++len;
    n = n - (len * (len - 1) / 2);
    string s = "133";
    for (long long int i = 0; i < n; i++) s += "7";
    len -= 2;
    for (long long int i = 0; i < len; i++) s += '3';
    s += '7';
    cout << s << endl;
  }
  return 0;
}
