#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string res = "1337";
    string result = "1337";
    if (n == 1) {
      cout << "1337" << endl;
      continue;
    }
    long long count = (1 + sqrt(1 + 8 * n)) / 2;
    result.insert(1, count - 2, '3');
    n = n - (long long)(count * (count - 1)) / 2;
    result.insert(3, n, '7');
    cout << result << endl;
  }
  return 0;
}
