#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long m, n, t;
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> m;
    long long l = 1, r = 1e5, mid, ans;
    while (l <= r) {
      mid = (l + r) >> 1;
      long long k = (mid - 1) * mid / 2;
      if (k > m)
        r = mid - 1;
      else
        l = mid + 1, ans = mid;
    }
    int k = m - ans * (ans - 1) / 2;
    cout << 133;
    for (int i = 1; i <= k; ++i) cout << 7;
    for (int i = 1; i <= ans - 2; ++i) cout << 3;
    cout << 7 << endl;
  }
  return 0;
}
