#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int cnt[N];
int main() {
  int T;
  scanf("%d", &T);
  for (; T--;) {
    memset(cnt, 0, sizeof cnt);
    int n;
    scanf("%d", &n);
    long long m = 1;
    while (m * (m + 1) / 2 <= n) m++;
    m--;
    for (int i = m; i; i--) {
      int res = i * (i + 1) / 2;
      cnt[i] = n / res;
      n %= res;
    }
    printf("13");
    for (int i = 1; i <= m; i++) {
      printf("3");
      for (int j = 1; j <= cnt[i]; j++) printf("7");
    }
    puts("");
  }
}
