#include <bits/stdc++.h>
using namespace std;
int n_test, N;
void Main() {
  cin >> N;
  int n = 0;
  while (1LL * n * (n - 1) / 2 <= N) ++n;
  --n;
  int rem = N - n * (n - 1) / 2;
  cout << "133";
  for (int i = 0; i < rem; ++i) cout << "7";
  for (int i = 2; i < n; ++i) cout << "3";
  cout << "7\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n_test;
  while (n_test--) Main();
  return 0;
}
