#include <bits/stdc++.h>
using namespace std;
const int ma = 2e8;
const int N = 2e5 + 10;
const long long mod = 998244353;
int n, m, k, t, len, T;
string s;
int tofind() {
  if (n == 1) return 1;
  t = (int)sqrt((double)2 * n);
  while (t * (t + 1) <= 2 * n) t++;
  return t;
}
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    k = tofind();
    if (k >= 2) {
      cout << "1";
      if (n - k * (k - 1) / 2 == 0)
        for (int i = 1; i <= k; i++) cout << "3";
      else
        for (int i = 1; i <= k - 2; i++) cout << "3";
      k = n - k * (k - 1) / 2;
      for (int i = 1; i <= k; i++) cout << "1";
      if (k == 0)
        cout << "7" << endl;
      else
        cout << "337" << endl;
    } else {
      for (int i = 1; i <= n; i++) cout << "1";
      cout << "337" << endl;
    }
  }
}
