#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long k = 0;
    while (k * (k - 1) / 2 <= n) ++k;
    k -= 1;
    if (k * (k - 1) / 2 == n) {
      cout << '1';
      for (int i = 0; i < k; ++i) {
        cout << '3';
      }
      cout << '7';
      cout << endl;
      continue;
    }
    cout << '1';
    for (int i = 0; i < k - 2; ++i) {
      cout << '3';
    }
    for (int i = 0; i < n - k * (k - 1) / 2; ++i) {
      cout << '1';
    }
    cout << "337" << endl;
  }
}
