#include <bits/stdc++.h>
using namespace std;
int main() {
  long long test, N;
  cin >> test;
  while (test--) {
    cin >> N;
    long long three = 1, seven;
    while (three * (three - 1) / 2 <= N) three++;
    if (three * (three - 1) / 2 > N) three--;
    seven = 1 + N - three * (three - 1) / 2;
    string ans = "133";
    for (int i = 1; i < seven; i++) ans += "7";
    for (int i = 1; i <= (three - 2); i++) ans += "3";
    ans += "7";
    cout << ans << endl;
  }
  return 0;
}
