#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int BUF_SIZE = (int)1e6 + 10;
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
long long read() {
  char ch = getchar();
  long long x = 0, flag = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flag *= -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
  return x * flag;
}
void Solve() {
  int n = read();
  int len = 1, rem;
  while (len * (len - 1ll) / 2 < n) ++len;
  if (len * (len - 1ll) / 2 > n) --len;
  rem = n - len * (len - 1) / 2;
  if (!rem) {
    printf("1");
    for (int i = (1), i_end_ = (len); i <= i_end_; ++i) printf("3");
    printf("7");
  } else {
    printf("133");
    len -= 2;
    for (int i = (1), i_end_ = (rem); i <= i_end_; ++i) printf("7");
    for (int i = (1), i_end_ = (len); i <= i_end_; ++i) printf("3");
    printf("7");
  }
  puts("");
}
int main() {
  int T = read();
  while (T--) {
    Solve();
  }
  return 0;
}
