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