#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  long long no_of_3 = 2;
  long long no_of_7 = 0;
  for (;; no_of_3++) {
    if ((no_of_3 * (no_of_3 - 1)) / 2 > n) {
      no_of_3--;
      no_of_7 = n - (no_of_3 * (no_of_3 - 1)) / 2;
      break;
    }
  }
  no_of_3 -= 2;
  string s;
  s += "133";
  for (long long i = 0; i < no_of_7; i++) {
    s.push_back('7');
  }
  for (long long i = 0; i < no_of_3; i++) {
    s.push_back('3');
  }
  s.push_back('7');
  cout << s << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
