#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    int cur = 0, x = 0;
    while ((x + 1ll) * x / 2 <= n) ++x;
    int rem = n - x * (x - 1) / 2;
    printf("133");
    for (int i = 1; i <= rem; ++i) printf("7");
    for (int i = 1; i <= x - 2; ++i) printf("3");
    printf("7\n");
  }
  return 0;
}
