#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using std::string;
using LL = long long;
using db = double;
using pii = std::pair<int, int>;
using vi = std::vector<int>;
const int MAXL = 1e5 + 10;
const int MAX_SQRT = 80000;
int f[MAX_SQRT];
char ans[MAXL];
void solve() {
  int n;
  scanf("%d", &n);
  int a = std::upper_bound(f, f + MAX_SQRT, n) - f - 1;
  ans[0] = '1';
  for (int i = 1; i <= a; ++i) ans[i] = '3';
  n -= f[a];
  for (int i = a + 1; i <= a + n; ++i) ans[i] = '1';
  ans[a + n + 1] = ans[a + n + 2] = '3';
  ans[a + n + 3] = '7';
  ans[a + n + 4] = '\0';
  printf("%s\n", ans);
}
int main() {
  for (int i = 0; i < MAX_SQRT; ++i) f[i] = (LL)(i + 1) * (i + 2) / 2;
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
