#include <bits/stdc++.h>
using namespace std;
int N, T, L1, L2;
int main() {
  cin >> T;
  while (T--) {
    cin >> N;
    int p = sqrt(2 * N);
    for (int i = p; i <= 2 * N; ++i) {
      if (i * (i - 1) > 2 * N) break;
      L1 = i * (i - 1) / 2, L2 = N - L1, L1 = i;
    }
    printf("133");
    for (int i = 1; i <= L2; ++i) putchar('7');
    for (int i = 1; i <= L1 - 2; ++i) putchar('3');
    printf("7\n");
  }
}
