#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline int two(int n) { return 1 << n; }
const long long mod = 1e9 + 7;
const int maxn = 1e5 + 5;
void pre() {}
void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TC = 1;
  cin >> TC;
  while (TC--) {
    solve();
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  if (n < 7) {
    for (int j = 0; j < (n); ++j) {
      cout << "1";
    }
    cout << "337\n";
    return;
  }
  int i = 2;
  for (; (i * i + i + 1) <= n; ++i) {
  }
  i--;
  cout << "1";
  for (int j = 0; j < (i); ++j) {
    cout << "3";
  }
  cout << "7";
  int left = n - (i * i + i + 1);
  for (int j = 0; j < (left); ++j) {
    cout << "1";
  }
  cout << "337";
  cout << '\n';
}
