#include <bits/stdc++.h>
using namespace std;
void test_case() {
  int a;
  cin >> a;
  int len = 2;
  while (len * (len + 1) / 2 <= a) len++;
  string second = "133";
  a -= len * (len - 1) / 2;
  while (a--) {
    second += '7';
  }
  len -= 2;
  while (len--) {
    second += '3';
  }
  second += '7';
  cout << second << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int iteration = 1;
  cin >> iteration;
  while (iteration--) {
    test_case();
  }
}
