#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t, n, lb, ub, f, mid, d, i;
  cin >> t;
  while (t--) {
    cin >> n;
    lb = 1;
    ub = n;
    f = 0;
    while (lb <= ub) {
      mid = (lb + ub) / 2;
      d = mid * (mid + 1) / 2;
      if (d > n)
        ub = mid - 1;
      else {
        if (d == n) {
          f = 1;
          break;
        } else {
          mid += 1;
          d = mid * (mid + 1) / 2;
          if (d > n) {
            mid -= 1;
            break;
          } else
            lb = mid;
        }
      }
    }
    if (f == 1) {
      cout << 1;
      for (i = 0; i <= mid; i++) cout << 3;
      cout << 7 << endl;
    } else {
      d = n - mid * (mid + 1) / 2;
      cout << 133;
      for (i = 1; i <= d; i++) cout << 7;
      for (i = 1; i < mid; i++) cout << 3;
      cout << 7 << endl;
    }
  }
}
