#include <bits/stdc++.h>
using namespace std;
long long int N = 50000;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int l = 2;
    long long int r = N;
    long long int three = 0;
    while (l <= r) {
      long long int mid = (l + r) / 2;
      int ans = 1ll * mid * (mid - 1) / 2;
      if (ans == n) {
        three = mid;
        break;
      } else if (ans < n) {
        three = mid;
        l = mid + 1;
      } else {
        r = mid - 1;
      }
    }
    int rem = n - 1ll * three * (three - 1) / 2;
    string ans;
    ans.push_back('1');
    ans.push_back('3');
    ans.push_back('3');
    three -= 2;
    for (int i = 0; i < rem; i++) {
      ans.push_back('7');
    }
    for (int i = 0; i < three; i++) {
      ans.push_back('3');
    }
    ans.push_back('7');
    cout << ans << endl;
  }
  return 0;
}
