#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
inline int rd() {
  int first = 0;
  char p = getchar();
  while (p < '0' || p > '9') p = getchar();
  while (p >= '0' && p <= '9') first = first * 10 + p - '0', p = getchar();
  return first;
}
const int N = 1e6 + 10;
int n;
char s[N];
int main() {
  int t, n;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    if (n == 1)
      puts("1337");
    else if (n == 2)
      puts("11337");
    else if (n == 3)
      puts("13337");
    else if (n == 4)
      puts("131337");
    else if (0 && n <= 1000) {
      int tot = n - 3;
      printf("13");
      for (int i = 1; i <= tot; ++i) printf("1");
      printf("337\n");
    } else {
      int tot = 1, now = -1;
      for (int i = 2; i <= 100000; ++i) {
        if ((long long)i * (i + 1) / 2 > n) {
          now = i;
          break;
        }
      }
      tot = now * (now - 1) / 2;
      int res = n - tot;
      printf("133");
      now -= 2;
      for (int i = 1; i <= res; ++i) putchar('7');
      for (int i = 1; i <= now; ++i) putchar('3');
      putchar('7');
      putchar(10);
    }
  }
}
