#include <bits/stdc++.h>
int q, n;
int main() {
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &n);
    int b = sqrt(2 * n + 4);
    while ((b + 1) * (b + 2) / 2 > n) b--;
    int a = n - (b + 1) * (b + 2) / 2;
    printf("133");
    for (int i = 1; i <= a; i++) printf("7");
    for (int i = 1; i <= b; i++) printf("3");
    printf("7\n");
  }
  return 0;
}
