#include <bits/stdc++.h>
inline int getint() {
  int x = 0, p = 1;
  char c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
int cnt = 0, n;
void f(int x) {
  if (!x) return;
  int lb = 0, rb = sqrt(x) + 10;
  while (rb - lb > 1) {
    int mid = (lb + rb) >> 1;
    if (1ll * mid * (mid - 1) <= 1ll * x)
      lb = mid;
    else
      rb = mid;
  }
  f(x - lb * (lb - 1));
  for (int i = cnt; i < lb; i++) printf("3");
  printf("7");
  cnt = lb;
}
void solve() {
  n = 2 * getint();
  printf("1");
  cnt = 0;
  f(n);
  cout << endl;
}
int main() {
  int t = getint();
  for (int(i) = 0; (i) < (t); (i)++) solve();
  return 0;
}
