#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const int mod = 1e9 + 7;
const int mo = 998244353;
const int N = 1e5 + 5;
int n, Q;
int main() {
  Q = read();
  for (int q = (1); q <= (Q); q++) {
    n = read();
    int gs1 = 0, gs7 = 0, gs3 = 0;
    int siz = sqrt(2 * n);
    for (int i = (siz); i <= (n * 2); i++) {
      if (i * (i - 1) > 2 * n) break;
      int tmp = i * (i - 1) / 2;
      gs7 = n - tmp;
      gs3 = i;
    }
    printf("133");
    for (int i = (1); i <= (gs7); i++) putchar('7');
    for (int i = (1); i <= (gs3 - 2); i++) putchar('3');
    putchar('7');
    puts("");
  }
  return 0;
}
