#include <bits/stdc++.h>
using namespace std;
long long int maxx = 1000000007;
bool sortbyfir(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.first < b.first || (a.first == b.first && a.second < b.second));
}
long long int max3(long long int a, long long int b, long long int c) {
  return max(max(a, b), c);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool inline isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool isPowerOfTwo(long long int n) {
  if (!n) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
void prt(int i) { i ? cout << "YES\n" : cout << "NO\n"; }
long long int getSum(long long int n) {
  long long int sum = 0;
  while (n != 0) {
    sum = sum + n % 10;
    n = n / 10;
  }
  return sum;
}
int binaryToDecimal(int n) {
  int num = n;
  int dec_value = 0;
  int base = 1;
  int temp = num;
  while (temp) {
    int last_digit = temp % 10;
    temp = temp / 10;
    dec_value += last_digit * base;
    base = base * 2;
  }
  return dec_value;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int test = 1;
  cin >> test;
  while (test--) {
    long long int n, a, b, c;
    cin >> n;
    for (long long int i = (50000 - 1); i >= (2); i -= 1) {
      if ((i * (i - 1)) / 2 <= n) {
        a = i;
        break;
      }
    }
    b = n - ((a) * (a - 1)) / 2;
    cout << "133";
    for (long long int i = 0; i < b; i++) cout << "7";
    for (long long int i = 0; i < a - 2; i++) cout << "3";
    cout << "7\n";
  }
}
