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