#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int K = 52;
const int M = 200010;
const int mod = int(1e9) + 7;
void solve() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    int n;
    scanf("%d", &n);
    vector<int> v;
    for (int j = sqrt(2 * n) + 1; j >= 2; --j) {
      if (n >= j * (j - 1) / 2) {
        v.push_back(j);
        n -= j * (j - 1) / 2;
        ++j;
      }
    }
    reverse(v.begin(), v.end());
    string res = "1";
    adjacent_difference(v.begin(), v.end(), v.begin());
    for (int j = 0; j < v.size(); ++j) {
      for (int l = 0; l < v[j]; ++l) {
        res.push_back('3');
      }
      res.push_back('7');
    }
    cout << res << endl;
  }
}
int main() {
  solve();
  return 0;
}
