#include <bits/stdc++.h>
using namespace std;
int n, t;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    int m = sqrt(2 * n);
    while (1) {
      if (m * (m - 1) <= 2 * n && m * (m + 1) > 2 * n) break;
      m++;
    }
    int k = n - (m - 1) * m / 2;
    cout << 133;
    for (int i = 0; i < k; i++) cout << 7;
    for (int i = 2; i < m; i++) cout << 3;
    cout << 7 << endl;
  }
  return 0;
}
