#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(15);
  cout << fixed;
  int cases = 0;
  cin >> cases;
  while (cases--) {
    long long int n = 0;
    cin >> n;
    long long int cnt = 1;
    while (cnt * (cnt - 1) / 2 <= n) cnt++;
    cnt--;
    long long int rem = n - (cnt * (cnt - 1) / 2);
    cout << 1;
    cout << 33;
    for (int i = 0; i < rem; i++) cout << 7;
    for (int i = 0; i < cnt - 2; i++) cout << 3;
    cout << 7 << endl;
  }
  return 0;
}
