You have a large electronic screen which can display up to $998244353$ decimal digits. The digits are displayed in the same way as on different electronic alarm clocks: each place for a digit consists of $7$ segments which can be turned on and off to compose different digits. The following picture describes how you can display all $10$ decimal digits:

[Image]

As you can see, different digits may require different number of segments to be turned on. For example, if you want to display $1$, you have to turn on $2$ segments of the screen, and if you want to display $8$, all $7$ segments of some place to display a digit should be turned on.

You want to display a really large integer on the screen. Unfortunately, the screen is bugged: no more than $n$ segments can be turned on simultaneously. So now you wonder what is the greatest integer that can be displayed by turning on no more than $n$ segments.

Your program should be able to process $t$ different test cases.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases in the input.

Then the test cases follow, each of them is represented by a separate line containing one integer $n$ ($2 \le n \le 10^5$) — the maximum number of segments that can be turned on in the corresponding testcase.

It is guaranteed that the sum of $n$ over all test cases in the input does not exceed $10^5$.


-----Output-----

For each test case, print the greatest integer that can be displayed by turning on no more than $n$ segments of the screen. Note that the answer may not fit in the standard $32$-bit or $64$-bit integral data type.


-----Example-----
Input
2
3
4

Output
7
11

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	int_part = n // 2
	ost = n - int_part * 2
	number = ''
	for i in range(int_part - 1):
		number += '1'
	if ost == 0:
		number += '1'
	else:
		number = '7' + number
	print(number)


t = int(input())
i = 0
while i < t:
	a = 0
	n = int(input())
	if n % 2 != 0:
		n -= 3
		a = 7
	while n > 0:
		n -= 2
		a *= 10
		a += 1
	print(a)
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	d = n // 2
	if n % 2 == 1:
		print('7' + '1' * (d - 1))
	else:
		print('1' * d)


m = int(input())
for c in range(m):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	while n > 0:
		print(1, end='')
		n -= 2
	print()


import math
import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	two = 0
	three = 0
	maxi = 0
	for i in range(n + 1):
		if i // 2 + (n - i) // 3 > maxi:
			maxi = i // 2 + (n - i) // 3
			two = i // 2
			three = (n - i) // 3
	l = list()
	for i in range(three):
		l.append(7)
	for i in range(two):
		l.append(1)
	for i in range(len(l)):
		print(l[i], end='')
	print()


a = int(input())
ans = ''
for i in range(a):
	n = int(input())
	ans += '1' * (n // 2)
	if n // 2 > 998244353:
		ans = '1' * 998244353
		n -= 998244353 * 2
		i = 1
		while n > 4:
			ans = ans[:i - 1] + '9' + ans[i:]
			n -= 4
			i += 1
		if n != 0:
			i += 1
			while n != 0:
				ans = ans[:i - 1] + '7' + ans[i:]
				i += 1
				n -= 1
	elif n % 2 == 1:
		ans = '7' + ans[1:]
	print(ans)
	ans = ''


for i in range(int(input())):
	x = int(input())
	answer = ''
	j = 0
	for j in range(0, x // 2):
		answer = answer + '1'
	if x % 2 != 0:
		answer = str(int(answer) + 6 * 10 ** (len(answer) - 1))
	print(answer)


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())
debugging = False

def dprint(*args):
	if debugging:
		print(*args)
	else:
		pass
m = 998244353
t = intput()
for _ in range(t):
	n = intput()
	ans = []
	r = n // 2
	n -= r * 2
	if n:
		r -= 1
		n += 2
	for i in range(r):
		ans.append(str(1))
	if n:
		print('7' + ''.join(ans))
	else:
		print(''.join(ans))


t = int(input())
while t > 0:
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 1) // 2 - 1))
	t -= 1


def lastIndex(array, element):
	i = len(array) - 1
	while i >= 0:
		if array[i] == element:
			return i
		i = i - 1
	return -1
t = int(input())
for _ in range(t):
	v = int(input())
	array = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	minimum = min(array)
	if minimum > v:
		print(-1)
	index = lastIndex(array, minimum)
	string = [index] * (v // minimum)
	remainPaint = v % minimum
	if remainPaint > 0:
		for i in range(len(string)):
			for j in range(len(array) - 1, index, -1):
				if remainPaint + minimum - array[j] >= 0:
					string[i] = j
					remainPaint = remainPaint + minimum - array[j]
					break
			if remainPaint == 0:
				break
	string = ''.join(map(str, string))
	print(string)


t = int(input())
for i in range(t):
	s = ''
	a = int(input())
	if a % 2 == 1:
		s += '7'
		for i in range((a - 3) // 2):
			s += '1'
	else:
		for i in range(a // 2):
			s += '1'
	print(s)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	if n % 2 == 0:
		s = n // 2 * '1'
	else:
		s = '7' + (n - 3) // 2 * '1'
	print(s)


t = int(input())
for i in range(0, t):
	n = int(input())
	s = ''
	while n % 2 == 1:
		s = s + '7'
		n = n - 3
	while n > 0:
		s = s + '1'
		n = n - 2
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	a = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n == 2:
		print('1')
	elif n == 3:
		print('7')
	elif n % 2 == 0:
		x = n // 2
		print('1' * x)
	else:
		x = n // 2 - 1
		print('7' + x * '1')


n = int(input())
kor = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for i in range(n):
	ch = int(input())
	ans = ''
	if ch % 2 == 1:
		ch -= 3
		ans = '7'
		for j in range(0, ch, 2):
			ans += '1'
	else:
		for j in range(0, ch, 2):
			ans += '1'
	print(ans)


t = int(input().strip())
c = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(t):
	num = int(input().strip())
	ans = []
	result = num // 2
	if num % 2 == 0:
		print(''.join(['1' for i in range(result)]))
	else:
		ans = ['1' for i in range(result - 1)]
		print('7' + ''.join(ans))


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


for i in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * '1')
	else:
		print('7' + (n - 3) // 2 * '1')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		x = n // 2
		for i in range(x):
			print(1, end='')
	else:
		x = n // 2
		x -= 1
		print(7, end='')
		for i in range(x):
			print(1, end='')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	res = '1' * (n // 2)
	if n % 2 == 1:
		res = '7' + res[1:]
	print(res)


t = int(input())
for index in range(t):
	n = int(input())
	ans = ''
	if n % 2 == 0:
		x = n // 2
		for digit in range(x):
			ans += '1'
		print(int(ans))
	else:
		_x = n // 2 - 1
		ans = '7' + ans
		for digit in range(_x):
			ans += '1'
		print(int(ans))


t = int(input())
while t:
	n = int(input())
	if n % 2 == 0:
		s = ''
		for i in range(n // 2):
			s = s + '1'
		print(int(s))
	else:
		s = '7'
		for i in range(n // 2 - 1):
			s = s + '1'
		print(int(s))
	t -= 1


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	re = int(n / 2) * '1'
	if n % 2 == 1:
		re = '7' + re[1:]
	print(re)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	for i in range(int(n / 2)):
		print(1, end='')
	print('\n')


import math, collections, sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


n = int(input())
for i in range(n):
	s = int(input())
	(a, b) = (str(7), str(1))
	d = ''
	if s % 2 == 0:
		d = b * (s // 2)
		print(int(d))
	else:
		s -= 3
		d += a
		d += b * (s // 2)
		print(int(d))


t = int(input())
for i in range(t):
	a = int(input())
	r = a % 2
	if r == 0:
		ans = '1' * (a // 2)
		print(ans)
	else:
		ans = '1' * (a // 2 - 1)
		ans = '7' + ans
		print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		res = ['1' for i in range(n // 2 - 1)]
		res = ['7'] + res
	else:
		res = ['1' for i in range(n // 2)]
	print(''.join(res))


for _ in range(int(input())):
	d = int(input())
	if d % 2 != 0:
		print('7', sep='', end='')
		d -= 3
	while d > 0:
		print('1', sep='', end='')
		d -= 2
	print()


def printMaxNumber(n):
	if n % 2 == 1:
		print('7', end='')
		for i in range(int((n - 3) / 2)):
			print('1', end='')
	else:
		for i in range(n // 2):
			print('1', end='')
for t in range(int(input())):
	n = int(input())
	printMaxNumber(n)
	print()


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	if n % 2 != 0:
		s = '7'
		n = n - 3
	for j in range(int(n / 2)):
		s += '1'
	print(s)


test = int(input())
for t in range(test):
	n = int(input())
	if n % 2 == 1:
		x = n // 2 - 1
		print('7', end='')
		for k in range(x):
			print('1', end='')
	else:
		x = n // 2
		for k in range(x):
			print('1', end='')
	print()


for tc in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	if n % 2 == 1:
		print('7' + '1' * (n // 2 - 1))


t = int(input())
for y in range(t):
	n = int(input())
	s = ''
	if n % 2 == 1:
		s += '7'
		n -= 3
	s += n // 2 * '1'
	print(int(s))


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	while n > 0:
		print(1, end='')
		n -= 2
	print()


T = int(input())
for t in range(T):
	n = int(input())
	reqd = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n < 2:
		print(0)
	elif n == 2:
		print(1)
	else:
		n -= 3
		if n == 0:
			print(7)
		elif n == 1:
			print(11)
		else:
			n += 3
			if n & 1:
				print(str(7) + str(1) * ((n - 3) // 2))
			else:
				print(str(1) * (n // 2))


x = int(input())
i = 0
while i < x:
	i = i + 1
	a = int(input())
	result = ''
	if a == 3:
		print('7')
	elif a % 2 == 0:
		a = int(a / 2)
		for j in range(a):
			result = result + '1'
		print(result)
	else:
		a = int(a / 2)
		a = a - 1
		result = result + '7'
		for j in range(a - 1):
			result = result + '1'
		result = result + '1'
		print(result)


t = int(input())
for i in range(t):
	num = int(input())
	if num % 2 == 0:
		print('1' * (num // 2))
	else:
		print('7', end='')
		print('1' * ((num - 2) // 2))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	c = n % 2
	if c == 0:
		print('1' * int(n / 2))
	elif n >= 3:
		print('7' + '1' * int(n / 2 - 1))
	else:
		print('1' * int(n / 2))


import sys
input = sys.stdin.buffer.readline
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * '1')
	else:
		print('7' + (n - 3) // 2 * '1')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		out = '1' * (n // 2)
	else:
		out = '7'
		n = n - 3
		if n >= 2:
			out += '1' * (n // 2)
	print(out)


from math import floor as fl
for _ in range(int(input())):
	a = int(input())
	c = a % 2
	b = fl(a / 2)
	if c == 1:
		n = '7'
	else:
		n = '1'
	for i in range(b - 1):
		n = n + '1'
	print(n)


for _ in range(int(input())):
	n = int(input())
	for i in range(n // 2):
		if n % 2:
			n = n - 1
			print(7, sep='', end='')
			continue
		print(1, sep='', end='')
	print()


T = int(input())
for i in range(T):
	n = int(input())
	a = n // 2
	if n % 2 == 0:
		print('1' * a)
	else:
		print('7' + '1' * (a - 1))


n = int(input())
res = ''
for _ in range(0, n):
	a = int(input())
	while a != 0:
		if a % 2 == 0:
			res += '1'
			a -= 2
		if a % 2 != 0:
			res += '7'
			a -= 3
	print(res)
	res = ''


t = int(input())
while t:
	t -= 1
	n = int(input())
	ans = ''
	if n & 1:
		ans += '7'
		n -= 3
	ans += '1' * (n // 2)
	print(ans)


len = 998244353
for _ in range(int(input())):
	n = int(input())
	k = n % 2
	n -= 2 * k
	print('7' * k, '1' * (n // 2), sep='')


test = int(input())
while test > 0:
	test -= 1
	nr = int(input())
	if nr % 2 == 1:
		print('7', end='')
		nr -= 3
	while nr > 0:
		print('1', end='')
		nr -= 2
	print('')


c = int(input())
for i in range(c):
	a = int(input())
	if a % 2 == 0:
		d = a // 2
	else:
		d = (a - 3) // 2
		print('7', end='')
	for i in range(d):
		print(1, end='')
	print()


t = int(input())
for i in range(0, t):
	n = int(input())
	n7 = n // 3
	n1 = n // 2
	nn7 = n % 3
	nn1 = n % 2
	if nn1 == 0:
		print('1' * n1)
	elif nn1 == 1 and n7 > 1:
		print('7' + '1' * (n1 - 1))
	elif nn7 == 1 and n1 > 1:
		print('7' * (n7 - 1) + '1' * 2)
	elif nn1 % 3 == 0:
		print('7' * int(nn1 / 3) + '1' * n1)
	elif nn7 % 2 == 0:
		print('7' * n7 + '1' * int(nn7 / 2))
	elif nn7 == 0:
		print('7' * n7)


for _ in range(int(input())):
	num = int(input())
	if num % 2:
		ans = ['7', '1' * ((num - 3) // 2)]
	else:
		ans = ['1' * (num // 2)]
	print(*ans, sep='')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		for j in range(int(n / 2)):
			print('1', end='')
		print('\n')
	else:
		print('7', end='')
		n = n - 3
		for j in range(int(n / 2)):
			print('1', end='')
		print('\n')


from sys import stdin
t = int(stdin.readline().strip())
for tt in range(t):
	n = int(stdin.readline().strip())
	ans = []
	for i in range(10 ** 5):
		n -= 2
		if n < 0:
			n += 2
			break
		ans.append('1')
	for i in range(len(ans)):
		if n >= 4:
			n -= 4
			ans[i] = '9'
			continue
		if n >= 1:
			n -= 1
			ans[i] = '7'
			continue
	res = ''
	for i in ans:
		res += i
	print(res)


t = int(input())
for i in range(t):
	x = int(input())
	if x % 2 == 1:
		print(7, end='')
		x -= 3
	while x > 0:
		print(1, end='')
		x -= 2
	print()


num = int(input())
a = {2: 1, 3: 7}
for _ in range(num):
	n = int(input())
	ar = []
	if n % 2 == 0:
		n = n / 2
		n = int(n)
		for i in range(n):
			ar.append('1')
		ans = ''.join(ar)
	else:
		n = n - 3
		ar.append('7')
		for i in range(int(n / 2)):
			ar.append('1')
		ans = ''.join(ar)
	print(ans)


t = int(input())
l = []
for i in range(t):
	x = int(input())
	l.append(x)
for i in range(t):
	ch = ''
	if l[i] % 2 == 0:
		ch += l[i] // 2 * '1'
	elif l[i] > 1:
		ch = '7' + (l[i] - 3) // 2 * '1'
	print(ch)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def S_():
	return input()

def LS():
	return [i for i in input().split()]

def I():
	return int(input())

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
t = I()
for _ in range(t):
	ans = 0
	n = I()
	if n % 2 == 0:
		for i in range(n // 2):
			print(1, end='')
	else:
		print(7, end='')
		for i in range((n - 2) // 2):
			print(1, end='')
	print()


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problemA():
	d = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
	t = inp(int)
	for _ in range(t):
		n = inp(int)
		if n == 0:
			print(0)
			continue
		s = ''
		for i in range(n // 2):
			s = s + '1'
		if n % 2 == 1:
			s = '7' + s[1:]
		print(s)
problemA()


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 == 1:
			print(7, end='')
			n -= 3
		while n > 0:
			print(1, end='')
			n -= 2
		print()
main()


for i in range(int(input())):
	n = int(input())
	s = n // 2 * '1'
	if n % 2 == 1:
		s = '7' + s[1:]
	print(s)


dic = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
dicc = {2: 1, 3: 7}
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(dicc[n])
	else:
		countt = n // 2
		if n % 2 == 1:
			countt -= 1
			print('7', end='')
		for i in range(countt):
			print('1', end='')
		print()


for _ in range(int(input())):
	elm = int(input())
	print(elm // 2 * '1') if elm % 2 == 0 else print('7' + str((elm - 3) // 2 * '1'))


t = int(input())
for _ in range(t):
	x = int(input())
	ones = x // 2
	sevens = 0
	if x % 2 == 1:
		sevens = 1
		ones -= 1
	s = '7' * sevens + '1' * ones
	print(s)


A = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


n = int(input())
for x in range(n):
	a = int(input())
	w = ''
	if a == 2:
		print(1)
		continue
	elif a == 3:
		print(7)
		continue
	elif a % 2 == 0:
		for y in range(0, a // 2):
			w += '1'
	else:
		w += '7'
		for y in range(0, a // 2 - 1):
			w += '1'
	print(w)


n = int(input())
for i in range(n):
	num = int(input())
	if num // 2 == num // 3:
		print('7' * (num // 3))
	elif num % 2:
		print('7' * (num % 2) + '1' * (num // 2 - 1))
	else:
		print('1' * (num // 2))


test = int(input())
for i in range(test):
	num = ''
	flag = True
	flag1 = True
	leds = int(input())
	while flag:
		if leds % 2 != 0:
			while flag1:
				num += '7'
				leds -= 3
				if leds % 2 == 0:
					flag1 = False
		else:
			div2 = leds / 2
			for i in range(int(div2)):
				num += '1'
			flag = False
	print(num)


t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	ans = list()
	while x != 3:
		x -= 2
		ans.append(1)
		if x == 0:
			break
		else:
			continue
	if x != 0:
		ans.append(7)
	ans.sort()
	ans = ans[::-1]
	a = ''.join(map(str, ans))
	print(int(a))


t = int(input())
for q in range(t):
	n = int(input())
	if n % 2 == 0:
		ones = '1' * (n // 2)
		print(ones)
	else:
		ones = '1' * (n // 2 - 1)
		ones = '7' + ones
		print(ones)


n = int(input())
for i in range(n):
	x = int(input())
	s = ''
	if x % 2 == 0:
		for _ in range(x // 2):
			s = s + '1'
	else:
		for _ in range(x // 2 - 1):
			s = s + '1'
		s = '7' + s
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	rv = []
	if n % 2 == 1:
		rv.append('7')
		n -= 3
	while n > 0:
		rv.append('1')
		n -= 2
	print(''.join(rv))


for i in range(int(input())):
	n = int(input())
	s = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	res = ''
	while n != 0:
		if n % 2 != 0:
			res += '7'
			n = n - 3
		else:
			res += '1'
			n = n - 2
	print(res)


T = int(input())
for t in range(T):
	n = int(input())
	res = ['1'] * (n // 2)
	if n % 2 == 1:
		res[0] = '7'
	print(int(''.join(res)))


t = int(input())
for i in range(t):
	n = int(input())
	a = n % 2
	if a == 0:
		print('1' * (n // 2))
	elif a == 1:
		print(int('7' + '1' * (n // 2 - 1)))


i = int
n = input
a = i(n())
for m in range(a):
	k = i(n())
	b = 3
	if k % 2 == 0:
		b = 0
	if k != 3:
		print('7' * i(b / 3) + '1' * i((k - b) / 2))
	else:
		print('7')


t = int(input())
while t:
	n = int(input())
	if n % 2 != 0:
		b = [1] * int((n - 3) / 2)
		(print('7', end=''), print(*b, sep=''))
	else:
		a = [1] * int(n / 2)
		print(*a, sep='')
	t -= 1


t = int(input())
while t > 0:
	n = int(input())
	if n % 2 != 0:
		f = n - 3
		o = f // 2
		print('7', end='')
		for i in range(o):
			print('1', end='')
	else:
		o = n // 2
		for i in range(o):
			print('1', end='')
	print(' ')
	t = t - 1


t = int(input())
for j in range(t):
	n = int(input())
	number = []
	if n % 2 == 0:
		for i in range(int(n / 2)):
			number.append(1)
	else:
		for i in range(int(n / 2) - 1):
			number.append(1)
		number.insert(0, 7)
	print(*number, sep='')


import sys, itertools, math

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())
for _ in range(ii()):
	n = ii()
	s = ''
	while n > 0:
		if n >= 4:
			s = '1' + s
			n -= 2
		elif n == 3:
			s = '7' + s
			n -= 3
		elif n == 2:
			s = '1' + s
			n -= 2
		else:
			n = 0
	print(s)


from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint
from itertools import permutations

def main():
	n = int(input())
	ans = ['11'] * (n // 4)
	rm = n % 4
	if rm == 1:
		if len(ans):
			ans.pop()
			ans += ['1']
		ans = ['7'] + ans
	if rm == 2:
		ans += ['1']
	if rm == 3:
		ans = ['7'] + ans
	print(''.join(ans))
for _ in range(int(input())):
	main()


def solve():
	s = int(input())
	res = '1' * (s // 2)
	if s % 2 == 1:
		res = '7' + res[1:]
	print(res)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	l = []
	if n % 2 != 0:
		l.append('7')
		n = n - 3
	n = n // 2
	l = l + ['1'] * n
	print(''.join(l))


d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
t = int(input())
for i in range(t):
	n = int(input())
	x = n // 2
	r = n % 2
	left = r + 2
	m = -1
	for n in d:
		if d[n] <= left:
			m = int(n)
	number = str(m) + '1' * (x - 1)
	print(number)


x = int(input())
lst = []
st = ''
for i in range(x):
	lst.append(int(input()))
for i in lst:
	st = ''
	while len(st) < 998244353 and i >= 2:
		st = '1' + st
		i -= 2
	st = list(st)
	for j in range(len(st)):
		if i >= 5:
			st[j] = '9'
			i -= 5
			continue
		elif i >= 1:
			st[j] = '7'
			i -= 3
			continue
	print(''.join(st))


n = int(input())
for _ in range(n):
	x = int(input())
	(a, b) = divmod(x, 2)
	if b == 1:
		print('7' + '1' * (a - 1))
	else:
		print('1' * a)


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	ones = n // 2
	if n % 2 == 0:
		result.append('1' * ones)
	else:
		result.append('7' + '1' * (ones - 1))
for i in result:
	print(i)


import sys
tests = int(sys.stdin.readline())
for i in range(tests):
	segments = int(sys.stdin.readline())
	r = segments % 2
	n = int(segments / 2)
	num = ['1'] * (n - 1)
	if r == 1:
		num = ['7'] + num
	else:
		num = ['1'] + num
	print(''.join(num))


t = int(input())
n = [int(input()) for _ in range(t)]
for i in n:
	display = ''
	if i % 2 == 0:
		display = '1' * int(i / 2)
	else:
		display = '7' + '1' * (int(i / 2) - 1)
	print(display)


for _ in range(int(input())):
	n = int(input())
	ans = ''
	while n > 3:
		ans += '1'
		n -= 2
	if n == 3:
		ans = '7' + ans
	elif n == 2:
		ans += '1'
	print(ans)


for t in range(int(input())):
	n = int(input())
	if n % 2:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


n = int(input())
for i in range(n):
	d = int(input())
	if d % 2 == 1:
		e = (d - 3) // 2
		s = '7' + '1' * e
	else:
		e = d // 2
		s = '1' * e
	print(s)


def res(n):
	if n % 2 == 0:
		return '1' * (n // 2)
	else:
		return '7' + '1' * ((n - 2) // 2)
t = int(input())
for i in range(t):
	n = int(input())
	print(res(n))


t = int(input())
for e in range(t):
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2) * '1')
	elif n == 3:
		print('7')
	else:
		print('7' + int((n - 3) / 2) * '1')


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		k = I()
		a = ''
		while True:
			if k == 0:
				break
			if k == 1:
				a = a[:-1]
				a += '7'
				break
			k -= 2
			a += '1'
		ans.append(a[::-1])
	for x in ans:
		print(x)
main()


for i in range(int(input())):
	n = int(input())
	b = n // 2
	p = b - 1
	if n % 2 == 0:
		print('1' * b)
	else:
		s = '1'
		print('7' + s * p)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def SI():
	return sys.stdin.readline()[:-1]

def MI():
	return map(int, sys.stdin.readline().split())

def MI1():
	return map(int1, sys.stdin.readline().split())

def MF():
	return map(float, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LF():
	return list(map(float, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
	t = II()
	for _ in range(t):
		n = II()
		if n % 2:
			ans = '7' + '1' * ((n - 3) // 2)
		else:
			ans = '1' * (n // 2)
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('7', end='')
		for i in range(int((n - 3) / 2)):
			print('1', end='')
	else:
		for i in range(n // 2):
			print('1', end='')
	print()


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().split()]

def st():
	return input()

def val():
	return int(input())

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def givetempans(n):
	if n >= 6:
		return 9
	elif n >= 3:
		return 7
	elif n == 2:
		return 1
	else:
		return 0
for _ in range(val()):
	n = val()
	curr = ''
	while n > 3:
		curr += '1'
		n -= 2
	curr = str(givetempans(n)) + curr
	print(curr)


for _ in range(int(input())):
	n = int(input())
	print('7' * (n % 2) + '1' * (n // 2 - n % 2))


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	if not n % 2:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


n = int(input())
for i in range(n):
	strng = ''
	x = int(input())
	if x % 2 == 0:
		print('1' * (x // 2))
		continue
	else:
		print('7' + (x - 3) // 2 * '1')
		continue


def one():
	return int(input())

def two():
	return map(int, input.split())

def l():
	return list(map(int, input.split()))

def st():
	return input()
d = {2: '1', 3: '7', 4: '4', 5: '5', 6: '9', 7: '8'}
for i in range(one()):
	n = one()
	ans = []
	while n >= 2:
		ans += d[2]
		n -= 2
	if n != 0:
		j = n + 2
		while j not in d:
			j -= 1
		ans[0] = d[j]
	print(*ans, sep='')


exec(int(input()) * 'n=int(input());print("17"[n%2]+(n//2-1)*"1");')


a = int(input())
inp = []
out = []
for i in range(a):
	b = int(input())
	inp.append(b)
for j in range(a):
	a = inp[j] // 2
	b = '1' * (a - 1)
	if inp[j] % 2 == 0:
		b += '1'
	else:
		b = '7' + b
	out.append(int(b))
for x in out:
	print(x)


segments = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
tests = int(input())

def basecases(x):
	if x == 2:
		return 1
	elif x == 3:
		return 7
	return 0
for test in range(tests):
	n = int(input())
	if n <= 3:
		num = basecases(n)
		print(num)
		continue
	else:
		quot = n // 2
		rem = n - quot * 2
		num = ''
		if rem == 1:
			num = num + '7'
			quot -= 1
		for i in range(quot):
			num = num + '1'
		print(num)


import sys, atexit
from io import BytesIO
inp = BytesIO(sys.stdin.buffer.read())
input = lambda : inp.readline().decode('ascii')
buf = BytesIO()
sys.stdout.write = lambda s: buf.write(s.encode('ascii'))
print = lambda s: buf.write(s.encode('ascii'))
atexit.register(lambda : sys.__stdout__.buffer.write(buf.getvalue()))
for i in range(int(input())):
	ans = ''
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2) + '\n'
	else:
		ans = '7' + '1' * (n // 2 - 1) + '\n'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	d = {6: 9, 2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
	ans_d = n // 2
	u = n - ans_d * 2
	if u != 0:
		i = u + 2
		if d.get(i) != None:
			print(str(d.get(i)) + '1' * (ans_d - 1))
		else:
			print('1' * ans_d)
	else:
		print('1' * ans_d)


t = int(input())
s = []
for ikjfi in range(0, t):
	n = int(input())
	if n % 2 == 0:
		n = int(n / 2)
		a = '1' * n
		s.append(a)
	else:
		n = int((n - 3) / 2)
		a = '1' * n
		b = '7'
		c = b + a
		s.append(c)
for i in s:
	print(int(i))


md = 998244353
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		res = '1' * (n // 2)
	else:
		res = '1' * (n // 2)
		l = list(res)
		l[0] = '7'
		res = ''.join(l)
	print(res)


from sys import stdin, stdout
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
	elif n & 1:
		print('7' + '1' * (n - 3 >> 1))
	else:
		print('1' * (n >> 1))


def biggest_number(n):
	if n % 2 == 0:
		return int('1' * (n // 2))
	else:
		return int('7' + '1' * ((n - 3) // 2))
N = int(input())
a = [0] * N
for i in range(N):
	a[i] = int(input())
for elem in a:
	res_for_elem = biggest_number(elem)
	print(res_for_elem)


t = int(input())
for i in range(0, t):
	n = int(input())
	ans = ''
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	elif n % 2 == 0:
		for k in range(0, n // 2):
			ans += '1'
		print(ans)
	else:
		ans += '7'
		for k in range(0, (n - 3) // 2):
			ans += '1'
		print(ans)


num_t = int(input())
for _ in range(num_t):
	n = int(input())
	if n & 1:
		s = '7'
		n -= 3
	else:
		s = ''
	s += '1' * (n // 2)
	print(s)


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	elif n % 2 != 0:
		print('7' + '1' * ((n - 3) // 2))


digits = [(0, 6), (1, 2), (2, 5), (3, 5), (4, 4), (5, 5), (6, 6), (7, 3), (8, 7), (9, 6)][::-1]
t = int(input())
for _ in range(t):
	n = int(input())
	ones = n // 2
	number = ones * '1'
	if n % 2 != 0:
		number = '7' + (ones - 1) * '1'
	print(number)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		n = int(input())
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * (n // 2 - 1))
	except:
		continue


a = int(input())
b = [0] * a
for i in range(a):
	b[i] = int(input())
for i in range(a):
	if b[i] % 2 == 0:
		for i in range(b[i] // 2):
			print(1, end='')
	else:
		print(7, end='')
		for i in range(b[i] // 2 - 1):
			print(1, end='')
	print()


for i in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		n = n // 2
		ls = ['1'] * n
		print(''.join(map(str, ls)))
	else:
		print('7', end='')
		n = n - 3
		n = n // 2
		ls = ['1'] * n
		print(''.join(map(str, ls)))


from sys import stdin

def inp():
	return (s.rstrip() for s in stdin).__next__()

def mpint():
	return map(int, inp().split())
MOD = 998244353
for case in range(int(inp())):
	n = int(inp())
	ans = '1' * (n >> 1)
	if n & 1:
		ans = '7' + ans[1:]
	print(ans)


a = int(input())
for i in range(a):
	output = ''
	b = int(input())
	if b % 2 == 0:
		c = b / 2
	else:
		c = (b - 3) / 2
		output = '7'
	for j in range(int(c)):
		output = output + '1'
	print(int(output))


import math
for i in range(int(input())):
	n = int(input())
	p = []
	l = n // 2
	for i in range(l):
		p.append(1)
	if n % 2 == 1:
		p[0] = 7
	for i in range(len(p)):
		print(p[i], end='')
	print('\n')


t = int(input())
for _ in range(t):
	n = int(input())
	o = ['1'] * (int(n / 2) - 1)
	if n % 2 == 0:
		o.insert(0, '1')
	elif n >= 3:
		o.insert(0, '7')
	else:
		o.append('0')
	print(''.join(o))


T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	if N % 2 == 0:
		print('1' * (N // 2))
	else:
		S = '7' + str('1' * ((N - 3) // 2))
		print(S)


n = int(input())
otv = [''] * n
for i in range(n):
	x = int(input())
	if x % 2 != 0:
		otv[i] = '7'
		x -= 3
	otv[i] = otv[i] + '1' * (x // 2)
for i in otv:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	q = n // 2
	if n % 2 != 0:
		string = '7' + '1' * (q - 1)
	else:
		string = '1' * q
	print(string)


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	l = n % 2
	if l == 1:
		k -= 1
	print('7' * l + '1' * k)


t = int(input())
for i in range(t):
	n = int(input())
	q = n - n // 2 * 2
	res = '1' * (n // 2 - 1)
	if n == 3:
		res = 7
	elif q == 1:
		res = '7' + res
	elif q == 0:
		res = '1' + res
	print(res)


T = int(input())
while T:
	T = T - 1
	n = int(input())
	if n % 2 == 0:
		for i in range(int(n / 2)):
			print('1', end='')
		print()
	else:
		print('7', end='')
		for i in range(int(n / 2) - 1):
			print('1', end='')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	if n % 2 == 1:
		s.append('7')
		n -= 3
	while n > 0:
		s.append('1')
		n -= 2
	print(''.join(s))


q = int(input())
for i in range(q):
	st = ''
	w = int(input())
	k = w // 2
	if w % 2 == 0 and w > 1:
		for j in range(k):
			st = st + '1'
	elif w % 2 != 0 and w > 1:
		for j in range(k - 1):
			st = st + '1'
		st = '7' + st
	print(st)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip(chr(39) + chr(92) + chr(114) + chr(92) + chr(110) + chr(39))
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	ans = ['1'] * (n // 2)
	if n % 2:
		ans[0] = '7'
	print(''.join(ans), sep='')


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	flag = 0
	if n > k * 2:
		k = k - 1
		flag = 1
	if flag == 1:
		stri = '7'
	else:
		stri = ''
	for j in range(k):
		stri = stri + '1'
	print(stri)


import math
import sys

def listinput():
	return list(map(int, input().split(' ')))

def main():
	answer = ''
	for test in range(int(input())):
		n = int(input())
		num = ''
		if n % 2 == 1:
			num = '7'
			n -= 3
		num += '1' * (n // 2)
		answer += num + '\n'
		pass
	print(answer)
main()


CASES = int(input())
for i in range(CASES):
	n = int(input())
	quo = n // 2
	rem = n % 2
	if rem == 0:
		print(quo * '1')
	else:
		print('7' + (quo - 1) * '1')


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print('1')
	elif n == 3:
		print('7')
	elif n % 2 == 0:
		s = ''
		for i in range(n // 2):
			s = s + '1'
		print(s)
	else:
		r = n // 2
		s = ''
		for i in range(r - 1):
			s = s + '1'
		print('7' + s)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		a = ['1'] * (n // 2)
		print(''.join(a))
	else:
		a = ['1'] * ((n - 3) // 2)
		print('7' + ''.join(a))


q = int(input())
for i in range(q):
	n = int(input())
	s = ''
	while n > 0:
		if n % 2 == 1:
			s += '7'
			n -= 3
		else:
			s += '1'
			n -= 2
	print(s)


CaseNo = int(input())
for x in range(CaseNo):
	n = int(input())
	Output = ''
	while n > 0:
		if n % 2 != 0:
			Output += '7'
			n -= 3
		if n > 0 and n % 2 == 0:
			Output += '1'
			n -= 2
	print(Output)


t = int(input())
for q in range(t):
	n = int(input())
	if n % 2 == 0:
		x = n // 2
		print('1' * x)
	else:
		x = (n - 3) // 2
		print('7' + '1' * x)


def solve(n):
	if n % 2 == 1:
		return '7' + '1' * ((n - 3) // 2)
	else:
		return '1' * (n // 2)

def main():
	for _ in range(int(input())):
		n = int(input())
		print(solve(n))
main()


def solve():
	n = int(input())
	ans = ['1'] * (n // 2)
	if n % 2 > 0:
		ans[0] = '7'
	print(''.join(ans))
test = 1
test = int(input())
for _ in range(test):
	solve()


t = int(input())
s = [4, 2, 5, 5, 4, 5, 6, 3, 7, 6]
re = list()
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		re.append('1' * int(n / 2))
	elif n == 3:
		re.append(7)
	elif n % 2 == 1:
		re.append('7' * 1 + '1' * int(n / 2 - 1))
for i in re:
	print(i)


def qu():
	n = int(input())
	if n & 1:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))

def cal_exe(func):
	for _ in range(func()):
		qu()

@cal_exe
def Input():
	t = int(input())
	return t


for fuck in range(int(input())):
	n = int(input())
	number = 0
	if n % 2 == 0:
		s = '1'
		s1 = n // 2 * s
		number = str(s1)
	elif n % 2 != 0:
		sev = 7
		s = '1'
		s1 = s * (n // 2 - 1)
		s2 = '7'
		s3 = s2 + s1
		number = str(s3)
	print(number)


def solve():
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	q = n // 2
	rem = n % 2
	s = ''
	for i in range(q - 1):
		s += '1'
	if rem == 0:
		s += '1'
	else:
		s = '7' + s
	print(s)


t = int(input())
while t:
	t -= 1
	num = int(input())
	if num % 2:
		num -= 3
		print(7, end='')
	while num:
		print(1, end='')
		num -= 2
	print()


T = int(input())
for _ in range(T):
	num = int(input())
	if num % 2 == 0:
		print('1' * int(num / 2))
	else:
		print('7' + '1' * (int(num / 2) - 1))


for x in range(int(input())):
	n = int(input())
	if n % 2:
		s = '7'
		s += (n - 3) // 2 * '1'
		print(s)
	else:
		print(n // 2 * '1')


T = int(input())
table = {2: [1], 3: [7], 4: [4], 5: [5, 3, 2], 6: [9, 6, 0], 7: [8]}
store = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
max_num = [9, 9, 8, 2, 4, 4, 3, 5, 3]

def arr_to_num(arr):
	answer = 0
	mult = 1
	for i in arr:
		answer = answer + mult * i
		mult = mult * 10
	return answer

def req(digit, leds):
	answer = None
	for i in range(digit + 1, 10):
		if store[i] <= leds + 2:
			answer = i
	return answer
for _ in range(T):
	N = int(input())
	if N % 2 == 0:
		for i in range(N // 2):
			print(1, end='')
		print('')
	else:
		print(7, end='')
		for i in range(N // 2 - 1):
			print(1, end='')
		print('')


t = int(input())
l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
while t > 0:
	n = int(input())
	if n == 2:
		print(1)
	elif n % 2 == 0:
		p = n // 2
		for i in range(0, p):
			print(1, end='')
	else:
		n = n - 3
		p = n // 2
		print(7, end='')
		for i in range(0, p):
			print(1, end='')
	print()
	t -= 1


l = ['0', '0', '1', '7', '11', '71', '111', '711']
t = int(input())
while t:
	n = int(input())
	if n < 8:
		print(l[n])
	elif n % 2 == 0:
		s = ''
		for i in range(0, n // 2):
			s = s + '1'
		print(s)
	else:
		s = '7'
		x = (n - 3) // 2
		for i in range(0, x):
			s = s + '1'
		print(s)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	ans = '1' * (n // 2 - 1)
	if n % 2:
		ans = '7' + ans
	else:
		ans = '1' + ans
	print(ans)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n % 2 == 1:
		print('7', end='')
		n = n - 3
	while n > 0:
		print('1', end='')
		n = n - 2
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = ''
	if n % 2 != 0:
		n = n - 3
		a += str(7)
	while n != 0:
		n = n - 2
		a += str(1)
	print(a)


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
t = int(input())
for i in range(t):
	n = int(input())
	ans = ''
	if n % 2 == 0:
		ans = '1' * (n // 2)
	elif n >= 3:
		ans = '7' + '1' * (n // 2 - 1)
	print(ans)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	n = get_int()
	if n % 2 == 0:
		ones = n // 2
		print('1' * ones)
	else:
		ones = (n - 3) // 2
		print('7' + '1' * ones)


for _ in range(int(input())):
	n = int(input())
	res = ''
	if n % 2 == 1:
		res = '7'
		n -= 3
	res += '1' * (n // 2)
	print(res)


t = int(input())
dic = {2: 1, 3: 7, 6: 9}
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print('7', end='')
	else:
		print('1', end='')
	for j in range(n // 2 - 1):
		print('1', end='')
	print('\n')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	rtn = ''
	if n % 2 == 1:
		rtn += '7'
		n -= 3
	n //= 2
	while n > 0:
		rtn += '1'
		n -= 1
	print(rtn)


result = []
for t in range(int(input())):
	n = int(input())
	q = n // 2
	r = n % 2
	q = q if r == 0 else q - 1
	s = '7' * r + '1' * q
	result.append(str(s))
print('\n'.join(result))


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	if N & 1:
		ans = '7'
		N -= 3
		ans = ans + N // 2 * '1'
	else:
		ans = N // 2 * '1'
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	res = ''
	while n > 3:
		res = res + '1'
		n = n - 2
	if n == 3:
		res = '7' + res
	elif n - -2:
		res = res + '1'
	print(res)


t = int(input())
num = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


ll = lambda : list(map(int, input().split()))
from math import *
[t] = ll()
for i in range(t):
	[x] = ll()
	if x & 1:
		print(7, end='')
		for i in range((x - 3) // 2):
			print(1, end='')
	else:
		for i in range(x // 2):
			print(1, end='')
	print()


for _ in range(int(input())):
	n = int(input())
	ans = ''
	if n % 2 == 0:
		ans = '1' * (n // 2)
		print(ans)
	else:
		ans = '7'
		n -= 3
		s = '1' * (n // 2)
		ans += s
		print(ans)


kl = int(input())
for l in range(kl):
	n = int(input())
	if n % 2 == 0:
		a = '1' * (n // 2)
	else:
		a = '7' + '1' * (n // 2 - 1)
	print(int(a))


def nn(n):
	if n == 2:
		return 1
	elif n == 3:
		return 7
	elif n == 5:
		return 2
	elif n == 4:
		return 4
	elif n == 6:
		return 9
	else:
		return 8
for i in range(int(input())):
	n = int(input())
	k = n // 2
	arr = [1] * k
	p = n % 2 + 2
	arr[0] = nn(p)
	res = int(''.join(map(str, arr)))
	print(res)


test = int(input())
dic = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
for times in range(test):
	num = int(input())
	if num % 2 == 0:
		print(int(num / 2) * '1')
	else:
		adet = num // 2 - 1
		print('7' + adet * '1')


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	if n % 2 == 1:
		print('7', end='')
		for i in range(n // 2 - 1):
			print('1', end='')
		print()
	else:
		for i in range(n // 2):
			print('1', end='')
		print()


t = int(input())
while t:
	n = int(input())
	print('1' * (n // 2) if not n & 1 else '7' + '1' * (n // 2 - 1))
	t -= 1


test = int(input())
while test != 0:
	n = int(input())
	str1 = ''
	if n % 2 == 0:
		for i in range(n // 2):
			str1 += '1'
	else:
		str1 += '7'
		n = n - 3
		for i in range(n // 2):
			str1 += '1'
	print(str1)
	test -= 1


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			ans = ['1' for j in range(n // 2)]
			print(''.join(ans))
		else:
			if n > 3:
				ans = ['1' for j in range((n - 3) // 2)]
			else:
				ans = []
			ans.insert(0, '7')
			print(''.join(ans))
main()


num = int(input())
array = []
for i in range(num):
	array.append(int(input()))
for i in range(num):
	digit = int(array[i] / 2)
	if array[i] % 2 == 0:
		for j in range(digit):
			print('1', end='')
	else:
		print('7', end='')
		for j in range(digit - 1):
			print('1', end='')
	print('')


t = int(input())
for _ in range(t):
	maxy = -1
	n = int(input())
	if n % 2 == 0:
		l = []
		for _ in range(n // 2):
			l.append(1)
	else:
		l = [7]
		for _ in range(n // 2 - 1):
			l.append(1)
	print(''.join(map(str, l)))


a = int(input())
for i in range(a):
	x = int(input())
	if x % 2 == 0:
		t = [1 for i in range(x // 2)]
		print(''.join(map(str, t)))
	else:
		t = [1 for i in range(x // 2)]
		t[0] = 7
		print(''.join(map(str, t)))


t = int(input())
for _ in range(t):
	n = int(input())
	(q, r) = divmod(n, 2)
	if r == 0:
		print('1' * q)
	else:
		print('7' + '1' * (q - 1))


t = int(input())
ans = []

def g(int):
	if int == 2:
		return 1
	elif int == 3:
		return 7
	elif int == 4:
		return 4
	elif int == 5:
		return 5
	elif int == 6:
		return 9
	else:
		return 8

def f(n):
	d = n // 2
	ost = n % 2
	a = []
	for i in range(0, d):
		a.append('1')
	if ost == 1:
		a[0] = '7'
	s = ''
	for k in a:
		s = s + k
	return s
for j in range(0, t):
	h = int(input())
	ans.append(f(h))
for element in ans:
	print(element)


l = []
for i in range(int(input())):
	n = int(input())
	ans = '1' * (n // 2)
	if n % 2 > 0:
		ans = list(ans)
		ans[0] = '7'
		ans = ''.join(ans)
		l.append(ans)
	else:
		l.append(ans)
print(*l, sep='\n')


def getInput():
	return input().strip()
T = int(getInput())
for _ in range(T):
	n = int(getInput())
	digits = n // 2
	if n & 1:
		print(7, end='')
	else:
		print(1, end='')
	for i in range(digits - 1):
		print(1, end='')
	print()


segments = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}

def solve():
	n = int(input())
	if n & 1:
		if n == 1:
			pass
		n -= 3
		rem = n // segments[1]
		print('7' + str(1) * rem)
	else:
		rem = n // segments[1]
		print(str(1) * rem)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	ans = []
	while n >= 2:
		if n == 3:
			ans.append(7)
			n -= 3
		else:
			ans.append(1)
			n -= 2
	rev = ans[::-1]
	for i in range(len(ans)):
		if rev[i] > ans[i]:
			ans = rev
			break
	for i in range(len(ans)):
		print(ans[i], end='')
	print()


t = int(input())
for x in range(t):
	n = int(input())
	a = n // 2
	if a * 2 == n:
		print('1' * a)
	else:
		print('7' + '1' * (a - 1))


t = int(input())
for i in range(t):
	r = int(input())
	if r == 3:
		print(7)
		continue
	if r % 2 == 1:
		print(7, end='')
		er = '1'
		we = ''
		for i in range(r // 2 - 1):
			we += er
		print(we)
	else:
		er = '1'
		we = ''
		for i in range(r // 2):
			we += er
		print(we)


t = int(input())
for i in range(0, t):
	n = int(input())
	g = n // 2
	gg = '1' * (g - 1)
	if n % 2 != 0:
		dio = '7' + gg
	else:
		dio = '1' + gg
	print(dio)


import sys
input = sys.stdin.readline
out = []
for _ in range(int(input().strip())):
	n = int(input().strip())
	if n & 1:
		if n == 3:
			out.append('7')
		else:
			out.append('7' + '1' * ((n - 3) // 2))
	else:
		out.append('1' * (n // 2))
print('\n'.join(out))


T = int(input())
for i in range(T):
	N = int(input())
	string = ''
	if N == 3:
		print(7)
	else:
		while N >= 2:
			if N >= 4:
				N -= 2
				string = str(1) + string
			elif N >= 3:
				string = str(7) + string
				N -= 3
			else:
				N -= 2
				string = str(1) + string
		print(string)


need = [0] * 10
need[1] = 2
need[2] = 5
need[3] = 5
need[4] = 4
need[5] = 5
need[6] = 6
need[7] = 3
need[8] = 7
need[9] = 6
for _ in range(int(input())):
	n = int(input())
	can1 = n // 2 - 1
	for i in range(9, 0, -1):
		if need[i] + can1 * 2 <= n:
			print(str(i) + '1' * can1)
			break


def calculate_max_no(max_segements: int):
	max_no = str()
	while max_segements > 1:
		if max_segements > 3 or max_segements < 3:
			max_no += '1'
			max_segements -= 2
		else:
			max_no = '7' + max_no
			max_segements -= 3
	return max_no if max_no else 0

def calculate_max_no_by_equation(max_segements: int):
	sevens = max_segements % 2
	ones = int(max_segements / 2) - sevens
	if ones >= 0:
		return sevens * '7' + ones * '1'
	else:
		return 0
no_of_tcs = int(input())
for _ in range(no_of_tcs):
	max_segements = int(input())
	print(calculate_max_no_by_equation(max_segements=max_segements))


t = int(input())
while t:
	n = int(input())
	f = n % 2
	k = n // 2
	print('7' * f + '1' * (k - f))
	t = t - 1


test = int(input())
for i in range(test):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	while n > 0:
		print(1, end='')
		n -= 2
	print()


for i in range(int(input())):
	n = int(input())
	if n == 4:
		print(11)
	elif n == 1:
		print(0)
	elif n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


t = int(input())
for _ in range(t):
	n = int(input())
	res = []
	if n & 1 == 1:
		n -= 3
		res.append('7')
	res.extend(['1'] * (n // 2))
	res = ''.join(res)
	print(res)


for _ in range(int(input())):
	N = int(input())
	if N % 2 == 0:
		print('1' * (N // 2))
	else:
		print('7' + '1' * ((N - 3) // 2))


def Input():
	ans = []
	tem = input().split()
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	n = Input()[0]
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	else:
		if n % 2 == 0:
			print(1, end='')
		else:
			print(7, end='')
		m = n // 2
		for i in range(m - 1):
			print(1, end='')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	if n % 2 != 0:
		print('7', end='')
		n -= 3
	print('1' * (n // 2))


for i in range(int(input())):
	n = int(input())
	ans = 0
	ch = n // 2
	chh = 0
	if n - ch * 2 == 1:
		ch -= 1
		chh = 1
	if ch != 0:
		ans = chh * 7 * 10 ** ch + int(ch * '1')
	else:
		ans = chh * 7 * 10 ** ch
	print(ans)


def makeNumber(number):
	string = ''
	if number % 2 == 0:
		string += '1' * (number // 2)
	else:
		string += '7'
		number -= 3
		string += '1' * (number // 2)
	return string
testcases = int(input())
for t in range(testcases):
	number = int(input())
	print(makeNumber(number))


n = input()
n = int(n)
l = []
for i in range(n):
	j = []
	k = input()
	k = int(k)
	while 1:
		if (k - 2) % 3 == 0 or (k - 2) % 2 == 0:
			j.append('1')
			k -= 2
		else:
			j.insert(0, '7')
			k -= 3
		if k <= 0:
			break
	j = ''.join(j)
	l.append(j)
for i in range(n):
	print(l[i])


for i in range(int(input())):
	x = int(input())
	if x % 2:
		print('7' + '1' * (x // 2 - 1))
	else:
		print('1' * (x // 2))


def solve(n):
	if n & 1:
		return '7' + '1' * ((n - 3) // 2)
	else:
		return '1' * (n // 2)
for T in range(int(input())):
	print(solve(int(input())))


import math
el = int(input())
for x in range(el):
	num = int(input())
	if num == 3:
		print(7)
	else:
		res = []
		for i in range(math.floor(num / 2)):
			res.append(1)
		if num % 2 == 1:
			res[0] = 7
		print(''.join((str(i) for i in res)))


n = int(input())
i = 0
for i in range(n):
	a = int(input())
	if a % 2 == 1:
		print(7, end='')
		a = a - 3
	while a > 1:
		if a == 3:
			print(7, end='')
			break
		print(1, end='')
		a = a - 2
	print()


n = int(input())
B = []
for i in range(n):
	a = int(input())
	A = []
	if a % 2 == 0:
		for i in range(int(a / 2)):
			A.append(1)
	else:
		A.append(7)
		for i in range(int((a - 3) / 2)):
			A.append(1)
	B.append(A)
for i in range(len(B)):
	print(*B[i], sep='')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		r = [1] * (n // 2)
		if n % 2 == 1:
			r[0] = 7
		rr.append(JA(r, ''))
	return JA(rr, '\n')
print(main())


t = input()
t = int(t)
for i in range(0, t):
	V = input()
	(div, mod) = divmod(int(V), 2)
	val = ''
	for i in range(0, div):
		if i == 0:
			if mod == 1:
				val = val + str(7)
			else:
				val = val + str(1)
		else:
			val = val + str(1)
	if V != '0':
		print(val)


t = int(input())
for _ in range(t):
	n = int(input())
	res = []
	i = 0
	while i < 10 and n >= 2:
		res.append(1)
		n -= 2
	i = 0
	while i < len(res) and n >= 1:
		if n >= 4:
			res[i] = 9
			n -= 4
		elif n >= 1:
			res[i] = 7
			n -= 1
		i += 1
	num = ''.join(list(map(str, res)))
	print(num)


for nt in range(int(input())):
	n = int(input())
	if n % 2:
		print('7' + '1' * (n // 2 - 1))
	else:
		print('1' * (n // 2))


for _ in range(int(input())):
	n = int(input())
	c = n // 2
	x = [1] * c
	if n & 1:
		x[0] = 7
	print(*x, sep='')


t = int(input())
r = []
for i in range(t):
	n = int(input())
	x = n // 2
	if n % 2 == 0:
		print('1' * x)
	else:
		print('7' + '1' * (x - 1))


import sys
import math
import heapq
import bisect
import re
from collections import deque
from decimal import *
from fractions import gcd

def YES_NO(flag):
	if flag:
		print('YES')
	else:
		print('NO')

def main():
	n = int(sys.stdin.readline())
	if n % 2:
		print('7', end='')
		n -= 3
	else:
		print('1', end='')
		n -= 2
	while n > 0:
		print('1', end='')
		n -= 2
	print()
for i in range(int(sys.stdin.readline())):
	main()


for __ in range(int(input())):
	n = int(input())
	c = 0
	d = 0
	l = []
	if n % 2 == 0:
		c = int(n / 2)
		for i in range(c):
			l.append(1)
	else:
		c = int(n / 2)
		for i in range(c):
			if d is 0:
				l.append(7)
				d = d + 1
			else:
				l.append(1)
	for i in l:
		print(i, end='')
	print()


t = int(input())
for _ in range(t):
	ans = ''
	n = int(input())
	if n >= 3 and n % 2 == 1:
		ans = ans + '7' + '1' * ((n - 3) // 2)
	else:
		ans = ans + '1' * (n // 2)
	print(ans)


for i in range(int(input())):
	seg = int(input())
	if seg % 2 == 0:
		print('1' * (seg // 2))
	else:
		print('7' + '1' * (seg // 2 - 1))


def fvv(n):
	a = [['1', 2], ['7', 3], ['4', 4], ['5', 5], ['9', 6], ['8', 7]]
	constru = ''
	mai = 0
	maio = 0
	for i in range(0, len(a)):
		l = n // a[i][1]
		if mai <= l:
			mai = l
			maio = i
	s = n % (n // mai)
	if s != 0:
		u = n // mai + s
		max = 0
		maxi = 0
		for i in range(0, len(a)):
			l = u // a[i][1]
			if max <= l:
				max = l
				maxi = i
		mai -= 1
		constru += a[maxi][0]
		for i in range(mai):
			constru += a[maio][0]
	else:
		for i in range(0, mai):
			constru += a[maio][0]
	return constru
t = int(input())
for c in range(t):
	print(fvv(int(input())))


for i in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		print(a // 2 * '1')
	else:
		print('7', (a // 2 - 1) * '1', sep='')


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		for i in range(n // 2):
			print('1', end='')
		print('')
	else:
		n -= 3
		print('7', end='')
		for i in range(n // 2):
			print('1', end='')
		print('')


t = int(input())
while t > 0:
	n = int(input())
	c3 = int(n / 3)
	r3 = n % 3
	c2 = int(n / 2)
	r2 = n % 2
	if r3 == 1:
		c3 = c3 - 1
		s1 = '7' * c3 + '1' * 2
	elif r3 == 2:
		s1 = '7' * c3 + '1'
	elif r3 == 0:
		s1 = '7' * c3
	if r2 == 1:
		c2 = c2 - 1
		s2 = '7' + '1' * c2
	elif r2 == 0:
		s2 = '1' * c2
	zx = int(s1)
	cx = int(s2)
	if zx <= cx:
		print(cx)
	else:
		print(zx)
	t = t - 1


import sys
t = int(input())
while t > 0:
	n = int(input())
	ones = int(n / 2)
	if n % 2 == 1:
		sys.stdout.write('7')
		ones -= 1
	while ones > 0:
		sys.stdout.write('1')
		ones -= 1
	print()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	while n > 0:
		if n % 2 == 0:
			arr.append(1)
			n = n - 2
		else:
			arr.append(7)
			n = n - 3
	for i in range(len(arr)):
		print(arr[i], end='')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	lst = [6, 2, 5, 4, 5, 6, 3, 7, 6]
	s = ''
	if n % 2 == 0:
		s = '1' * (n // 2)
	else:
		s += '7'
		s += '1' * (n // 2 - 1)
	print(int(s))


for a0 in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	elif n % 2 == 0:
		print(n // 2 * '1')
	else:
		print('7' + (n - 3) // 2 * '1')


def join(num_seq):
	finalStr = ''
	for i in num_seq:
		finalStr = finalStr + str(i)
	return finalStr
testCount = int(input())
res = []
for test in range(testCount):
	num_seq = []
	budget = int(input())
	while budget > 0:
		if budget > 3:
			num_seq.append(1)
			budget -= 2
		elif budget == 3:
			num_seq.append(7)
			budget -= 3
		elif budget == 2:
			num_seq.append(1)
			budget -= 2
	num_seq.sort(reverse=True)
	res.append(join(num_seq))
for result in res:
	print(result)


from math import *
from bisect import *
t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	if n % 2 == 0:
		print('1' * k)
	else:
		print('7' + (k - 1) * '1')


def real_input():
	t = int(input())
	N = [0] * t
	for i in range(t):
		N[i] = int(input())
	return N

def real_inpu1():
	N = [int(n) for n in input().split()]
	return N[1:]

def ex1295a(N):
	out = [0] * len(N)
	for i in range(len(N)):
		out[i] = str(max_display(N[i]))
	print('\n'.join(out))

def max_display(n):
	if n % 2 == 0:
		return int('1' * (n // 2))
	return int('7' + '1' * (n // 2 - 1))
N = real_input()
ex1295a(N)


def main():
	t = int(input())
	List = list()
	for i in range(t):
		List.append(int(input()))
	for item in List:
		answer = list()
		q = 0
		while True:
			if item == 0:
				break
			elif item == 3:
				answer.insert(0, '7')
				break
			else:
				answer.insert(0, '1')
				item -= 2
		print(''.join(answer))
main()


numbers = {2: [1], 5: [2, 3, 5], 4: [4], 6: [0, 6, 9], 3: [7], 7: [8]}
a = int(input())
b = []
for i in range(a):
	b.append(int(input()))
for i in range(a):
	cher = ''
	if b[i] > 3:
		if b[i] % 2 == 0:
			for i in range(b[i] // 2):
				cher += '1'
		else:
			cher += '7'
			for i in range((b[i] - 3) // 2):
				cher += '1'
	else:
		cher = str(max(numbers[b[i]]))
	print(int(cher))


t = int(input())
while t > 0:
	n = int(input())
	dv = n // 2
	if 2 * dv < n:
		print(7, end='')
		dv -= 1
	for i in range(0, dv):
		print(1, end='')
	print()
	t -= 1


for t in range(int(input())):
	segments = int(input())
	number = ''
	if segments % 2:
		number += '7'
		segments -= 3
	while segments > 0:
		number += '1'
		segments -= 2
	print(number)


t = int(input())
d = {1: 0, 2: 1, 3: 7, 4: 4, 5: 5}
for _ in range(t):
	n = int(input())
	x = n % 4
	m = n // 4
	s = ''
	while m:
		s += '11'
		m -= 1
	if x == 1:
		s = s[1:]
		s = '7' + s
	elif x == 2:
		s += '1'
	elif x == 3:
		s = '7' + s
	for i in s:
		print(i, end='')
	print()


for n in [*open(0)][1:]:
	print('17'[int(n) % 2] + '1' * (int(n) // 2 - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 3:
		print(7)
	elif n % 2 == 0:
		a = '1' * (n // 2)
		print(int(a))
	else:
		a = '7' + '1' * ((n - 3) // 2)
		print(int(a))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
for _ in range(ii()):
	n = ii()
	r = ['1'] * (n // 2)
	if n % 2:
		r[0] = '7'
	prr(r, '')


for _ in range(int(input())):
	x = int(input())
	if x == 3:
		print(7)
	elif x % 2 == 0:
		print('1' * int(x // 2))
	else:
		print('7' + '1' * int(x // 2 - 1))


cases = int(input())
for c in range(0, cases):
	seg = int(input())
	current = []
	if seg == 2:
		print(1)
		continue
	if seg == 3:
		print(7)
		continue
	if seg % 2 == 0:
		current = ['1' for x in range(0, seg // 2)]
	else:
		current = ['7']
		current = current + ['1' for x in range(0, (seg - 3) // 2)]
	ans = ''.join(current)
	print(ans)


for x in range(int(input())):
	num = int(input())
	print('7' + '1' * ((num - 3) // 2) if num % 2 else '1' * (num // 2))


N = int(input())
for _ in range(N):
	num = int(input())
	if num % 2 == 1:
		print('7', end='')
	else:
		print('1', end='')
	num //= 2
	for _ in range(num - 1):
		print('1', end='')
	print()


t = int(input())
segments = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for case in range(t):
	n = int(input())
	numOnes = n // 2 - 1
	numArr = ['1' for i in range(numOnes)]
	if n % 2 == 1:
		numArr.insert(0, '7')
	else:
		numArr.insert(0, '1')
	print(''.join(numArr))


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		n -= 3
		print('7' + '1' * (n // 2))
t = int(input())
for _ in range(t):
	main()


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(str(1) * (n // 2))
	else:
		a = n - 3
		print(str(7) + str(1) * (a // 2))


def solve(n):
	digits = ['1'] * (n // 2)
	if n % 2 != 0:
		digits[0] = '7'
	return ''.join(digits)
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


def solve():
	num = []
	n = int(input())
	while n > 3:
		num.append('1')
		n -= 2
	num.append('1')
	n -= 2
	if n:
		num[0] = '7'
	print(''.join(num))
t = int(input())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		keta1 = N // 2
		N -= keta1 * 2
		keta7 = N
		keta1 -= keta7
		print('7' * keta7 + '1' * keta1)
main()


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		s = '7' + '1' * ((n - 3) // 2)
		print(s)


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	n = Read.int()
	m = 998244353
	t = math.floor(n / 2)
	g = n - t * 2
	res = ''
	for i in range(t):
		if g >= 4:
			res += '9'
			g -= 4
		elif g >= 1:
			res += '7'
			g -= 1
		else:
			res += '1'
	print(res)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


testcase = int(input())
i = 0
t = []
r = []
while i < testcase:
	a = int(input())
	t.append(a)
	i += 1
i = 0
while i < testcase:
	if t[i] % 2 == 0:
		y = 0
		b = ''
		while y < t[i] / 2:
			b += '1'
			y += 1
		r.append(b)
	else:
		y = 0
		b = '7'
		while y < int(t[i] / 2) - 1:
			b += '1'
			y += 1
		r.append(b)
	i += 1
i = 0
while i < testcase:
	print(r[i])
	i += 1


def f(n):
	if n == 2:
		print(1)
		return
	if n == 1:
		print(-1)
		return
	if n == 3:
		print(7)
		return
	if n % 2 == 0:
		print(str(1) * (n // 2))
		return
	if n % 2 == 1:
		print('7' + str(1) * (n // 2 - 1))
		return
t = int(input())
while t > 0:
	t -= 1
	f(int(input()))


n = int(input())
for i in range(n):
	M = int(input())
	if M == 3:
		print(7)
		continue
	elif M == 2:
		print(1)
		continue
	elif M % 2 == 0:
		print('1' * (M // 2))
	else:
		print('7' + '1' * ((M - 3) // 2))


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	if n % 2 == 0:
		ans = '1' * m
	else:
		ans = '1' * (m - 1)
		ans = '7' + ans
	print(ans)


t = int(input())
st = str
for i in range(t):
	temp = int(input())
	st = (temp // 2 - 1) * '1'
	if temp % 2 + 2 == 2:
		print(st + '1')
	else:
		print('7' + st)
	st = ''


inp = int(input())
for i in range(0, inp):
	ip = int(input())
	if ip % 2 == 1:
		ip -= 1
		ip //= 2
		ip -= 1
		print('7', end='')
		print('1' * ip)
	else:
		ip //= 2
		print('1' * ip)


f = int(input())
nums = []
for i in range(f):
	nums.append(int(input()))
numbers = [[0, 6], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]

def getMaxNum(fragments):
	number = [1] * (fragments // 2)
	fragments -= fragments // 2 * 2
	if fragments > 0:
		for i in reversed(numbers):
			if i[0] > 1 and 2 + fragments >= i[1]:
				number[0] = i[0]
	return ''.join(map(str, number))
for i in nums:
	print(getMaxNum(i))


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		s = ''
		if n % 2 == 1:
			s += '7'
			n -= 3
		else:
			s += '1'
			n -= 2
		while n > 0:
			n -= 2
			s += '1'
		print(s)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


p = int(input())
while p > 0:
	p -= 1
	ls = list()
	n = int(input())
	if n % 2 == 1:
		ls.append('7')
		n -= 3
	while n > 0:
		ls.append('1')
		n -= 2
	print(''.join([str(x) for x in ls]))


n = int(input())
slo = [-1, -1, 1, 7, 4, 5, 9, 8]
for rwre in range(n):
	s = int(input())
	if s % 2 == 0:
		print('1' * (s // 2))
	else:
		print('7' + '1' * ((s - 3) // 2))


t = int(input())
for i in range(t):
	n = int(input())
	count = ''
	while n > 0:
		if n % 2 != 0:
			count += '7'
			n -= 3
		else:
			count += '1'
			n -= 2
	print(int(count))


t = int(input())
dicc = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
f = []
for i in range(10):
	f.append([dicc[i], i])
f.sort()
for _ in range(t):
	n = int(input())
	m = n // 2
	rem = n - m * 2
	ans = 0
	l = []
	for i in range(m):
		l.append(1)
	if rem % 4 == 0:
		v = rem // 4
		for i in range(v):
			l[i] = 9
	else:
		v = rem // 4
		rem1 = rem - v
		for i in range(v):
			l[i] = 9
		if rem1 == 3:
			if len(l) > v:
				l[v] = 7
		if rem1 == 2 or rem1 == 1:
			if len(l) > v:
				l[v] = 7
	s = ''
	for i in l:
		s += str(i)
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	(s, v) = divmod(n, 2)
	f = 0
	if v == 1:
		s -= 1
		f = 1
	m = '7' * f + '1' * s
	print(m)


for i in range(int(input())):
	(a, l) = (0, [])
	n = int(input())
	if n % 2 == 0:
		a = int(n / 2)
		l = [1] * a
	else:
		a = int(n / 2)
		l = [1] * a
		l[0] = 7
	r = ''.join(map(str, l))
	r = int(r)
	print(r)


import sys
from collections import defaultdict, Counter

def main():
	for _ in range(int(input())):
		N = int(input())
		for i in range(N % 2):
			print('7', end='')
		for i in range((N - 3 * (N % 2)) // 2):
			print('1', end='')
		print()
main()


import math

def main():
	t = int(input())
	for _ in range(t):
		print(case())

def case():
	n = int(input())
	d = {2: '1', 3: '7', 8: '9'}
	if n == 2:
		return '1'
	if n == 3:
		return '7'
	if n % 2:
		return '7' + '1' * (n // 2 - 1)
	else:
		return '1' * (n // 2)
main()


t = int(input())
while t != 0:
	a = int(input())
	b = a // 2
	e = [1] * b
	if a % 2 != 0:
		e[0] = 7
	x = ''
	for i in range(len(e)):
		x = x + str(e[i])
	print(x)
	t = t - 1


from math import ceil, sqrt, floor
for i in range(int(input())):
	q = int(input())
	if q % 2:
		print(7, end='')
		q -= 3
	print('1' * (q // 2))


n = int(input())
for _ in range(n):
	ceg = int(input())
	s = ''
	if ceg == 2:
		s = '1'
	elif ceg % 2 == 1:
		ceg -= 3
		s += '7'
		while ceg > 0:
			ceg -= 2
			s += '1'
	else:
		s += '1' * (ceg // 2)
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = ''
	if n & 1:
		ans = ans + '7'
		n = n - 3
	ans = ans + str('1' * (n // 2))
	print(ans)


from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction
d = {1: 2, 7: 3, 9: 6, 8: 7, 4: 4, 3: 5, 5: 5, 6: 6, 0: 4, 2: 5}
maxat = list(map(int, list(str(998244353))))
t = int(stdin.readline())
for _ in range(t):
	n = int(input())
	if n % 2:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 6 == 5:
		print(71, end='')
		for i in range(n // 6):
			print(111, end='')
		print()
	elif n % 6 == 4:
		print(11, end='')
		for i in range(n // 6):
			print(111, end='')
		print()
	elif n % 6 == 3:
		print(7, end='')
		for i in range(n // 6):
			print(111, end='')
		print()
	elif n % 6 == 2:
		print(1, end='')
		for i in range(n // 6):
			print(111, end='')
		print()
	elif n % 6 == 1:
		print(711, end='')
		for i in range(n // 6 - 1):
			print(111, end='')
		print()
	else:
		for i in range(n // 6):
			print(111, end='')
		print()


t = int(input())
while t > 0:
	v = int(input())
	if v % 2 == 0:
		print('1' * (v // 2))
	elif v == 3:
		print('7')
	else:
		print('7' + '1' * ((v - 3) // 2))
	t -= 1


t = int(input())
d = {2: 1, 3: 7}
for _ in range(t):
	n = int(input())
	if n in d:
		print(d[n])
	else:
		if n % 2 == 0:
			k = '1' * (n // 2)
		else:
			k = '7' + '1' * (n // 2 - 1)
		print(k)


T = int(input())
for kase in range(T):
	n = int(input())
	if n & 1:
		print('7' + (n - 3) // 2 * '1')
	else:
		print(n // 2 * '1')


import sys
t = int(input())
figures = [6, 10000, 5, 5, 4, 5, 6, 3, 7, 6]
g = sys.stdin.readlines()
for i in range(t):
	n = int(g[i])
	l = n // 2
	answer = []
	n %= 2
	j = 0
	for i in range(8, -1, -1):
		k = n // (figures[i] - 2)
		answer.extend([i] * k)
		n %= figures[i] - 2
		j += k
	answer.extend([1] * (l - len(answer)))
	print(*answer, sep='')


for TC in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
	elif n % 2 == 0:
		print(int('1' * (n // 2)))
	elif n == 3:
		print(7)
	else:
		result = '7'
		n -= 3
		while n > 0:
			result += '1'
			n -= 2
		print(int(result))


x = int(input())
cont = 0
while x > cont:
	r = []
	s = int(input())
	l = int(s / 2)
	if s % 2 == 0:
		for i in range(l):
			r.append('1')
	else:
		for i in range(l - 1):
			r.append('1')
		r.append('7')
	r.sort(reverse=True)
	print(''.join(r))
	cont += 1


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print(str(7) + '1' * ((n - 3) // 2))


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for i in range(int(input())):
	n = int(input())
	ans = ['1', '7'][n % 2] + '1' * ((n - 2) // 2)
	print(ans)


I = input
for _ in [0] * int(I()):
	num = int(I())
	if num % 2 == 1:
		print(7, end='')
		print((num // 2 - 1) * '1')
		continue
	elif num % 2 == 0:
		print(num // 2 * '1')
		continue


for case in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2)
		print(ans)
	else:
		print('7' + '1' * ((n - 3) // 2))


import math
for _ in range(int(input())):
	n = int(input())
	if n == 3:
		print(7)
	elif n % 2 == 1:
		print('7' + (n - 3) // 2 * '1')
	else:
		print(n // 2 * '1')


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		m = n // 2
		print('1' * m)
	else:
		z = n - 3
		k = z // 2
		print('7' + '1' * k)


k = int(input())
for j in range(k):
	n = int(input())
	m = int(n / 2)
	l = []
	for i in range(m):
		l.append('1')
	if n % 2 == 1:
		l[0] = '7'
	print(''.join(l))


for _ in range(int(input())):
	(x, y) = divmod(int(input()), 2)
	print(y * '7' + (x - y) * '1')


n = int(input())
while n:
	s = int(input())
	digits = int(s / 2)
	seven = s % 2
	c_out = ''
	if seven:
		c_out += '7'
		digits -= 1
	c_out += digits * '1'
	print(c_out)
	n -= 1


for _ in range(int(input())):
	n = int(input())
	segments = n // 2
	extra = 0
	if n % 2 == 1:
		segments -= 1
		extra += 1
	print('7' * extra + '1' * segments)


vec = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
test_cases = int(input())
for i in range(test_cases):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7{}'.format('1' * (n // 2 - 1)))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		z = n // 2
		x = int('1' * z)
		print(x)
	else:
		z = n // 2
		z = z - 1
		x = int('7' + '1' * z)
		print(x)


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	ln = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	out = '1' * (n // 2)
	n %= 2
	out = list(str(out))
	if n:
		out[0] = '7'
	print(''.join(out))


for _ in range(int(input())):
	n = int(input())
	segments = [2, 5, 5, 4, 5, 6, 3, 7, 6]
	print('7' * (n % 2) + '1' * (n // 2 - n % 2))


t = int(input())
while t:
	q = int(input())
	if q % 2 == 0:
		print('1' * int(q / 2))
	else:
		print('7' + '1' * int((q - 3) / 2))
	t = t - 1


n = int(input())
for i in range(n):
	x = int(input())
	one = x // 2
	if x % 2 != 0:
		one -= 1
		print(7, end='')
	for j in range(one):
		print(1, end='')
	print()


def main():
	n = int(input())
	if n % 2 == 0:
		res = '1' * (n // 2)
		print(res)
	else:
		n -= 3
		res = '7'
		res += '1' * (n // 2)
		print(res)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


N = int(input())
for i in range(N):
	tmp = int(input())
	if tmp % 2 == 0:
		print('1' * (tmp // 2))
	else:
		print('7' + '1' * (tmp // 2 - 1))


def calculate_max_no_by_equation(max_segements: int):
	sevens = max_segements % 2
	ones = int(max_segements / 2) - sevens
	if ones >= 0:
		return sevens * '7' + ones * '1'
	else:
		return 0
no_of_tcs = int(input())
for _ in range(no_of_tcs):
	max_segements = int(input())
	print(calculate_max_no_by_equation(max_segements=max_segements))


def func():
	n = int(input())
	for _ in range(n):
		num = int(input())
		if num % 2 == 0:
			print('1' * (num // 2))
		else:
			print('7' + '1' * (num // 2 - 1))
func()


for t in range(int(input())):
	n = int(input())
	ones = n // 2
	rem = n % 2
	res = ones * '1'
	if rem == 1:
		res = '7' + (ones - 1) * '1'
	print(res)


import sys
queries = int(sys.stdin.readline())
for query in range(queries):
	segments = int(sys.stdin.readline())
	segmentsMax = {2: '1', 3: '7', 4: '4', 5: '5', 6: '9', 7: '8'}
	if segments % 2 == 1:
		print('7', end='')
	print('1' * (segments // 2 - segments % 2))


for i in range(int(input())):
	n = int(input())
	ans = 0
	while n:
		if n % 2 == 1:
			ans = ans * 10 + 7
			n -= 3
		else:
			ans = ans * 10 + 1
			n -= 2
	print(ans)


t = int(input(''))
for i in range(t):
	n = int(input(''))
	if n == 1:
		print(0)
		continue
	ans = ''
	a = n // 2
	b = n % 2
	if b == 1:
		ans = '7'
	else:
		ans = '1'
	ans += '1' * (a - 1)
	print(ans)


t = int(input())
answer = []
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2)
		answer.append(int(ans))
	else:
		ans = '7' + '1' * (n // 2 - 1)
		answer.append(int(ans))
for x in answer:
	print(x)


s = '1'

def fun(n):
	if n % 2 == 0:
		print(s * int(n / 2))
	else:
		print('7' + s * int((n - 3) / 2))
n = int(input())
for i in range(0, n):
	m = int(input())
	fun(m)


test = int(input())
for t in range(test):
	n = int(input())
	if n % 2 == 0:
		print('1', end='')
	else:
		print('7', end='')
	for i in range(n // 2 - 1):
		print('1', end='')
	print()


num = int(input())
out = []
for i in range(num):
	n = int(input())
	s = ''
	while True:
		if n - 2 >= 2:
			n -= 2
			s += '1'
		elif n == 3:
			n -= 3
			s = '7' + s
		elif n == 2:
			n -= 2
			s += '1'
		if n == 0:
			break
	out.append(s)
for line in out:
	print(line)


for s in [*open(0)][1:]:
	n = int(s)
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


dic = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
for i in range(int(input())):
	n = int(input())
	string = ''
	if n % 2 == 0:
		temp = n // 2
		print('1' * temp)
	else:
		temp = n - 3
		string += '7'
		temp = temp // 2
		string += '1' * temp
		print(string)


t = int(input())
digits = {9: 6, 8: 7, 7: 3, 6: 6, 5: 5, 4: 4, 3: 7, 2: 5, 1: 2, 0: 6}
displays = 998244353
answers = []
for ti in range(t):
	n = int(input())
	ones = n // 2
	remaining = n % 2
	sevens = 0
	if remaining == 1:
		ones -= 1
		sevens = 1
	ans = ''
	if sevens == 1:
		ans += '7'
	for i in range(ones):
		ans += '1'
	answers.append(ans)
for a in answers:
	print(a)


t = int(input())
for _ in range(t):
	segments = int(input())
	if segments < 2:
		print('1')
	else:
		rem = segments % 2
		if rem:
			total_ones = segments - 3
			total = '7' + '1' * (total_ones // 2)
			print(total)
		else:
			ones = '1' * (segments // 2)
			print(ones)


N = int(input())
for _ in range(N):
	x = int(input())
	if x % 2 == 1:
		print('7' + '1' * ((x - 1) // 2 - 1))
	else:
		print('1' * (x // 2))


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 3:
		print(7)
		continue
	if n % 2 == 0:
		k = int(n / 2)
		for i in range(0, k):
			print(1, end='')
		print(end='\n')
	else:
		print(7, end='')
		k = int((n - 1) / 2)
		for i in range(0, k - 1):
			print(1, end='')
		print(end='\n')


from math import *
from math import factorial as fact, comb as ncr
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import S, search
li = lambda : list(map(int, input().split()))
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def notprime(a):
	if a == 2:
		return False
	elif a % 2 == 0:
		return True
	n = 3
	while n <= a ** 0.5:
		if a % n == 0:
			return True
		n += 2
	return False

def solve():
	for _ in range(int(input())):
		n = int(input())
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * ((n - 3) // 2))
solve()


t = int(input())
for aaa in range(t):
	n = int(input())
	if n & 1 == 0:
		m = int('1' * (n // 2))
	else:
		n -= 3
		m = int('7' + '1' * (n // 2))
	print(m)


def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		N = int(input())
		ans = [1] * (N // 2)
		if N & 1:
			ans[0] = 7
		print(''.join(map(str, ans)))
main()


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	cur = int(stdin.readline())
	if cur == 3:
		print(7)
	elif cur == 4:
		print(11)
	elif cur >= 5:
		fst = int('7' + '1' * ((cur - 3) // 2))
		snd = int('1' * (cur // 2))
		print(max(fst, snd))
	elif cur == 2:
		print(1)


from math import *
zzz = int(input())
for zz in range(zzz):
	n = int(input())
	t = (n + 1) // 2
	ans = ''
	for i in range(t):
		ans += '1'
	if n % 2 == 0:
		print(ans)
	else:
		print('7' + ans[2:])


d = {9: 6, 8: 7, 7: 3, 6: 6, 5: 5, 4: 4, 3: 5, 2: 5, 1: 2, 0: 6}
d1 = {2: [1], 3: [7], 4: [4], 5: [2, 3, 5], 6: [0, 6, 9], 7: [8]}
for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		q = n // 2
		q -= 1
		g = '7'
		for i in range(q):
			g += '1'
	else:
		g = ''
		for i in range(n // 2):
			g += '1'
	print(g)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		rt = n // 2
		string = str(1)
		for i in range(rt - 1):
			string = string + str(1)
		print(string)
	else:
		rt = n // 2 - 1
		string = str(7)
		for i in range(rt):
			string = string + str(1)
		print(string)


from collections import defaultdict
rec = defaultdict(int)
rec[2] = 1
rec[3] = 7
rec[4] = 4
rec[5] = 5
rec[6] = 9
rec[7] = 8
for _ in range(int(input())):
	n = int(input())
	no = n // 2
	n = n - 2 * (n // 2)
	if n < 2:
		no -= 1
		n += 2
	print(str(rec[n]) + '1' * no)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	d = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
	arr = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n % 2 == 0:
		for i in range(0, n // 2):
			print(1, end='')
		print()
	else:
		v = n // 2 - 1
		print(7, end='')
		for i in range(0, v):
			print(1, end='')
		print()


for _ in range(int(input())):
	n = int(input())
	ans = ''
	if n >= 3 and n % 2 != 0:
		ans += '7'
		n -= 3
	ans += '1' * (n // 2)
	print(ans)


def findMax(s, n):
	c = [-1 for i in range(n + 1)]
	c[0] = 0
	pos = [-1 for i in range(n + 1)]
	num = [-1 for i in range(n + 1)]
	for i in range(1, n + 1):
		for j in range(len(s)):
			if s[j] <= i:
				t = c[i - s[j]]
				if t != -1 and t + 1 > c[i]:
					c[i] = t + 1
					pos[i] = i - s[j]
					num[i] = j
	res = ''
	i = n
	while pos[i] != -1:
		res = str(num[i]) + res
		i = pos[i]
	print(res)
T = int(input())
s = [6, 2, 5, 5, 4, 5, 6, 3, 7, 5]
for t in range(T):
	n = int(input())
	findMax(s, n)


a = int(input())
for i in range(0, a):
	b = int(input())
	if b % 2 != 0:
		b -= 3
		print('7', end='')
	while b > 0:
		print('1', end='')
		b -= 2
	print('')


d = {2: '1', 3: '7', 4: '4', 5: '5', 6: '9', 7: '8'}

def find_num(x):
	if x < 4:
		return d[x]
	if x % 2 == 1:
		return '7' + '1' * ((x - 3) // 2)
	return '1' * (x // 2)
for _ in range(int(input())):
	x = int(input())
	print(find_num(x))


for x in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		print('1' * (a // 2))
	else:
		print('7' + '1' * (a // 2 - 1))


def main():

	def solve():
		n = int(input())
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * (n // 2 - 1))
	q = int(input())
	for _ in range(q):
		solve()
main()


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
digit = {2: '1', 3: '7'}
ans = []
for i in l:
	if i % 2 == 0:
		val = i // 2
		temp = ['1'] * val
		a = ''.join(temp)
	else:
		val = i // 2 - 1
		temp = ['1'] * val
		temp.insert(0, str(7))
		a = ''.join(temp)
	ans.append(a)
for i in ans:
	print(i)


num = [0, 2, 5, 5, 4, 5, 5, 3, 7, 6]
T = int(input())
for i in range(T):
	N = int(input())
	string = ''
	if N == 3:
		print(7)
	else:
		while N >= 2:
			if N >= 4:
				N -= 2
				string = str(1) + string
			elif N >= 3:
				string = str(7) + string
				N -= 3
			else:
				string = str(1) + string
				N -= 2
		print(string)


def solve(n):
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	for _ in range(n // 2):
		print(1, end='')
	print()
for _ in range(int(input())):
	solve(int(input()))


for x in range(int(input())):
	temp = int(input())
	res = []
	if temp % 2 == 1:
		res.append(7)
		temp -= 3
	while temp:
		res.append(1)
		temp -= 2
	res = (str(val) for val in res)
	print(''.join(res))


t = int(input())
while t:
	n = int(input())
	o = '1' * (n // 2)
	if n % 2:
		o = '7' + o[1:]
	print(o)
	t -= 1


def calculate(n):
	if n % 2 == 0:
		print(n // 2 * '1')
	else:
		three = 1
		n = n - 3
		ans = '7'
		print(ans + n // 2 * '1')
for i in range(int(input())):
	n = int(input())
	calculate(n)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
t = rint()
for _ in range(t):
	n = rint()
	print('7' if n % 2 == 1 else '1', end='')
	n -= 2
	for i in range(n // 2):
		print('1', end='')
	print()


t = int(input())
digs = {3: 7, 5: 5, 7: 9}
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		n = n - 3
		print('7' + '1' * (n // 2))


for i in range(int(input())):
	n = int(input())
	if n == 3:
		print(7)
	else:
		c = []
		if n % 2 == 0:
			b = n // 2
			for i in range(b):
				c.append(1)
		else:
			b = n
			b = b - 3
			for i in range(b // 2):
				c.append(1)
			c.insert(0, 7)
		c = ''.join(map(str, c))
		print(c)


def solve():
	for _ in range(ii()):
		n = ii()
		if n % 2 == 0:
			print(int('1' * (n // 2)))
		elif n == 3:
			print(7)
		else:
			print(int('7' + '1' * ((n - 3) // 2)))
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
solve()


def line():
	return map(int, input().split())

def num():
	return int(input())
from itertools import repeat
t = num()
for _ in repeat(None, t):
	n = num()
	if not n % 2:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


t = int(input())
for i in range(t):
	n = int(input())
	k = n % 2
	n = n - 2 * k
	print('7' * k, '1' * (n // 2), sep='')


for _ in ' ' * int(input()):
	a = int(input())
	print('1' * (a // 2) if a % 2 == 0 else '7' + '1' * ((a - 3) // 2))


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
from math import *
a = [[2, '1'], [3, '7'], [4, '4'], [5, '5'], [6, '9'], [7, '8']]
for i in range(int(input())):
	n = int(input())
	if n == 3:
		print(7)
	elif n == 2:
		print(1)
	elif n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


testcases = int(input())
for t in range(testcases):
	x = int(input())
	if x % 2 == 0:
		ans = '1' * int(x // 2)
	else:
		y = x - 3
		ans = '1' * int(y // 2)
		if x == 3:
			ans = 7
		else:
			ans = '7' + ans
	print(int(ans))


n = int(input())
for i in range(n):
	s = int(input())
	ans = ''
	if s % 2 == 0:
		ans += '1' * (s // 2)
	else:
		ans += '7' + '1' * (s // 2 - 1)
	print(ans)


t = int(input())
for test in range(t):
	n = int(input())
	s = ''
	if n % 2 == 0:
		l = n // 2
		res = ''
		for i in range(l):
			res += '1'
		print(res)
	else:
		l = n // 2
		res = ''
		for i in range(l - 1):
			res += '1'
		res = '7' + res
		print(res)


for _ in range(int(input())):
	n = int(input())
	x = n / 2
	if x <= 998244353 and n % 2 == 0:
		print('1' * int(x))
	elif x <= 998244353 and n % 2 == 1:
		print('7' + '1' * (int(x) - 1))
	else:
		p = int(2 * (x - 998244353))
		new = ''
		m = True
		cnt = 0
		while m == True:
			if p - 4 >= 0:
				new += '9'
				p -= 4
			else:
				new += '7'
				p -= 1
			cnt += 1
			if cnt == 998244353 or p == 0:
				m = False
		new += (998244353 - cnt) * '1'
		print(new)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	print(''.join(('1' for _ in range(n // 2))))


t = int(input())
for T in range(t):
	n = int(input())
	s = []
	if n % 2 == 1:
		s.append(7)
		n -= 3
	while n % 2 == 0 and n > 0:
		s.append(1)
		n -= 2
	print(str(s)[1:-1].replace(', ', ''))


import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log, ceil
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
inf = float('inf')
mod = 10 ** 9 + 7

def pprint(*A):
	for a in A:
		print(*a, sep='\n')

def INT_(n):
	return int(n) - 1

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def MI_():
	return map(INT_, input().split())

def LI():
	return list(MI())

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return list(MF())

def LIN(n: int):
	return [I() for _ in range(n)]

def LLIN(n: int):
	return [LI() for _ in range(n)]

def LLIN_(n: int):
	return [LI_() for _ in range(n)]

def LLI():
	return [list(map(int, l.split())) for l in input()]

def I():
	return int(input())

def F():
	return float(input())

def ST():
	return input().replace('\n', '')

def main():
	t = I()
	d = {'9': 6, '8': 7, '2': 5, '4': 4, '3': 5, '5': 5}
	for _ in range(t):
		N = I()
		ans = '1' * (N // 2)
		if N & 1:
			ans = '7' + ans[1:]
		print(ans)
main()


tests = int(input())
i = 0
while i < tests:
	n = int(input())
	if n == 3:
		print('7')
	elif n % 2 == 0:
		print(n // 2 * '1')
	else:
		res = '7' + str((n - 3) // 2 * '1')
		print(res)
	i += 1


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
for _ in range(I()):
	n = I()
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


t = int(input())
while t:
	n = int(input())
	mm = 0
	if n >= 2:
		if n % 2 == 0:
			k = int(n // 2)
			mm = '1' * k
			mm = int(mm)
		elif n % 2 == 1:
			k = int(n // 2)
			k = k - 1
			mm = '7' + '1' * k
			mm = int(mm)
	print(mm)
	t -= 1


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
segs = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

def build():
	global dp
	global segs
	my = [None] * 8
	for i in range(10):
		my[segs[i]] = i
	my1 = [None] * 10
	for i in range(2, 8):
		my1[my[i]] = i
	print(my)
	print(my1)
	dp = [(-1000000000.0, 0)] * int(100000.0 + 1)
	dp[0] = (0, 0)
	for i in range(2, int(100000.0) + 1):
		d = (-int(1000000000.0), 0)
		for j in range(9, 0, -1):
			s = my1[j]
			if s == None:
				continue
			if i - s >= 0:
				d = max(d, (dp[i - s][0] + 1, j))
		dp[i] = d

def solve():
	n = mint()
	if n % 2 == 1:
		print(7, end='')
	else:
		print(1, end='')
	print('1' * (n // 2 - 1))
for i in range(mint()):
	solve()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		k = n // 2
		print('1' * k)
	else:
		k = (n - 3) // 2
		print('7', '1' * k, sep='')


t = int(input())
for _ in range(t):
	str = ''
	n = int(input())
	if n % 2 != 0:
		n = n - 3
		str += '7'
	for i in range(0, n // 2):
		str += '1'
	print(str)


t = int(input())
for i in range(t):
	am = int(input())
	if am % 2:
		print(7, end='')
		for i in range(am // 2 - 1):
			print(1, end='')
		print()
	else:
		for i in range(am // 2):
			print(1, end='')
		print()


for _ in range(int(input())):
	n = int(input())
	f = []
	j = ''
	if n % 2 == 0:
		j += n // 2 * '1'
	else:
		j += '7'
		j += (n - 3) // 2 * '1'
	print(j)


try:

	def printMaxNumber(n):
		if n % 2 == 1:
			print('7', end='')
			for i in range(int((n - 3) / 2)):
				print('1', end='')
		else:
			for i in range(n // 2):
				print('1', end='')
	t = int(input())
	for i in range(t):
		n = int(input())
		printMaxNumber(n)
		print()
except Exception as e:
	pass


d = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
for _ in range(t):
	ans = []
	n = int(input())
	while n > 0:
		if n >= 2:
			ans.append(1)
			n -= 2
		else:
			break
	if n == 1:
		ans[-1] = 7
	(*ans,) = map(str, ans)
	print(''.join(ans[-1::-1]))


d = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
for _ in range(int(input())):
	s = ''
	n = int(input())
	while True:
		if n > 3:
			s += '1'
			n -= 2
		else:
			s = str(d[n]) + s
			break
	print(s)


n = int(input())
for i in range(n):
	a = int(input())
	b = a % 2
	c = int((a - 3 * b) / 2)
	print('7' * b + '1' * c)


t = int(input())
ans = []
mega = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
electro = [[6, 9], [7, 8], [3, 7], [5, 5], [4, 4], [2, 1]]
electro_ind = [1, 7, 4, 5, 9, 8]
limit = '998244353'
limit_s = '667544555'
limit_int = 998244353
for i in range(t):
	n = int(input())
	f = n // 2
	n = n - f * 2
	num = []
	for j in range(f):
		num.append(2)
	for j in range(f):
		for k in electro:
			if k[0] - 2 <= n:
				num[j] = k[0]
				n -= k[0] - 2
				break
	num_a = ''
	for j in num:
		num_a += str(electro_ind[j - 2])
	ans.append(num_a)
for i in ans:
	print(i)


n = int(input())
for i in range(n):
	num = int(input())
	if num % 2 == 0:
		temp = num // 2
		for i in range(0, temp):
			print(1, end='')
		print()
	elif num % 2 == 1:
		temp = num // 2
		print(7, end='')
		for i in range(0, temp - 1):
			print(1, end='')
		print()


n = int(input())
for i in range(n):
	k = int(input())
	if k % 2 == 1:
		print(7, end='')
		k -= 3
	while k > 1:
		print(1, end='')
		k -= 2
	print()


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	else:
		ans1 = str(1) * (n // 2)
		x = n - 3
		ans2 = str(7) + str(1) * (x // 2)
		if len(ans1) == len(ans2):
			print(ans2)
		else:
			print(ans1)


for _ in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		for i in range(0, a // 2):
			print(1, end='')
	else:
		print(7, end='')
		for i in range(0, (a - 3) // 2):
			print(1, end='')
	print()


q = int(input())
for _ in range(q):
	segments = int(input())
	if segments % 2 == 1:
		top_value = str(7) + '1' * ((segments - 3) // 2)
	if segments % 2 == 0:
		top_value = '1' * (segments // 2)
	print(top_value)


for _ in range(int(input())):
	n = int(input())
	d = {2: 1, 4: 4, 5: 5, 3: 7, 7: 8, 6: 9}
	if n < 4:
		print(d[n])
	elif n % 2 == 0:
		print(int('1' * int(n / 2)))
	else:
		s = '7' + '1' * int((n - 3) / 2)
		print(int(s))


for n in [*open(0)][1:]:
	n = int(n) - 1
	print('71'[n % 2] + '1' * (n - 1 >> 1))


import sys
from os import path
if path.exists('input.txt') and path.exists('output.txt'):
	sys.stdout = open('output.txt', 'w')
	sys.stdin = open('input.txt', 'r')

def main():
	T = int(input())
	for ii in range(T):
		n = int(input())
		if n % 2 == 0:
			for i in range(n // 2):
				print(1, end='')
			print()
		else:
			print(7, end='')
			for i in range(n // 2 - 1):
				print(1, end='')
			print()
main()


import sys

def main():
	line1 = sys.stdin.readline()
	t = int(line1)
	for line in sys.stdin:
		n = int(line)
		if n % 2 == 1:
			res = '7' + '1' * int((n - 3) / 2)
		else:
			res = '1' * int(n / 2)
		print(res)
main()


def main():
	arr = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 != 0:
			ans = '7'
			ans += '1' * ((n - 2) // 2)
		else:
			ans = '1' * (n // 2)
		print(ans)
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	ans = []
	if n % 2 == 1:
		ans.append('7')
		for i in range(1, n // 2):
			ans.append('1')
	else:
		for i in range(n // 2):
			ans.append('1')
	print(''.join(ans))
testcase(int(inp()))


t = int(input())
for _ in range(t):
	n = int(input())
	ones = n // 2
	if n % 2 != 0:
		ones -= 1
		dig = 1
	else:
		dig = 0
	print('7' * dig + '1' * ones)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
dic = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
dic1 = {1: 2, 7: 3}

def maxnum():
	for _ in range(t):
		num = int(input())
		if num % 2 == 0:
			x1 = num // 2
			res = int(''.join(['1'] * x1))
		else:
			x1 = (num - 3) // 2
			res = int(''.join(['7'] + ['1'] * x1))
		yield res
t = int(input())
ans = maxnum()
print(*ans, sep='\n')


def fun(x):
	t = 1
	list1 = []
	while t == 1:
		if x >= 2 and x != 3:
			list1.append('1')
			x = x - 2
		elif x == 3:
			list1.append('7')
			x = x - 3
		else:
			t = 0
	str1 = ''.join(list1[::-1])
	print(str1)
x = int(input())
for i in range(x):
	p = int(input())
	fun(p)


import math

def solve():
	n = int(input())
	n -= 2
	if n % 2:
		print(7, end='')
	else:
		print(1, end='')
	for _ in range(n // 2):
		print(1, end='')
	print()

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


t = int(input())
for _ in range(t):
	n = int(input())
	print('7' * (n % 2), '1' * (n // 2 - n % 2), sep='')


i = input()
for j in range(int(i)):
	num = int(input())
	if num % 2 == 1:
		print('7', end='')
		num = num - 2
	for i in range(num // 2):
		print('1', end='')
	print('')


t = int(input())
for k in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


def remind(n, a):
	ans = []
	while n != 0:
		ans.append(a)
		n -= 1
	return ''.join(ans)

def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		if n % 2 == 0:
			print(remind(n // 2, '1'))
		elif n // 2 > n // 3:
			print('7' + remind(n // 2 - 1, '1'))
		elif n // 3 >= n // 2:
			if n % 3 == 2:
				print(remind(n // 3, '7') + '1')
			else:
				print(remind(n // 3, '7'))
main()


t = int(input())
for ti in range(t):
	it = int(input())
	if it & 1:
		print('7' + '1' * (it - 3 >> 1))
	else:
		print('1' * (it >> 1))


t = int(input())
for i in range(t):
	n = int(input())
	print('7' * (n % 2) + '1' * (n % 2 == 0) + '1' * (n // 2 - 1))


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	n = inp()
	q = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n % 2 == 0:
		s = '1' * (n // 2)
	else:
		s = '7' + '1' * (n // 2 - 1)
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		if n == 2:
			print(1)
		else:
			print(7)
	else:
		p = n // 2
		k = str(1) * (p - 1)
		if n % 2 == 1:
			k = '7' + k
		else:
			k += '1'
		print(k)


arr = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(int(input())):
	n = int(input())
	k = n // 2
	n %= 2
	res = 0
	for i in range(k):
		res *= 10
		res += 1
	if n == 1:
		res += 10 ** (k - 1) * 6
	print(res)


t = int(input())
MAX = 998244353
for i in range(t):
	n = int(input())
	(k9, k7, k1) = (0, 0, n // 2)
	if n % 2:
		k1 -= 1
		k7 += 1
	if k1 + k7 > MAX:
		d = k1 + k7 - MAX
		if d % 2:
			k1 -= 2
			k7 += 1
		k9 = d // 2
		k1 -= (d - d % 2) * 3
	print(k9 * '9' + k7 * '7' + k1 * '1')


x = int(input())
for i in range(x):
	y = int(input())
	if y % 2 == 0:
		print(int('1' * int(y / 2)))
	elif y == 3:
		print('7')
	else:
		print('7' + str('1' * (int(y // 2) - 1)))


t = int(input())
for i in range(t):
	n = int(input())
	num2 = n // 2
	if n % 2 != 0:
		if n % 2 == 1:
			num2 -= 1
			print(7, end='')
	for i in range(num2):
		print(1, end='')
	print()


N = int(input())
while N > 0:
	n = int(input())
	if n % 2 == 0:
		ch = str(1) * int(n / 2)
		print(ch)
	elif n == 3:
		print(7)
	else:
		ch = str(7)
		ch += str(1) * (int(n / 2) - 1)
		print(ch)
	N -= 1


t = int(input())
l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(t):
	n = int(input())
	a = n // 2
	b = n % 2
	if b == 0:
		print('1' * a)
	else:
		print('7' + '1' * (a - 1))


for _ in range(int(input())):
	n = int(input())
	s = ''
	if n % 2 != 0:
		s += '7'
		n -= 3
	c = n // 2
	s += '1' * c
	print(s)


T = int(input())
for cs in range(T):
	n = int(input())
	N = '7' if n & 1 else '1'
	n = n // 2 - 1
	for i in range(n):
		N += '1'
	print(N)


cases = int(input())
for _ in range(cases):
	inp = int(input())
	if inp % 2 == 1:
		ans = '7' + '1' * int((inp - 3) / 2)
		print(int(ans))
	else:
		print(int('1' * int(inp / 2)))


n = int(input())
q = ''
while n != 0:
	q = ''
	n = n - 1
	m = int(input())
	if m % 2 == 0:
		m = m / 2
		while m != 0:
			m = m - 1
			q = q + '1'
		print(int(q))
	else:
		m = m - 3
		m = m / 2
		q = q + '7'
		while m != 0:
			m = m - 1
			q = q + '1'
		print(int(q))


d = {1: 2, 7: 3}

def f(n):
	max = ''
	if n == 3:
		return '7'
	if n % 2 == 0:
		for i in range(n // 2):
			max += '1'
		return max
	else:
		max += '7'
		for i in range((n - 3) // 2):
			max += '1'
		return max
t = int(input())
for _ in range(t):
	n = int(input())
	print(f(n))


for _ in range(int(input())):
	n = int(input())
	arr = [False, False, 1, 7, 7, 7, 9, 9]
	ones = (n - 2) // 2
	n -= ones * 2
	if n == 2:
		print('1' + '1' * ones)
	elif n == 3:
		print('7' + '1' * ones)
	else:
		print('1' * ones)


n0 = 6
n1 = 2
n2 = 5
n3 = 5
n4 = 4
n5 = 5
n6 = 6
n7 = 3
n8 = 7
n9 = 6
for i in range(0, int(input())):
	n = int(input())
	d = 0
	if n % 2 == 0:
		for j in range(0, n // 2):
			d = d * 10 + 1
	else:
		d = 7
		for j in range(0, n // 2 - 1):
			d = d * 10 + 1
	print(d)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	if n % 2:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


t = int(input())
for _ in range(t):
	n = int(input())
	if n & 1 == 0:
		for _ in range(n >> 1):
			print(1, end='')
		print()
	elif n == 3:
		print(7)
	else:
		print(7, end='')
		for _ in range(n - 3 >> 1):
			print(1, end='')
		print()


for i in range(0, int(input())):
	no = int(input())
	if no % 2 == 0:
		f = str('1') * (no // 2)
	elif no == 3:
		f = str('7')
	else:
		f = str('7') + str('1') * ((no - 3) // 2)
	print(f)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n % 2 == 0:
		n = n // 2
		num = 0
		while n != 0:
			num = num * 10 + 1
			n = n - 1
	else:
		x = 3
		num = 7
		while x != n:
			num = num * 10 + 1
			x = x + 2
	print(num)


cases = int(input())
for _ in range(cases):
	a = int(input())
	if a == 2:
		print(1)
	elif a == 3:
		print(7)
	elif a % 2 == 0:
		g = '1' * (a // 2)
		print(g)
	else:
		r = (a - 3) // 2
		print('7' + r * '1')


def main():
	testcases = int(input())
	for i in range(testcases):
		segments = int(input())
		if segments % 2 != 0:
			print('7{}'.format('1' * ((segments - 3) // 2)))
		else:
			print('{}'.format('1' * (segments // 2)))
main()


for i in range(int(input())):
	a = int(input())
	b = 0
	arr = []
	if a % 2 == 0:
		print('1' * (a // 2))
	else:
		print('7' + '1' * ((a - 3) // 2))


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p
for _ in range(ii()):
	n = ii()
	if n % 2:
		ans = '7'
		n -= 3
	else:
		ans = '1'
		n -= 2
	ans += '1' * (n // 2)
	print(ans)


def main():
	for _ in range(int(input())):
		n = int(input())
		mod = n % 2
		c = n // 2
		ans = ''
		for i in range(c):
			ans += '1'
		if mod > 0:
			ans = '7' + ans[1:]
		print(ans)
main()


t = int(input())
while t > 0:
	t -= 1
	n = float(input())
	three = 0
	two = 0
	rem = 3
	if n % 2 == 0:
		two = int(n / 2)
		three = 0
	else:
		three = 1
		two = int((n - 3) / 2)
	maxnum = ''
	while three > 0:
		maxnum = maxnum + '7'
		three -= 1
	while two > 0:
		maxnum = maxnum + '1'
		two -= 1
	print(maxnum)


n = int(input())
chis = {2: 1, 3: 7, 5: 5, 7: 8}
for _ in range(n):
	s = ''
	a = int(input())
	while a != 0:
		if a % 2 == 0:
			s = s + '1' * (a // 2)
			break
		else:
			s = '7'
			a -= 3
	print(s)


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		ans = n // 2
		for i in range(ans):
			print('1', end='')
		print()
	else:
		ans = math.floor(n / 2) - 1
		print('7', end='')
		for i in range(ans):
			print('1', end='')
		print()


for t in range(int(input())):
	i = int(input())
	ones = i // 2
	left_over = i % 2
	if not left_over == 0:
		print('7' + (ones - 1) * '1')
	else:
		print(ones * '1')


def main():
	x = int(input())
	temp = 0
	if x % 2 == 0:
		temp = int(x // 2 * '1')
	elif (x - 3) // 2 != 0:
		temp = int('7' + (x - 3) // 2 * '1')
	else:
		temp = '7'
	print(temp)
	return temp
t = int(input())
for j in range(0, t):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		l = ['1'] * (n // 2)
		print(''.join(l))
	else:
		x = n - 3
		l = ['1'] * (x // 2)
		y = ['7']
		y.extend(l)
		print(''.join(y))


t = int(input())
for _ in range(t):
	M = int(input())
	m = M + 2
	m = int(M / 2 - 1)
	n = M % 2 + 2
	if n == 3:
		print(7, end='')
	else:
		print(1, end='')
	for i in range(m):
		print(1, end='')
	print()


t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for i in a:
	if i % 2 == 0:
		print((pow(10, i // 2) - 1) // 9)
	else:
		s = ''
		t = (pow(10, (i - 3) // 2) - 1) // 9
		if t != 0:
			s = '7' + str(t)
			print(int(s))
		else:
			print(7)


for _ in range(int(input())):
	a = int(input())
	ans = list('1' * (a // 2))
	if a % 2 == 1:
		ans[0] = '7'
	print(*ans, sep='')


n = int(input())
for a in range(n):
	value = int(input())
	if value % 2 == 0:
		print('1' * (value // 2))
	else:
		print('7' + '1' * ((value - 3) // 2))


n = int(input())
j = 1
while j < n + 1:
	n1 = int(input())
	k = n1 // 2 - 1
	m = n1 % 2
	if m == 0:
		ii = 1
		while ii < k + 1:
			print(1, end='')
			ii = ii + 1
		print(1)
	if m == 1:
		if k > 0:
			print(7, end='')
			ii = 1
			while ii < k:
				print(1, end='')
				ii = ii + 1
			print(1)
		if k == 0:
			print(7)
	j = j + 1


from sys import stdin
d = {7: 8, 6: 9, 5: 5, 4: 4, 3: 7, 2: 1}
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n % 2 == 0:
		m = '1' * (n // 2)
	else:
		m = '1' * (n // 2 - 1)
		m = '7' + m
	print(m)


n = int(input())
for i in range(n):
	m = int(input())
	if m == 3:
		print(7)
	elif m % 2 == 0:
		print('1' * (m // 2))
	else:
		l = m - 3
		print('7' + '1' * (l // 2))


T = int(input())
for t in range(T):
	(n,) = map(int, input().split())
	if n % 2:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


segments = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
for i in range(t):
	n = int(input())
	value = n // 2
	if n % 2 == 0:
		print('1' * value)
	else:
		value = (n - 2) // 2
		print('7' + '1' * value)


for _ in [0] * int(input()):
	n = int(input())
	print(['1', '7'][n % 2] + (n // 2 - 1) * '1')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
from bisect import bisect_left
from random import randint
from itertools import groupby
from collections import defaultdict
Max = 10 ** 6 + 5
N = 10 ** 9 + 7

def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = ''
		if n % 2 == 1:
			ans += '7'
			n -= 3
		ans += '1' * (n // 2)
		print(ans)
solve()


t = int(input())
for tc in range(t):
	n = int(input())
	res = ''
	if n % 2 != 0:
		res += '7'
		n -= 3
	while n >= 2:
		res += '1'
		n -= 2
	print(res)


try:
	t = int(input())
	for k in range(t):
		n = int(input())
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * (n // 2 - 1))
except:
	pass


t = int(input())
out = str()
for each in range(t):
	n = int(input())
	if n % 2 == 0:
		a = 1
	else:
		a = 7
	n = n // 2 - 1
	for i in range(n):
		a = a * 10 + 1
	out += str(a)
	if each < t:
		out += '\n'
print(out)


def f(n):
	if n % 2 == 0:
		s = '1' * (n // 2)
	else:
		s = '7' + '1' * ((n - 3) // 2)
	return int(s)
t = int(input())
for i in range(t):
	print(f(int(input())))


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	n = int(input())
	L = []
	while n:
		if n % 2 == 1:
			L.append('7')
			n -= 3
		elif n == 2:
			L.append('1')
			n -= 2
		else:
			n -= 2
			L.append('1')
	print(''.join(L))


def fun(n):
	if n & 1:
		print(7, end='')
		n -= 3
	while n > 0:
		print(1, end='')
		n -= 2
	print()
t = int(input())
for cs in range(t):
	n = int(input())
	fun(n)


T = input()
for cases in range(int(T)):
	n = int(input())
	if n >= 4:
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * (n // 2 - 1))
	elif n == 3:
		print('7')
	elif n == 2:
		print('1')


T = int(input())
for i in range(T):
	n = int(input())
	strx = ''
	for j in range(n):
		if n % 2 == 1:
			strx += '7'
			n -= 3
		while n >= 2:
			strx += '1'
			n -= 2
	print(strx)


from sys import stdin
input = stdin.readline
INF = 10 ** 9 + 7
MAX = 10 ** 7 + 7
MOD = 10 ** 9 + 7
for Ti in range(int(input().strip())):
	n = int(input().strip())
	if n % 2:
		ans = '7' + '1' * (n // 2 - 1)
	else:
		ans = '1' * (n // 2)
	print(ans)


bestNum = {2: 1, 3: 7, 4: 7, 5: 7, 6: 9, 7: 9}
ans = []
for t in range(int(input())):
	n = int(input())
	num = 0
	d = 1
	while n > 0:
		k = 1
		if n == 3:
			k = 7
			n -= 1
		n -= 2
		num += k * d
		d *= 10
	ans.append(str(num))
print('\n'.join(ans))


R = []
for i in range(int(input())):
	X = int(input())
	if X % 2 == 1:
		R.append('7' + '1' * ((X - 3) // 2))
	else:
		R.append('1' * (X // 2))
for i in R:
	print(i)


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return list(map(int, input().split()))

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	if n % 2 == 1:
		print('7' + '1' * (n // 2 - 1))
	else:
		print('1' * (n // 2))


for tc in range(int(input())):
	n = int(input())
	digits = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n % 2:
		print('7' + '1' * (n // 2 - 1))
	else:
		print('1' * (n // 2))


t = int(input())
for i in range(t):
	ans = []
	n = int(input())
	if n % 2 == 1:
		ans.append(7)
		n -= 3
	while n > 0:
		ans.append(1)
		n -= 2
	out = ''
	for j in ans:
		out += str(j)
	print(out)


import math
import os
import random
import re
import sys
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


def greatestNumber2(n):
	if n % 2 == 0:
		return (10 ** (n // 2) - 1) // 9
	m = (n - 3) // 2
	return 7 * 10 ** m + (10 ** m - 1) // 9
mapping = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
for _ in range(t):
	n = int(input())
	print(greatestNumber2(n))


def max_num(num):
	if num % 2 == 0:
		return '1' * (num // 2)
	elif num == 3:
		return '7'
	else:
		return '7' + '1' * ((num - 3) // 2)
number = int(input())
for i in range(number):
	print(max_num(int(input())))


def biggest_number(segments):
	if not segments % 2:
		return '1' * (segments // 2)
	return ''.join(('7', '1' * (segments // 2 - 1)))
t = int(input())
for _ in range(t):
	n = int(input())
	print(biggest_number(n))


t = int(input())
for i in range(0, t):
	c = int(input())
	if c % 2 != 0:
		d = '7' + '1' * int((c - 3) / 2)
	elif c % 2 == 0:
		d = '1' * int(c / 2)
	e = int(d)
	print(e)


t = input()
a = []
for _ in range(int(t)):
	a.append(int(input()))
for i in range(int(t)):
	if a[i] % 2 == 0:
		for j in range(a[i] // 2):
			print('1', end='')
	else:
		for j in range(a[i] // 2):
			if j == 0:
				print('7', end='')
			else:
				print('1', end='')
	print()


t = int(input())
s = '1'
s1 = '7'
for i in range(t):
	a = int(input())
	if a == 0:
		print('0')
	elif a == 1:
		print('0')
	if a % 2 == 0:
		print(s * (a // 2))
	else:
		print(s1 + s * ((a - 3) // 2))


for _ in range(int(input())):
	n = int(input())
	if n > 3:
		if n % 4 == 0:
			a = ['11'] * (n // 4)
			print(''.join(a))
		elif n % 4 == 1:
			b = '7'
			a = ['1'] * ((n - 3) // 2)
			c = ''.join(a)
			print(b + c)
		elif n % 4 == 3:
			b = '7'
			a = ['11'] * (n // 4)
			c = ''.join(a)
			print(b + c)
		elif n % 4 == 2:
			b = '1'
			a = ['11'] * (n // 4)
			c = ''.join(a)
			print(b + c)
	elif n == 3:
		print(7)
	elif n == 2:
		print(1)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	ones = n >> 1
	ans = ['1'] * ones
	if n & 1:
		ans[0] = '7'
	print(''.join(ans))


for _ in range(int(input())):
	q = int(input())
	if q % 2:
		print(7, end='')
		q -= 3
	print('1' * (q // 2))


val = 0
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	one = n // 2 - 1
	other = 2 + n % 2
	if other == 3:
		val = 7 * 10 ** one + (10 ** one - 1) // 9
	else:
		val = (10 ** (one + 1) - 1) // 9
	print(val)


for _ in range(int(input())):
	ans = ''
	x = int(input())
	if x % 2 == 0:
		for i in range(x // 2):
			ans += '1'
	else:
		for i in range(x // 2 - 1):
			ans += '1'
		ans = '7' + ans
	print(ans)


from sys import stdin
input = stdin.readline
for xoxo in range(1):
	for _ in range(int(input())):
		n = int(input())
		ans = ''
		while n > 1:
			if n >= 2:
				ans += '1'
				n -= 2
		if n == 1:
			print('7', end='')
			print(ans[:len(ans) - 1])
		else:
			print(ans)


t = int(input())
lst = ['1'] * 16
for i in range(1, 16):
	lst[i] = lst[i - 1] + lst[i - 1]
for i in range(t):
	n = int(input())
	ans = ''
	bin_n = bin(n)[2:]
	for j in range(2, len(bin_n) + 1):
		if bin_n[-j] == '1':
			ans += lst[j - 2]
	if bin_n[-1] == '1':
		ans = int(ans) + 6 * 10 ** (len(ans) - 1)
	else:
		ans = int(ans)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	cur = ['1'] * (n // 2)
	if n & 1 == 1:
		cur[0] = '7'
	print(''.join(cur))


testCases = int(input())
for test in range(testCases):
	number = ''
	n = int(input())
	if n % 2 == 0:
		for times in range(n // 2):
			number += '1'
	else:
		number += '7'
		n -= 3
		for times in range(n // 2):
			number += '1'
	print(number)


import os
import sys
from atexit import register
from io import StringIO
sys.stdout = StringIO()
register(lambda : os.write(1, sys.stdout.getvalue().encode()))
m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	if n % 2 == 1:
		s += '7'
		n -= 3
	s += '1' * int(n / 2)
	print(s)


c = int(input())
for i in range(c):
	n = int(input())
	answer = ''
	if n % 2 == 1:
		n -= 3
		answer += '7'
	while n > 0:
		n -= 2
		answer += '1'
	print(answer)


n = int(input())
nums = []
for i in range(n):
	nums.append(int(input()))

def res(n):
	if n % 2 == 0:
		return '1' * (n // 2)
	return '7' + '1' * ((n - 3) // 2)
for i in nums:
	print(res(i))


t = int(input())
while t > 0:
	t = t - 1
	a = int(input())
	lst = [1]
	if a == 2:
		a = a - 2
		print('1', end='')
	elif a % 2 != 0:
		a = a - 3
		print('7', end='')
	while a > 0:
		a = a - 2
		print(lst[0], end='')
	print()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	if n % 2 == 0:
		times = n // 2
		ans = '1' * times
	else:
		ans = '7'
		n -= 3
		times = n // 2
		ans = ans + '1' * times
	out(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = n // 2
	al = ['1'] * a
	if n % 2 == 1:
		al[0] = '7'
	print(''.join(al))


a = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
for _ in [0] * int(input()):
	i = int(input())
	if i % 2:
		print('7' + '1' * (i // 2 - 1))
	else:
		print('1' * (i // 2))


def printMaxNumber(n):
	ans = ''
	if n % 2 == 1:
		ans += '7'
		for i in range(int((n - 3) / 2)):
			ans += '1'
	else:
		for i in range(n // 2):
			ans += '1'
	return ans
for _ in range(int(input())):
	n = int(input())
	res = int(printMaxNumber(n))
	print(res)


n = int(input())
while n > 0:
	n -= 1
	num = int(input())
	while num % 2 != 0:
		num -= 3
		print(7, end='')
	print('1' * (num // 2))


n = int(input())
for i in range(n):
	kek = int(input())
	lol = kek // 2
	if kek % 2:
		print('7' + '1' * (lol - 1))
	else:
		print('1' * lol)


T = int(input())
while T > 0:
	T = T - 1
	n = int(input())
	l = []
	while n > 0:
		if n == 3:
			l.append(7)
			n = n - 3
		else:
			l.append(1)
			n = n - 2
	l.sort(reverse=True)
	for i in range(0, len(l)):
		print(l[i], end='')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	while True:
		if n == 2:
			a.append(1)
			break
		elif n == 3:
			a.append(7)
			break
		else:
			a.append(1)
			n -= 2
	print(''.join(map(str, a[::-1])))


for i in range(int(input())):
	n = int(input())
	sum = 0
	if n % 2 == 0:
		while n > 0:
			sum *= 10
			sum += 1
			n -= 2
		print(sum)
	elif n % 2 != 0:
		sum += 7
		n -= 3
		while n > 0:
			sum *= 10
			sum += 1
			n -= 2
		print(sum)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * str(1))
	elif n == 3:
		print(7)
	else:
		s = n - 3
		print(str(7) + s // 2 * str(1))


t = int(input())
for i in range(t):
	x = int(input())
	if x % 2 == 1:
		print('7' + '1' * ((x - 3) // 2))
	elif x % 2 == 0:
		print('1' * (x // 2))


def solve(N):
	if N == 2:
		return 1
	elif N == 3:
		return 7
	elif N % 2 == 0:
		return int('1' * (N // 2))
	else:
		return int('7' + '1' * (N // 2 - 1))
T = int(input())
query = [int(input()) for _ in range(T)]
for i in range(T):
	print(solve(query[i]))


def solve(n):
	ans = ''
	first = n % 2 != 0
	if first:
		ans = '7'
	else:
		ans = '1'
	for i in range(n // 2 - 1):
		ans = ans + '1'
	return ans
t = int(input())
for _ in range(t):
	x = int(input())
	print(solve(x))


n = int(input())
l = []
for i in range(n):
	t = int(input())
	ch = ''
	while t >= 4:
		ch = '1' + ch
		t -= 2
	if t == 2:
		ch = '1' + ch
	else:
		ch = '7' + ch
	l.append(int(ch))
for i in l:
	print(i)


t = int(input())
for i in range(t):
	l = []
	n = int(input())
	if n == 3:
		print(7)
	elif n % 2 == 0:
		print('1' * int(n // 2))
	else:
		st = '7'
		ne = int((n - 3) // 2)
		st += '1' * ne
		print(st)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		p = n // 2 - 1
		ost = n - p * 2
		res = '7' if ost == 3 else '1'
		for j in range(p):
			res += '1'
		print(res)
main()


t = int(input())
while t != 0:
	n = int(input())
	one = n // 2
	sev = 0
	if n % 2 == 1:
		one -= 1
		sev = 1
	ans = ''
	for i in range(sev):
		ans += '7'
	for i in range(one):
		ans += '1'
	print(ans)
	t -= 1


import math
from math import sqrt, ceil, floor
from functools import reduce
for cas in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		for cnt in range(floor(n / 2)):
			print(1, end='')
	else:
		print(7, end='')
		for cnt in range(floor(n / 2) - 1):
			print(1, end='')
	print(end='\n')


for i in range(int(input())):
	n = int(input())
	print(('1', '7')[n % 2] + '1' * ((n - 2) // 2))


for i in range(int(input())):
	a = int(input())
	s = list('1' * (a // 2))
	if a % 2 == 1:
		s[0] = '7'
	print(''.join(s))


def test(n):
	k = 998244353
	if n // 3 > k:
		n -= 3 * k
		n //= 3
		if n > k:
			n = k
		ans = '9' * n + '7' * (n - k)
	elif n // 2 > k:
		n -= 2 * k
		ans = '7' * n + '1' * (n - k)
	else:
		ans = '7' * (n % 2) + '1' * (n // 2 - n % 2)
	return ans
m = int(input())
for i in range(m):
	n = int(input())
	print(test(n))


t = int(input())
for i in range(t):
	z = int(input())
	res = 0
	if z % 2 == 0:
		print(z // 2 * '1')
	elif z % 2 == 1:
		print('7' + (z - 3) // 2 * '1')


t = int(input())
l = ['', '71', '1', '7']
for r in range(t):
	n = int(input())
	if n % 4 != 1:
		print(l[n % 4] + '11' * (n // 4))
	else:
		print(l[1] + '11' * (n // 4 - 1))


n = int(input())
for t in range(n):
	k = int(input())
	h = int(k / 2)
	c = '7'
	if k % 2 == 0:
		c = '1' * h
	else:
		h = h - 1
		c = c + '1' * h
	g = int(c)
	print(g)


digits = {6: 9, 5: 5, 4: 4, 3: 7, 2: 1, 1: -1}
t = int(input())
while t > 0:
	seg = int(input())
	res = ''
	if seg % 2 == 1:
		res += '7'
		for i in range(seg // 2 - 1):
			res += '1'
	else:
		for i in range(seg // 2):
			res += '1'
	print(res)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	if n % 2 == 0:
		outy = ''
		for s in range(n // 2):
			outy += '1'
	else:
		outy = '7'
		for s in range((n - 3) // 2):
			outy += '1'
	print(outy)


t = int(input())
while t > 0:
	k = 0
	n = int(input())
	a = []
	if n >= 6:
		k = n // 2
		for i in range(k - 1):
			a.append(1)
		if n % 2 != 0:
			a.append(7)
		else:
			a.append(1)
		for i in range(len(a) - 1, -1, -1):
			print(a[i], end='')
		print()
	elif n == 3 or n == 5:
		if n == 3:
			print('7')
		else:
			print('71')
	else:
		k = n // 2
		for i in range(k - 1):
			a.append(1)
		if n % 2 != 0:
			a.append(7)
		else:
			a.append(1)
		for i in range(len(a) - 1, -1, -1):
			print(a[i], end='')
		print()
	t -= 1


for i in range(int(input())):
	n = int(input())
	ans = ''
	if n % 2 != 0:
		ans += '7'
		n -= 3
	rem = n // 2
	now = '1' * rem
	ans = ans + now
	print(ans)


t = int(input())
for i in range(t):
	num = int(input())
	k = ''
	if num % 2 == 0:
		for j in range(num // 2):
			k = k + '1'
		print(k)
	else:
		k = '7'
		for j in range(num // 2 - 1):
			k = k + '1'
		print(k)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	if n % 2 == 0:
		temp = n // 2
		ans = int('1' * temp)
	else:
		temp = n // 2
		ans = int('1' * temp)
		ans += pow(10, temp - 1) * 6
	print(ans)


t = int(input())
a = []
for _ in range(t):
	n = int(input())
	(q, r) = (n >> 1, n & 1)
	if r == 0:
		a.append('1' * q)
	else:
		a.append('7' + '1' * (q - 1))
print('\n'.join(a))


for ttt in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
		continue
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		n -= 3
		s = ''
		s += '7'
		s += '1' * (n // 2)
		print(s)


dic = {0: 6, 1: 2, 2: 6, 3: 6, 4: 5, 5: 6, 6: 7, 7: 3, 8: 7, 9: 7}

def fun():
	n = int(input())
	if n % 2 == 0:
		z = int(n / 2)
		k = int('1' * z)
		print(k)
	else:
		z = int((n - 3) / 2)
		k = int('7' + '1' * z)
		print(k)
n = int(input())
for i in range(n):
	fun()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def compare(a, b):
	if a is None:
		return b
	if len(a) > len(b):
		return a
	if len(a) < len(b):
		return b
	return max(a, b)
for _ in range(INT()):
	N = INT()
	dp = [''] * (N + 1)
	dp[0] = ''
	for i in range(N):
		if i + 2 <= N:
			dp[i + 2] = compare(dp[i + 2], '1' + dp[i])
		if i + 3 <= N:
			dp[i + 3] = compare(dp[i + 3], '7' + dp[i])
		dp[i] = ''
	print(dp[N])


def getLine():
	return list(map(int, input().split()))

def main():
	n = int(input())
	for _ in range(n):
		num = int(input())
		if num % 2 == 0:
			print('1' * (num // 2))
		else:
			print('7' + '1' * (num // 2 - 1))
main()


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
for i in range(I()):
	n = I()
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


n = int(input())
for i in range(n):
	x = int(input())
	if x % 2 == 0:
		z = x // 2
		print('1' * z)
	elif x == 3:
		print('7')
	elif x == 5:
		print('71')
	elif x == 7:
		print('711')
	elif x == 9:
		print('7111')
	else:
		z = x // 2 - 1
		print('7' + '1' * z)


def main(n):
	if n == 3:
		return 7
	else:
		a = n % 2
	index = 0
	s = ''
	while index < int(n / 2):
		if a != 0:
			if index == 0:
				s = s + '7'
				index = index + 1
				continue
		s = s + '1'
		index = index + 1
	return int(s)
t = int(input())
for t_utr in range(t):
	n = int(input())
	res = main(n)
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	else:
		ones = n // 2
		if n % 2:
			print('7' + (ones - 1) * '1')
		else:
			print(ones * '1')


def best_possible(n):
	temp = ''
	if n % 2 == 0:
		temp = '1' * (n // 2)
	else:
		temp = '7' + '1' * ((n - 3) // 2)
	return temp
for _ in range(int(input())):
	print(best_possible(int(input())))


n = int(input())
for i1 in range(0, n, 1):
	segments = int(input())
	digits = int(segments / 2)
	if segments % 2 == 1:
		result = '7' + (digits - 1) * '1'
		print(result)
	else:
		result = digits * '1'
		print(result)


try:
	for _ in range(int(input())):
		n = int(input())
		if n % 2 != 0:
			print('7' + '1' * ((n - 2) // 2))
		else:
			print('1' * (n // 2))
except:
	pass


for t in range(int(input())):
	n = int(input())
	if n == 2:
		print('1')
	elif n == 2:
		print('7')
	elif n % 2 == 1:
		cnt_7 = 1
		cnt_1 = (n - 3) // 2
		print('7' * cnt_7 + '1' * cnt_1)
	else:
		cnt_1 = n // 2
		print('1' * cnt_1)


n = int(input())
for i in range(n):
	list_of_answers = []
	segments = int(input())
	if segments % 2 == 0:
		print('1' * (segments // 2))
	else:
		print('7' + '1' * (segments // 2 - 1))


from collections import defaultdict
import bisect
import math
x = int(input())
for _ in range(x):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * ((n - 3) // 2))


segment = [2, 3]
number = [1, 7]
for _ in range(int(input())):
	current_segment = int(input())
	if current_segment % 2 == 0:
		print('1' * (current_segment // 2))
	else:
		print('7' + '1' * (current_segment // 2 - 1))


for _ in range(int(input())):
	n = int(input())
	print('17'[n % 2] + '1' * ((n - 2) // 2))


n = int(input())
while n:
	x = int(input())
	s = ''
	if x % 2 == 0:
		for i in range(x // 2):
			s += '1'
	if x % 2 != 0:
		s += '7'
		for i in range((x - 2) // 2):
			s += '1'
	print(int(s))
	n = n - 1


t = int(input())
for i in range(t):
	n = int(input())
	if n > 3:
		if n % 2 == 0:
			b = n // 2
			print('1' * b)
		else:
			x = (n - 3) // 2
			b = '1' * x
			print('7' + b)
	elif n == 3:
		print(7)
	elif n == 2:
		print(1)


for _ in range(int(input())):
	n = int(input())
	maxnum = []
	if n % 2 == 0:
		maxnum.append('1' * (n // 2))
	else:
		maxnum.append('7')
		n = n - 3
		maxnum.append('1' * (n // 2))
	print(''.join(maxnum))


t = int(input())
for i in range(t):
	n = int(input())
	number = []
	pos = n // 2
	n -= 2 * pos
	for i in range(pos):
		number.append(1)
	while n > 0 and pos > 0:
		if n >= 4:
			n -= 4
			number[pos - 1] = 9
			pos -= 1
		elif n >= 1:
			n -= 1
			number[pos - 1] = 7
			pos -= 1
	for dig in reversed(number):
		if dig != 0:
			print(dig, end='')
	print('\n')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		c = n // 2
		print(int(c * '1'))
	elif n % 2 != 0:
		c = n // 2 - 1
		print(int('7' + c * '1'))


check = 998244353
for z in range(int(input())):
	n = int(input())
	ans = '1' * (n // 2)
	if n % 2 == 0:
		print(int(ans))
	else:
		newans = '7' + ans[1:]
		print(int(newans))


z = 6
o = 2
t = 5
th = 5
f = 4
fi = 5
s = 6
se = 3
e = 7
ni = 6
for _ in range(int(input())):
	a = []
	n = int(input())
	if n % 2 == 0:
		x = n // 2
		for i in range(x):
			a.append(1)
	else:
		c = n // 2
		d = c - 1
		a.append(7)
		for i in range(d):
			a.append(1)
	for i in a:
		print(i, end='')
	print()


R = lambda : list(map(int, input().split()))
t = int(input())
for _ in range(t):
	n = int(input())
	a = n // 2
	if n & 1:
		a = a - 1
		st = '1' * a
		print('7' + st)
	else:
		print('1' * a)


def solve():
	n = int(input())
	if n & 1:
		print(7, end='')
	else:
		print(1, end='')
	for i in range(n // 2 - 1):
		print(1, end='')
t = int(input())
for _ in range(t):
	solve()
	print(' ')


nt = int(input())
for qz in range(nt):
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2)
	else:
		ans = '7'
		ans += '1' * (n // 2 - 1)
	print(ans)


n = int(input())
for i in range(n):
	a = int(input())
	r = ''
	if a % 2 == 0:
		for j in range(a // 2):
			r += '1'
	else:
		r += '7'
		for j in range((a - 3) // 2):
			r += '1'
	print(r)


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'

def cpc(arr):
	return zip(arr, arr[1:])
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	return (*rrl(),)

def solve(n):
	if n % 2:
		ones = n // 2 - 1
		seven = 1
	else:
		ones = n // 2
		seven = 0
	ans = '7' * seven + '1' * ones
	return ans
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	rp(result)


b = []
a = int(input())
for i in range(a):
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2)
	else:
		ans = '7' + '1' * ((n - 3) // 2)
	b.append(ans)
for i in range(a):
	print(b[i])


for _ in range(int(input())):
	n = int(input())
	if n < 3:
		print(1)
	elif n == 3:
		print(7)
	elif n % 2 == 0:
		st = '1' * (n // 2)
		print(st)
	else:
		st = '1' * ((n - 3) // 2)
		st = str(7) + st
		print(st)


import atexit
import io
import sys
input = sys.stdin.readline
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	n = int(input())
	(lef, rig, res) = (0, 100000, 0)
	while lef <= rig:
		mid = lef + rig >> 1
		if n // 2 >= mid:
			res = mid
			lef = mid + 1
		else:
			rig = mid - 1
	ans = ''
	for i in range(res):
		if n - 6 >= (res - i - 1) * 2:
			ans += '9'
			n -= 6
		elif n - 3 >= (res - i - 1) * 2:
			ans += '7'
			n -= 3
		else:
			ans += '1'
			n -= 2
	print(ans)


slot = {'7': [8, 0], '6': [6, 9], '5': [3, 2, 5], '4': [4], '3': [7], '2': [1]}

def get_possibility(segment):
	if segment % 2 == 0:
		print(''.join(['1' for i in range(int(segment / 2))]))
	else:
		temp = segment - 3
		print('7' + ''.join(['1' for i in range(int(temp / 2))]))

def main(numbers):
	[get_possibility(segment) for segment in numbers]
numbers = []
for x in range(int(input())):
	numbers.append(int(input()))
main(numbers)


T = int(input())
greedyMap = {2: '1', 3: '7', 4: '4', 5: '5', 6: '9', 7: '8'}
for i in range(T):
	n = int(input())
	result = ''
	numOfOnes = n // 2
	rem = n % 2
	result += '1' * numOfOnes
	if rem == 1:
		result = '7' + '1' * (numOfOnes - 1)
	print(result)


q = int(input())
for i in range(q):
	n = int(input())
	d = []
	if n % 2 == 0:
		for i in range(n // 2):
			d.append('1')
	else:
		d.append('7')
		n -= 3
		for i in range(n // 2):
			d.append('1')
	print(''.join(d))


N = int(input())
for i in range(N):
	t = int(input())
	(x, y) = divmod(t, 2)
	if t % 2:
		print('7' + '1' * (x - 1))
	else:
		print('1' * x)


n = int(input())
for i in range(n):
	p = int(input())
	if p % 2 == 0:
		l = []
		a = p // 2
		for i in range(a):
			l.append(1)
	elif p % 2 != 0:
		l = ['7']
		r = (p - 1) // 2 - 1
		for i in range(r):
			l.append(1)
	print(*l, sep='')


for _ in range(int(input())):
	n = int(input())
	li = []
	if n & 1:
		li.append(7)
		n -= 3
	while n:
		li.append(1)
		n -= 2
	ans = ''.join((str(i) for i in li))
	print(ans)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	if n % 2:
		print('7', end='')
		print('1' * (n // 2 - 1))
	else:
		print('1' * (n // 2))


t = input()
t = int(t)
a = []
for i in range(t):
	temp = input()
	temp = int(temp)
	a.append(temp)
for i in range(t):
	m = a[i]
	if m % 2 == 0:
		n = int(m / 2)
		print('1' * n)
	else:
		n = int((m - 3) / 2)
		print('7' + '1' * n)


n = int(input())
c = []

def fun(a):
	if a % 2 == 0:
		c.append(int('1' * int(a / 2)))
	elif a == 3:
		c.append(7)
	elif a > 3:
		c.append(int('7' + '1' * int((a - 3) / 2)))
for i in range(n):
	k = int(input())
	fun(k)
for i in c:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	qnt = 0
	saida = []
	if n % 2 == 0:
		qnt = n / 2
		for j in range(int(qnt)):
			saida.append('1')
	else:
		qnt = n / 2
		for j in range(int(qnt - 1)):
			saida.append('1')
		saida.append('7')
	saida.sort(reverse=True)
	print(''.join(saida))


import sys
import math
import bisect

def solve(n):
	if n % 2:
		return ''.join(list((str(a) for a in [7] + [1] * ((n - 3) // 2))))
	else:
		return ''.join(list((str(a) for a in [1] * (n // 2))))

def main():
	for _ in range(int(input())):
		print(solve(int(input())))
main()


t = int(input())
for i in range(t):
	n = int(input())
	arr = ''
	if n % 2 == 1:
		arr = '7'
		for j in range((n - 3) // 2):
			arr += '1'
	else:
		for j in range(n // 2):
			arr += '1'
	print(arr)


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	while n >= 2:
		if n == 2:
			l.append(1)
			n = 0
		elif n == 4:
			l.extend([1, 1])
			n = 0
		elif n == 5:
			l.extend([7, 1])
			n = 0
		elif n == 3:
			l.append(7)
			n = 0
		elif n == 6:
			l.extend([1, 1, 1])
			n = 0
		elif n % 2 == 0:
			k = n // 2
			for i in range(k):
				l.extend([1])
			n = 0
		else:
			l.append(7)
			k = (n - 3) // 2
			for i in range(k):
				l.extend([1])
			n = 0
	print(''.join(map(str, l)))


n = int(input())
for i in range(n):
	a = int(input())
	res1 = a // 2
	res2 = a % 2
	if res2 == 0:
		print('1' * res1)
	else:
		print('7' + '1' * (res1 - 1))


t = int(input())
for test in range(t):
	n = int(input())
	ans = []
	while n >= 2:
		if n % 2 == 0:
			ans.append(1)
			n -= 2
		else:
			ans.append(7)
			n -= 3
	for i in ans:
		print(i, end='')
	print()


T = int(input())
inputs = []
while T != 0:
	n = int(input())
	inputs.append(n)
	T -= 1

def largestnumber(n):
	digits = []
	left = n
	while left > 1:
		if left % 2 != 0:
			digits.append('7')
			left = left - 3
		else:
			digits.append('1')
			left = left - 2
	print(''.join(digits))

def main():
	if 1 <= len(inputs) <= 100:
		for x in inputs:
			if 2 <= x <= 10 ** 5:
				largestnumber(x)
main()


def main():
	n = int(input())
	for _ in range(n):
		m = int(input())
		if m % 2 == 0:
			number = [str(1) for _ in range(0, m // 2)]
			print(''.join(number))
		else:
			number = [str(1) for _ in range(0, m // 2 - 1)]
			print('7' + ''.join(number))
main()


t = int(input())
for a in range(t):
	n = int(input())
	if n < 2:
		ans = ''
	elif n % 2 == 0:
		ans = n // 2 * '1'
	else:
		ans = '7' + (n // 2 - 1) * '1'
	print(ans)


for j in [0] * int(input()):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


t = int(input())
for x in range(t):
	n = int(input())
	s = 0
	o = 0
	f = ''
	if n % 2 == 0:
		o = n // 2
		while o:
			f += '1'
			o -= 1
	else:
		f += '7'
		n -= 3
		o = n // 2
		while o:
			f += '1'
			o -= 1
	print(f)


from time import sleep as sle
from math import *
from random import randint as ri

def gcd(a, b):
	if a == b:
		return a
	elif a > b:
		return gcd(a - b, b)
	else:
		return gcd(b, a)

def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * ((n - 3) // 2))
solve()


t = int(input())
for _ in range(t):
	test = int(input())
	ans = 0
	while test >= 2:
		test -= 2
		ans *= 10
		ans += 1
	if test == 1:
		ans += 6 * 10 ** (len(str(ans)) - 1)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	is_od = n & 1
	if is_od:
		n = n - 3
	l = n // 2
	req = ['1'] * l
	if is_od:
		req = ['7'] + req
	req = ''.join(req)
	print(req)


import math

def ans(k):
	i = 0
	p = ''
	while i < k:
		p = p + '1'
		i = i + 1
	return p

def task():
	n = int(input())
	if n % 2 == 0:
		print(ans(n / 2))
	else:
		print('7' + ans((n - 1) // 2)[0:-1])
t = int(input())
while t > 0:
	task()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	ones = '1' * (n // 2)
	if n % 2 == 1:
		out = '7' + ones[1:]
	else:
		out = ones
	print(out)


import sys
input = sys.stdin.readline
for __ in range(int(input())):
	n = int(input())
	s = ''
	if n % 2 == 1:
		s += '7'
		n -= 3
	s += '1' * (n // 2)
	print(s)


t = int(input())
nlist = []
for w in range(t):
	n = float(input())
	nlist.append(n)
for w in nlist:
	g = 1
	s = 0
	if w % 2 == 0:
		for y in range(int(w / 2)):
			s += g
			g *= 10
		print(s)
	else:
		w = w - 3
		for y in range(int(w / 2)):
			s += g
			g *= 10
		s += g * 7
		print(s)


for i in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		lst = ['1'] * (n // 2)
		print(''.join(lst))
	else:
		lst = ['1'] * (n // 2)
		lst[0] = '7'
		print(''.join(lst))


t = int(input())
while t > 0:
	n = int(input())
	if n == 2:
		print('1', end='')
	elif n == 3:
		print('7', end='')
	elif n > 3 and n % 2 != 0:
		print('7', end='')
		k = (n - 3) // 2
		for i in range(k):
			print(1, end='')
	elif n > 3 and n % 2 == 0:
		k = n // 2
		for i in range(k):
			print(1, end='')
	print()
	t -= 1


def main():
	N = int(input())
	for i in range(N):
		n = int(input())
		result = 0
		if n % 2 == 1:
			result = 7
			n -= 3
		while n > 0:
			result *= 10
			result += 1
			n -= 2
		print(result)
main()


def calc(n):
	if n < 2:
		return 0
	(one, seven) = divmod(n, 2)
	if seven:
		res = '7' + '1' * (one - 1)
	else:
		res = '1' * one
	return int(res)
N = int(input())
cases = []
for _ in range(N):
	cases.append(int(input()))
for case in cases:
	print(calc(case))


t = int(input())
for i in range(t):
	a = []
	n = int(input())
	if n % 2 == 0:
		d = int(n // 2)
		for j in range(d):
			a.append(1)
	else:
		d = int((n - 3) // 2)
		a.append(7)
		for i in range(d):
			a.append(1)
	a = [str(x) for x in a]
	print(''.join(a))


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		if N % 2:
			ans = '7' + '1' * ((N - 3) // 2)
		else:
			ans = '1' * (N // 2)
		print(ans)
main()


n = int(input())
arr = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for i in range(n):
	cur = int(input())
	answer = ''
	temp = cur / 2
	cur = cur % 2
	for j in range(int(temp - 1)):
		answer += '1'
	cur += 2
	while cur > 1:
		if cur == 3:
			answer = '7' + answer
			cur -= 3
		elif cur >= 2:
			answer += '1'
			cur -= 2
	print(answer)


t = int(input())
b1 = 0
b2 = 0
z = 0
z1 = 0
while t > 0:
	a = int(input())
	if a & 1:
		print('7', end='')
		for i in range(0, (a - 3) // 2, 1):
			print('1', end='')
		print()
	else:
		for i in range(0, a // 2, 1):
			print('1', end='')
		print()
	t -= 1


def answer(n):
	if n % 2 == 0:
		return '1' * (n // 2)
	else:
		return '7' + (n // 2 - 1) * '1'

def main():
	t = int(input())
	n = []
	for j in range(t):
		n.append(int(input()))
	for j in range(t):
		print(answer(n[j]))
main()


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	if n < 2:
		print('0')
	elif n == 3:
		print('7')
	else:
		k = n // 2
		if n % 2 == 1:
			ar = [7]
			ar.extend([1] * (k - 1))
			print(''.join(map(str, ar)))
		else:
			ar = [1] * k
			print(''.join(map(str, ar)))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		n = ii()
		x = ''
		y = ''
		a = n // 2
		b = n // 3
		for i in range(b):
			y += '7'
		if n % 2 == 1:
			x += '7'
			for i in range(a - 1):
				x += '1'
		else:
			for i in range(a):
				x += '1'
		if len(x) > len(y):
			print(x)
		else:
			print(y)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin

def compute(n):
	max_digits = n // 2
	A = [None] * max_digits
	rem_seg = n
	rem_digits = max_digits - 1
	for i in range(max_digits):
		if rem_seg - 6 >= 2 * rem_digits:
			A[i] = 9
			rem_seg -= 6
		elif rem_seg - 3 >= 2 * rem_digits:
			A[i] = 7
			rem_seg -= 3
		elif rem_seg - 2 >= 2 * rem_digits:
			A[i] = 1
			rem_seg -= 2
		else:
			A[i] = None
		rem_digits -= 1
	return int(''.join((str(v) for v in A if v is not None)))
t = int(stdin.readline())
N = [int(stdin.readline()) for i in range(t)]
for v in N:
	print(compute(v))


cases = int(input())
while cases:
	cases -= 1
	n = int(input())
	if n % 2 == 0:
		ans = '1' * (n // 2)
	else:
		ans = '7' + (n - 3) // 2 * '1'
	print(ans)


for i in range(int(input())):
	a = int(input())
	b = a // 2
	c = a - 2 * b
	if c == 1:
		b -= 1
		d = '7'
	else:
		d = ''
	if b != 0:
		for _ in range(b):
			d += '1'
	print(int(d))


t = int(input())
while t:
	n = int(input())
	string = ''
	string = '7' if n % 2 else '1'
	string += '1' * (n // 2 - 1)
	print(string)
	t -= 1


t = input()

def func(n):
	if n % 2 == 0:
		i = n / 2
		d = [1] * int(i)
		print(*d, sep='')
	else:
		a = [7]
		i = (n - 1) / 2
		d = [1] * int(i - 1)
		a = a + d
		print(*a, sep='')
for i in range(int(t)):
	n = input()
	func(int(n))


def solve(n: int):
	ret = '1' * ((n - n % 2) // 2)
	if n % 2 == 1:
		return '7' + ret[1:]
	return ret

def main():
	for _ in range(int(input())):
		print(solve(int(input())))
main()


testCases = int(input())
segments = {2: [1], 3: [7], 4: [4], 5: [5, 3, 2], 6: [9, 6], 7: [8, 0]}
possibleSegments = [2, 3, 4, 5, 6, 7]
for test in range(testCases):
	number = ''
	n = int(input())
	while n > 0:
		for segment in possibleSegments:
			if n >= segment and n - segment != 1:
				number += str(segments[segment][0])
				n -= segment
				break
	answer = ''.join(reversed(number))
	print(answer)


for n in range(int(input())):
	x = int(input())
	p = x // 2
	s = ''
	if x % 2 == 0:
		for n in range(p):
			s += '1'
	else:
		s += '7'
		for n in range(p - 1):
			s += '1'
	print(s)


n = int(input())
for i in range(n):
	k = int(input())
	if k % 2 != 0:
		c = k // 2
		print('7', (c - 1) * '1', sep='')
	else:
		c = k // 2
		print(c * '1')


t = int(input())
for i in range(t):
	n = int(input())
	k = int(n / 2)
	if n == 3:
		print('7')
	elif n % 2 == 1:
		print(''.join(['7'] + ['1' for j in range(k - 1)]))
	else:
		print(''.join(['1' for j in range(k)]))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
t = int(input())
la = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(t):
	n = int(input())
	st = list('1' * (n // 2))
	lef = n % 2
	for i in range(len(st)):
		lef += 2
		flag = 0
		for j in range(9, 1, -1):
			if la[j] <= lef:
				flag = 1
				lef -= la[j]
				st[i] = str(j)
				break
		if not flag:
			lef = 0
	print(''.join(st))


t = int(input())
for case in range(t):
	n = int(input())
	ans = str(6 * (n % 2) + 1) + '1' * (n // 2 - 1)
	print(ans)


def fun(num):
	if num % 2 == 0:
		s = []
	else:
		s = ['7']
		num -= 3
	while num != 0:
		num -= 2
		s.append('1')
	print(''.join(s))
i = int(input())
for k in range(i):
	num = int(input())
	fun(num)


t = int(input())
for z in range(t):
	n = int(input())
	if n % 2 == 0:
		s = '1' * (n // 2)
	elif n == 3:
		s = '7'
	else:
		n -= 3
		s = '7' + '1' * (n // 2)
	print(s)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	y = n % 2
	if y == 0:
		for i in range(x):
			print('1', end='')
	elif y == 1:
		print('7', end='')
		for i in range(x - 1):
			print('1', end='')
	print()


tt = int(input())
while tt > 0:
	n = int(input())
	n_one = n // 2
	if n & 1 == 1:
		n_one -= 1
		print('7', end='')
	for i in range(n_one):
		print('1', end='')
	print()
	tt -= 1


cases = int(input())
for case in range(cases):
	strokes = int(input())
	number = strokes // 2
	remainder = strokes % 2
	if remainder:
		number -= 1
	result = '7' * remainder + '1' * number
	print(result)


for _ in range(int(input())):
	n = int(input())
	mod = n % 2
	numofdig = n // 2
	if mod == 1:
		print('7', end='')
	else:
		print('1', end='')
	for i in range(1, numofdig):
		print('1', end='')
	print()


s = int(input())
for i in range(s):
	x = int(input())
	A = ''
	if x % 2 == 0:
		for i in range(x // 2):
			A = A + '1'
	else:
		A = A + '7'
		for i in range(x // 2 - 1):
			A = A + '1'
	print(A)


T = int(input())
for t in range(T):
	n = int(input())
	if n in [0, 1]:
		print(0)
		continue
	if n % 2 == 1:
		print(7, end='')
		n -= 3
	print('1' * (n // 2))


def find_max(n):
	odd = n & 1
	return odd * '7' + '1' * ((n >> 1) * (not odd) + (n - 3 >> 1) * odd)
t = int(input())
for _ in range(t):
	n = int(input())
	print(find_max(n))


from collections import deque
from math import log, sqrt, ceil

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
a = {}
a[2] = 1
a[5] = 5
a[6] = 9
a[7] = 8
a[3] = 7
t = ii()
while t:
	t -= 1
	n = ii()
	b = []
	n1 = n
	n1 -= 3
	if n1 < 0:
		print('1')
	else:
		x = n1 // 2
		s1 = '7'
		s1 += '1' * x
		y = n // 2
		s2 = '1' * y
		print(max(int(s1), int(s2)))


t = int(input())
numberslights = {2: 1, 3: 7, 4: 4, 5: 5, 6: 9, 7: 8}
lst = [2, 3, 4, 5, 6, 7]
while t != 0:
	t -= 1
	x = int(input())
	i = 0
	ans = list()
	while x != 3:
		a = lst[i]
		x -= a
		ans.append(numberslights[a])
		if x == 0:
			break
		else:
			continue
	if x != 0:
		i += 1
		a = lst[i]
		ans.append(numberslights[a])
	ans.sort()
	ans = ans[::-1]
	a = ''.join(map(str, ans))
	print(int(a))


import sys
input = sys.stdin.readline
t = int(input())
for ij in range(0, t):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	a += n // 2
	if n % 2 == 0:
		s = '1' * a
	else:
		s = '7' + '1' * (a - 1)
	print(s)


t = int(input())
for num in range(0, t):
	i = int(input())
	o = i // 2
	p = i % 2
	if p == 0:
		print(o * '1')
	else:
		o = o - 1
		print('7' + o * '1')


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	N = int(readline())
	if N & 1:
		ans = [7] + [1] * (N // 2 - 1)
	else:
		ans = [1] * (N // 2)
	Ans[qu] = ans
print('\n'.join((''.join(map(str, ans)) for ans in Ans)))


t = int(input())
ans_list = []
for i in range(t):
	n = int(input())
	ans = ''
	if n % 2 == 0:
		ans = '1' * (n // 2)
	else:
		ans = '7' + '1' * (n // 2 - 1)
	ans_list.append(ans)
for g in range(t):
	print(ans_list[g])


count = int(input())
for _ in range(count):
	number = int(input())
	a = number // 2
	if number % 2 == 1:
		print('7' + (a - 1) * '1')
	else:
		print(a * '1')


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 2 == 1:
		print(7, end='')
		n -= 3
		while n > 0:
			n -= 2
			print(1, end='')
	else:
		while n > 0:
			n -= 2
			print(1, end='')
	print()


def f(x):
	res = []
	if x % 2 == 0:
		for i in range(x // 2):
			res.append(1)
		strings = [str(integer) for integer in res]
		a_string = ''.join(strings)
		an_integer = int(a_string)
		print(an_integer)
	else:
		res.append(7)
		for i in range(x // 2 - 1):
			res.append(1)
		strings = [str(integer) for integer in res]
		a_string = ''.join(strings)
		an_integer = int(a_string)
		print(an_integer)
n = int(input())
for i in range(n):
	x = int(input())
	f(x)


ans = []
for _ in range(int(input())):
	b = int(input())
	if b % 2 == 0:
		ans.append('1' * (b // 2))
	else:
		ans.append('7' + '1' * (b // 2 - 1))
for i in range(len(ans)):
	print(ans[i])


fac = [1 for _ in range(1021)]
ifac = [1 for _ in range(1021)]
mod = 10 ** 9 + 7

def ModInv(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x % mod
		y = y >> 1
		x = x * x % mod
	return res
for i in range(1, 1020):
	fac[i] = fac[i - 1] * i % mod
	ifac[i] = ifac[i - 1] * ModInv(i, mod - 2) % mod
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


T = int(input())
for _ in range(T):
	segments = int(input())
	places = segments // 2
	sevens = segments % 2
	numbers = [1] * places
	for i in range(0, sevens):
		numbers[i] = 7
	numbers = [str(i) for i in numbers]
	numbers = ''.join(numbers)
	print(numbers)


INF = 10 ** 10

def main():
	n = get_int()
	ans = '1' * (n // 2)
	if n % 2 != 0:
		ans = '7' + ans[1:]
	print(ans)
import sys
import math
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


n = int(input())
for i in range(n):
	a = int(input())
	maxx = a // 2
	maxx2 = a % 2
	ch = ''
	if maxx2 == 1:
		ch += '7'
	for i in range(maxx - maxx2):
		ch += '1'
	print(ch)


def findLargestNumber(segments):
	remainingSegments = segments
	ans = ''
	if remainingSegments % 2 != 0:
		ans += '7'
		remainingSegments -= 3
	while remainingSegments > 0:
		ans += '1'
		remainingSegments -= 2
	return ans
numCases = int(input().strip())
for i in range(0, numCases):
	ans = findLargestNumber(int(input().strip()))
	print(ans)


def find_the_highest_number(n):
	num = '1' * (n // 2)
	segments = len(num) * 2
	if segments < n:
		num = '7' + num[1:]
	return num
for _ in range(int(input())):
	print(find_the_highest_number(int(input())))


ls = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
while t:
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))
	t -= 1


import sys
input = sys.stdin.readline
Q = int(input())
Query = [int(input()) for _ in range(Q)]
for N in Query:
	n = N // 2
	p = N % 2
	if p == 1:
		n -= 1
	ans = '7' * p + '1' * n
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = []
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	if n >= 4:
		if n % 2 == 0:
			re = n // 2
			l = [1] * re
		else:
			re = n // 2
			l = [1] * (re - 1)
			l.insert(0, 7)
		for i in l:
			print(i, end='')
		print('')


results = []
for i in range(0, int(input())):
	currentnum = int(input())
	numresult = ''
	if currentnum == 1 or currentnum == 0:
		numresult = 0
	elif currentnum == 2:
		numresult = 1
	elif currentnum == 3:
		numresult = 7
	elif currentnum > 3:
		numresult += '1' * (currentnum // 2)
		if currentnum % 2 == 1:
			numresult = '7' + numresult[1:]
		numresult = int(numresult)
	results.append(numresult)
for i in results:
	print(i)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 2 == 0:
		x = '1' * int(n / 2)
		print(int(x))
		continue
	else:
		n = n - 1
		x = ['1'] * int(n / 2)
		x[0] = '7'
		x = ''.join(x)
		print(int(x))
		continue


t = int(input())
for i in range(t):
	n = int(input())
	ones = n // 2
	n = n % 2
	nines = 0
	if n >= 4:
		nines = n // 4
		n = n % 4
	ones = ones - nines
	sevens = 0
	if n >= 1:
		sevens = n
	ones = ones - sevens
	ans = ''
	for i in range(nines):
		ans += '9'
	for i in range(sevens):
		ans += '7'
	for i in range(ones):
		ans += '1'
	print(ans)


import math
t = int(input())
for q in range(t):
	n = int(input())
	s = ''
	if n % 2 == 1:
		s += '7'
		n -= 3
	s += '1' * math.floor(n / 2)
	print(s)


def solve():
	inputs = []
	n = int(input())
	for _ in range(n):
		inputs.append(int(input()))
	for i in range(len(inputs)):
		inpu = inputs[i]
		pos = inpu % 2
		times = inpu // 2
		if pos == 0:
			for _ in range(times):
				print(1, end='')
			if i != len(inputs) - 1:
				print('')
		else:
			print(7, end='')
			for _ in range(times - 1):
				print(1, end='')
			if i != len(inputs) - 1:
				print('')
solve()


t = int(input())
while t > 0:
	n = int(input())
	t -= 1
	if n % 2 == 0:
		res = [1] * int(n / 2)
		print(''.join(map(str, res)))
	else:
		res = [7]
		n -= 3
		res += [1] * int(n / 2)
		print(''.join(map(str, res)))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		for k in range(n // 2):
			print('1', end='')
		print('')
	elif n % 4 == 1:
		print('71', end='')
		for k in range((n - 5) // 2):
			print('1', end='')
		print('')
	elif n % 4 == 2:
		for k in range((n - 2) // 2):
			print('1', end='')
		print('1')
	elif n % 4 == 3:
		print('7', end='')
		for k in range((n - 3) // 2):
			print('1', end='')
		print('')


t = int(input())
while t:
	t += -1
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		s = '7'
		s1 = '1' * ((n - 3) // 2)
		print(s + s1)


def f():
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * '1')
	elif n < 5:
		print(7)
	else:
		print('7' + (n - 3) // 2 * '1')
for _ in range(int(input())):
	f()


r = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		print(''.join(['1' for _ in range(n // 2)]))
	else:
		print(''.join(['7'] + ['1' for _ in range(n // 2 - 1)]))


t = int(input())
for _ in range(t):
	n = int(input())
	l = ['1'] * (n // 2)
	if n % 2 != 0:
		l[0] = '7'
	print(*l, sep='')


q = int(input())
for i in range(q):
	a = int(input())
	if a == 2:
		print('1')
	elif a == 3:
		print('7')
	else:
		arr = []
		while a > 0:
			if a == 0:
				continue
			elif a > 3:
				a -= 2
				arr += [1]
			elif a == 2:
				a = 0
				arr += [1]
			else:
				a = 0
				arr += [7]
		arr.sort()
		arr = arr[::-1]
		for j in range(len(arr)):
			print(arr[j], end='')
		arr = []
		print()


import math
MOD = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	a = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n % 2 == 0:
		print('1' * (n // 2))
	elif (n - 3) % 2 == 0 and n != 3:
		print('7' + '1' * ((n - 3) // 2))
	elif n == 3:
		print(7)


t = int(input())
for _ in range(t):
	a = int(input())
	if a % 2 == 0:
		y = a // 2
		l = [1] * y
		print(''.join(map(str, l)))
	else:
		l = [1] * ((a - 3) // 2)
		l.insert(0, 7)
		print(''.join(map(str, l)))


t = input()
for _ in range(int(t)):
	n = int(input())
	if n == 2:
		print(1)
	if n == 3:
		print(7)
	if n == 4:
		print(11)
	if n > 4:
		if n % 2 == 1:
			s = '7'
			n = n - 3
			for i in range(n // 2):
				s += '1'
			print(s)
		else:
			s = ''
			for i in range(n // 2):
				s += '1'
			print(s)


for i in range(int(input())):
	n = int(input())
	f = n % 2
	k = n // 2
	print('7' * f + '1' * (k - f))


import math
T = int(input())
for i in range(T):
	n = int(input())
	ones = n // 2
	result = ''
	if n % 2 == 1:
		ones -= 1
		result += '7'
	result += '1' * ones
	print(result)


t = int(input())
p = 0
while p < t:
	p = p + 1
	print('\n')
	n = int(input())
	if n % 2 == 1:
		print('7', end='')
		n = n - 3
	if n % 2 == 0:
		m = 0
		while m < n / 2:
			print('1', end='')
			m = m + 1
			if m == n / 2 - 1:
				print('1')
				m = m + 9


t = int(input())
solutions = []
for i in range(t):
	solution = 0
	n = int(input())
	if n % 2 == 0:
		solution = '1' * (n // 2)
	else:
		solution = '7' + '1' * (n // 2 - 1)
	solutions.append(solution)
for solution in solutions:
	print(solution)


import sys
import math
from collections import defaultdict as dd
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(input())
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	else:
		s = ''
		while n:
			if n == 3:
				s += '7'
				n -= 3
			else:
				s += '1'
				n -= 2
		print(s[::-1])


for v in range(int(input())):
	n = int(input())
	x = ''
	if n % 2 == 0:
		x = int(n // 2 * '1')
	else:
		x = int(int('7' + (n - 3) // 2 * '1'))
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	r = n % 2
	if r % 2 != 0:
		dig = int('7' + '1' * (k - 1))
	else:
		dig = int('1' * k)
	print(dig)


for i in range(int(input())):
	a = int(input())
	l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	c = [0, 0, 0, 0]
	d = []
	c[2] = a // 2
	c[3] = a % 2
	if c[3] == 1:
		c[2] -= 1
	for j in range(c[2]):
		d.append(l.index(2))
	for j in range(c[3]):
		d.append(l.index(3))
	d.sort()
	for j in range(len(d)):
		if j == len(d) - 1:
			print(d[len(d) - 1 - j])
		else:
			print(d[len(d) - 1 - j], end='')


t = int(input())
L = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for _ in range(t):
	n = int(input())
	n_2 = int(n / 2)
	if n % 2 == 0:
		print(int('1' * n_2))
	else:
		print(int('7' + '1' * (n_2 - 1)))


t = int(input())
for i in range(t):
	q = int(input())
	if q % 2 == 1:
		print('7' + ''.join(['1'] * (q // 2 - 1)))
	else:
		print(''.join(['1'] * (q // 2)))


limit = 998244353
t = int(input().strip())
values = [(9, 6), (7, 3), (1, 2)]
for _ in range(t):
	n = int(input().strip())
	spaces = min(n // 2, limit)
	res = ''
	while spaces > 0:
		if (n - 6) // 2 >= spaces - 1:
			n -= 6
			res += '9'
		elif (n - 3) // 2 >= spaces - 1:
			n -= 3
			res += '7'
		else:
			n -= 2
			res += '1'
		spaces -= 1
	print(res)


def solve():
	n = int(input())
	s = ('7' if n % 2 else '1') + '1' * (n // 2 - 1)
	print(s)
t = int(input())
for ti in range(t):
	solve()


a = int(input())
b = []
d = ''
f = 0
for i in range(a):
	b.append(int(input()))
	if b[i] % 2 == 0:
		while b[i] >= 2 and b[i] % 2 == 0:
			b[i] = b[i] - 2
			d = d + str('1')
	if b[i] % 2 == 1:
		d = d + str('7')
		while b[i] >= 2 and b[i] != 0:
			if b[i] == 3:
				b[i] = b[i] - 3
			if b[i] != 0 and b[i] != 3:
				b[i] = b[i] - 2
				d = d + str('1')
	print(d)
	d = ''


for i in range(int(input())):
	n = int(input())
	print(1 + 6 * (n % 2 == 1), end='')
	print('1' * (n // 2 - 1))


def find(val):
	num = val
	res = 0
	fourCnt = 0
	threeCnt = 0
	twoCnt = 0
	while res != num:
		if res < num:
			res += 4
			fourCnt += 1
		else:
			while res != num:
				res -= 4
				fourCnt -= 1
				while res != num:
					if res < num:
						res += 3
						threeCnt += 1
					else:
						res -= 3
						threeCnt -= 1
						while res != num:
							if res < num:
								res += 2
								twoCnt += 1
							else:
								res -= 2
								twoCnt -= 1
								break
						break
			break
	it(threeCnt, 7)
	it(fourCnt, 1)
	it(twoCnt, 1)

def find3(val):
	temp = val
	while True:
		if val % 2 == 0:
			if temp % 2 == 1:
				it(int(val / 2 - 1), 1)
			else:
				it(int(val / 2), 1)
			break
		else:
			it(1, 7)
			val -= 1

def find2(val):
	num = val
	res = 0
	threeCnt = 0
	twoCnt = 0
	while res != num:
		if res < num:
			res += 3
			threeCnt += 1
		else:
			while res != num:
				res -= 3
				threeCnt -= 1
				while res != num:
					if res < num:
						res += 2
						twoCnt += 1
					else:
						res -= 2
						twoCnt -= 1
						break
			break
	it(threeCnt, 7)
	it(twoCnt, 1)

def it(n, v):
	for i in range(n):
		print(v, end='')
t = 1
t = int(input())
arr = []
while t > 0:
	t -= 1
	arr.append(int(input()))
for i in range(len(arr)):
	find3(arr[i])
	print()


import sys, math
mod = 998244353
for _ in range(int(input())):
	n = int(input())
	if n == 3:
		print(7)
	else:
		if n % 2 == 1:
			print(7, end='')
			n -= 3
		while 1:
			print(1, end='')
			n -= 2
			if n <= 0:
				break
		print()


counts = int(input())
arr = [int(input()) for _ in range(counts)]
for n in arr:
	if n % 2 == 0:
		print('1' * int(n / 2))
	else:
		n -= 3
		print('7' + '1' * int(n / 2))


t = int(input())
for _ in range(t):
	n = int(input())
	ans = ''
	if n % 2:
		ans = '7'
		n -= 3
		while n > 0:
			ans += '1'
			n -= 2
	else:
		ans = '1' * (n // 2)
	print(ans)


ms = 998244353
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for i in range(t):
	r = []
	tmp = a[i]
	ml = a[i] // 2
	if ml > ms:
		ml = ms
	for j in range(ml):
		M = tmp - (ml - (1 + j)) * 2
		if M >= 6:
			tmp -= 6
			r.append('9')
		elif M >= 3:
			tmp -= 3
			r.append('7')
		else:
			tmp -= 2
			r.append('1')
	print(''.join(r))


t = int(input())
num = [9, 8, 7, 5, 4, 1]
cost = [6, 7, 3, 5, 4, 2]
for _ in range(t):
	n = int(input())
	digits = n // 2
	ans = [0] * digits
	for d in range(digits - 1, -1, -1):
		for (x, c) in zip(num, cost):
			if 2 * d <= n - c <= 7 * d:
				n -= c
				ans[digits - d - 1] = x
				break
	print(*ans, sep='')


tc = int(input())
while tc:
	tc -= 1
	n = int(input())
	if n % 2:
		ans = '7'
		ans += '1' * int((n - 3) / 2)
		print(ans)
	else:
		print('1' * int(n / 2))


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	y = 0
	if n % 2:
		x -= 1
		y += 1
	s = []
	if y:
		s.append('7')
	s += ['1'] * x
	print(''.join(s))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = []
	b = ['7']
	if n == 2:
		print(1)
	elif n == 3:
		print(7)
	elif n % 2 == 0 and n > 2:
		for i in range(1, n + 1):
			if i % 2 == 0:
				a.append('1')
		print(''.join(a))
	elif n % 2 != 0 and n > 3:
		for i in range(1, n - 2):
			if i % 2 == 0:
				b.append('1')
		print(''.join(b))


import sys

def solution(n):
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))
for line in sys.stdin:
	t = int(line)
	break
for line in sys.stdin:
	n = int(line)
	solution(n)


t = int(input())
for _ in range(t):
	a = int(input())
	d = a // 2
	x = 0
	if a % 2 != 0:
		x = x * 10 + 7
		d = d - 1
		for _ in range(d):
			x = 10 * x + 1
		print(x)
	else:
		for _ in range(d):
			x = x * 10 + 1
		print(x)


from math import ceil
from math import factorial
from collections import *
from operator import itemgetter
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
n = ii()
for i in range(n):
	x = ii()
	y = 0
	s = ''
	while x > 0:
		if x == 3:
			x -= 3
			s += '7'
		else:
			s += '1'
			x -= 2
	print(''.join(s[::-1]))


t = int(input())
for x in range(t):
	n = int(input())
	rem = n % 2
	num = 0
	n = n // 2
	arr = ['1'] * n
	if rem == 1:
		arr[0] = '7'
	print(''.join(arr))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		ed = n // 2
		sem = 0
	else:
		ed = n // 2 - 1
		sem = 1
	print('7' * sem + '1' * ed)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 2 == 1:
		print(f'7', end='')
		a -= 3
	a = a // 2
	print('1' * a)


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	if n % 2:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


x = int(input())
for i in range(x):
	n = int(input())
	if n % 2 == 0:
		k = int(n / 2)
		ans = ''
		for i in range(k):
			ans += '1'
		print(ans)
	else:
		k = int(n / 2) - 1
		ans = '7'
		for i in range(k):
			ans += '1'
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	result = '1' * (n // 2)
	if n & 1:
		print(7, result[1:], sep='')
	else:
		print(result)


T = int(input())
for i in range(T):
	n = int(input())
	temp = n // 2
	ans = '1' * temp
	if n % 2 == 0:
		print(int(ans))
	else:
		print(int('7' + ans[1:]))


t = int(input())
for test in range(t):
	n = int(input())
	s = []
	k = n // 2
	r = n % 2
	if r == 0:
		s = [1] * k
	else:
		s = [7] + (k - 1) * [1]
	for i in range(len(s)):
		print(s[i], end='')
	print()


def solution(inp2):
	dp = [0 for i in range(inp2 + 1)]
	if inp2 % 2 == 0:
		string = ''
		for i in range(inp2 // 2):
			string = string + '1'
		return int(string)
	else:
		string = '7'
		for i in range((inp2 - 3) // 2):
			string = string + '1'
		return int(string)
input1 = int(input())
for i in range(input1):
	inp2 = int(input())
	print(solution(inp2))


t = int(input())
while t:
	n = int(input())
	s = str
	dic = {2: 1, 3: 7}
	if n % 2 != 0:
		print(7, end='')
		print('1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))
	t -= 1


def main():
	t = int(input())
	for i in range(t):
		N = int(input())
		if N & 1:
			print('7' + '1' * ((N - 3) // 2))
		else:
			print('1' * (N // 2))
main()


n = int(input())
l = []
for i in range(n):
	x = int(input())
	l.append(x)
for i in range(n):
	k = []
	while l[i] > 0:
		if l[i] % 2 == 1:
			k.append(7)
			l[i] = l[i] - 3
		else:
			k.append(1)
			l[i] = l[i] - 2
	for i in range(len(k)):
		print(k[i], end='')
	print('\n')


def k(c):
	return '11'

def ab():
	c = int(input())
	t = ''
	while c > 0:
		if c > 5:
			t = t + k(c)
			c = c - 4
		elif c == 5:
			t = t + str(7)
			t = t + str(1)
			c = c - 5
		elif c == 4:
			t = t + '11'
			c = c - 4
		elif c == 3:
			t = t + str(7)
			c = c - 3
		elif c == 2:
			t = t + str(1)
			c = c - 2
	t = sorted(t, reverse=True)
	for p in t:
		print(p, end='')
	print()
for i in range(0, int(input())):
	ab()


def bigl(d):
	if d % 2 == 0:
		print('1' * (d // 2))
	else:
		print('7' + '1' * int((d - 3) / 2))
q = int(input())
for i in range(q):
	d = int(input())
	bigl(d)


def f():
	n = int(input())
	c = n // 2
	if n % 2:
		print('7' + '1' * (c - 1))
	else:
		print('1' * c)
T = int(input())
for t in range(T):
	f()


n = int(input())
for i in range(n):
	a = int(input())
	number = list()
	if a % 2 != 0:
		number.append('7')
		a -= 3
	number += ['1'] * (a // 2)
	print(''.join(number))


n = int(input())

def out(case):
	seg2 = 0
	seg2 = int(case / 2)
	mod = case % 2
	if mod == 0:
		for i in range(seg2):
			print('1', end='')
	else:
		print('7', end='')
		for i in range(seg2 - 1):
			print('1', end='')
	print('')
for i in range(n):
	case = int(input())
	if case == 3:
		print('7')
	elif case == 2:
		print('1')
	else:
		out(case)


for i in range(int(input())):
	num = int(input())
	all_ = '7' * (num % 2)
	ones = '1' * (num // 2 - num % 2)
	print(all_ + ones)


n = int(input())
for t in range(n):
	ent = int(input())
	if ent % 2 == 0:
		saida = ''
		ent = ent / 2
		while ent != 0:
			saida += '1'
			ent -= 1
		print(saida)
	else:
		saida = '7'
		ent -= 3
		ent = ent // 2
		while ent != 0:
			saida += '1'
			ent -= 1
		print(saida)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	if n % 2 == 1:
		l.append('7')
		n = n - 3
	while n >= 2:
		l.append('1')
		n = n - 2
	s = ''
	for j in l:
		s += j
	print(s)


for _ in range(int(input())):
	n = int(input())
	if not n % 2:
		print('1' * (n // 2))
	else:
		ans = ''
		while n > 1:
			if n % 2:
				ans += '7'
				n -= 3
			else:
				ans += '1'
				n -= 2
		print(ans)


def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		(one, seven) = (0, 0)
		(max_num, cur_num) = (float('-inf'), 0)
		sevenMost = n // 3
		for i in range(sevenMost, -1, -1):
			cur_num = 0
			j = (n - i * 3) // 2
			cur_num = i + j
			if cur_num > max_num or (cur_num == max_num and i > seven):
				max_num = cur_num
				(one, seven) = (j, i)
		print('7' * seven + '1' * one)
main()


for _ in range(int(input())):
	dic = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
	n = int(input())
	s = ''

	def give(n):
		if n == 2:
			return '1'
		elif n == 3:
			return '7'
		elif n == 4:
			return '11'
		elif n == 5:
			return '71'
		elif n == 6:
			return '111'
		elif n == 7:
			return '711'
		else:
			return ''
	if n < 8:
		print(give(n))
	elif n % 2 == 1:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


t = int(input())
for _ in range(t):
	p = int(input())
	s = ''
	if p % 2 == 0:
		for k in range(p // 2):
			s += '1'
	else:
		s += '7'
		p -= 3
		for k in range(p // 2):
			s += '1'
	print(int(s))


gi = lambda : list(map(int, input().split()))
for _ in range(gi()[0]):
	(n,) = gi()
	if n & 1:
		print('7' + '1' * (n // 2 - 1))
	else:
		print('1' * (n // 2))


t = int(input())
for qwer in range(t):
	a = int(input())
	if a % 2 == 0:
		print('1' * (a // 2))
	else:
		print('7' + '1' * ((a - 3) // 2))


for _ in range(int(input())):
	n = int(input())
	n7 = n // 3
	n1 = n // 2
	(n2, n3) = (0, 0)
	if n % 3 == 2:
		n2 = 1
	if n % 2 == 1:
		n3 = 1
		n1 -= 1
	if n7 + n2 >= n1 + n3:
		print('7' * n7 + '1' * n2)
	else:
		print('7' * n3 + '1' * n1)


import math

def main():
	n = int(input())
	st = ''
	while n > 3:
		n -= 2
		st += '1'
	if n == 3:
		st = '7' + st
	else:
		st += '1'
	print(st)
t = int(input())
for i in range(t):
	main()


def solve(n, count, memo):
	sim = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n < 0:
		return -float('inf')
	elif n < 2 or count == 0:
		return 0
	else:
		if (n, count) not in memo:
			memo[n, count] = max([i + 10 * solve(n - sim[i], count - 1, memo) for i in range(10)])
		return memo[n, count]
t = int(input())
memo = {}
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		print('7' + '1' * ((n - 3) // 2))
	else:
		print('1' * (n // 2))


a = int(input())
for i in range(a):
	b = int(input())
	arr = [1 for i in range(b // 2 - 1)]
	if b % 2 == 1:
		arr.append(7)
	else:
		arr.append(1)
	arr = arr[::-1]
	print(''.join(map(str, arr)))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(1)
	else:
		ans = []
		if n % 2 == 1:
			n = n - 3
			ans.append('7')
		q = n // 2
		ans.append('1' * q)
		print(''.join(ans))


import sys
i = sys.stdin.buffer.readline
t = int(i())
while t:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		n -= 3
		print('7' + '1' * (n // 2))


t = int(input())
for _ in [0] * t:
	n = int(input())
	res = 0
	while n > 0:
		if n % 2 == 1:
			res = res * 10 + 7
			n -= 3
		else:
			res = res * 10 + 1
			n -= 2
	print(res)


import sys
q = int(input())
while q:
	n = int(input())
	s = ''
	while n:
		if n % 2 != 0:
			n -= 3
			s += '7'
		else:
			n -= 2
			s += '1'
	print(s)
	q -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	num = [1] * (n // 2)
	if n % 2 == 1:
		num[0] = 7
	num = ''.join(list(map(str, num)))
	print(num)


n = int(input())
l = list()
for i in range(n):
	x = int(input())
	if x % 2 == 0:
		l.append('1' * (x // 2))
	else:
		l.append('7' + '1' * ((x - 3) // 2))
for i in l:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	d = {6: 9, 2: 1, 3: 7}
	if n == 2:
		print(d[2])
	elif n == 3:
		print(d[3])
	elif n > 3 and n // 2 <= 998244353:
		if n % 2 == 0:
			print('1' * (n // 2))
		else:
			print('7' + '1' * (n // 2 - 1))
	else:
		a = n - 998244353 * 2
		j = a // 4
		print('9' * j + '7' * (a % 4) + '1' * (998244353 - a // 4 - a % 4))


k = int(input())
nums = []
for i in range(k):
	n = int(input())
	if not 2 <= n <= 10 ** 5:
		exit()
	if n % 2 == 0:
		s = ''
		for j in range(n // 2):
			s += '1'
		nums.append(int(s))
		continue
	if n % 2 == 1:
		s = '7'
		for j in range((n - 3) // 2):
			s += '1'
		nums.append(int(s))
		continue
[print(item) for item in nums]


def solve(n):
	if n == 3:
		return 7
	nr1 = n // 2
	nr7 = n % 2
	return 7 * nr7 * 10 ** (nr1 - 1) + int('1' * (nr1 - nr7))

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(solve(n))
main()


t = int(input())
for i in range(0, t):
	x = int(input())
	s = ''
	rem = x % 2
	s = (x - rem) // 2 * '1'
	if rem == 1:
		if len(s) > 1:
			s = '7' + s[1:]
		else:
			s = '7'
	print(int(s))


T = int(input())
for t in range(T):
	n = int(input())
	if n % 2 == 0:
		s = int(n / 2)
		str = ''
		for i in range(s):
			str += '1'
	else:
		str = ''
		str += '7'
		n = n - 3
		n = int(n / 2)
		for i in range(n):
			str += '1'
	print(str)


for _ in range(int(input())):
	curr = int(input())
	(d, r) = divmod(curr, 2)
	if r == 0:
		print('1' * d)
	else:
		print('7' + '1' * (d - 1))


t = int(input())
for ii in range(t):
	n = int(input())
	if n % 2 == 0:
		ans = ['1'] * (n // 2)
	else:
		ans = ['7'] + ['1'] * ((n - 3) // 2)
	print(''.join(ans))


[6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

def main():
	n = int(input())
	str = ''
	while n > 1:
		if n == 3:
			str += '7'
			n -= 3
		elif n >= 2:
			str += '1'
			n -= 2
		else:
			break
	print(str[::-1])
t = int(input())
for _ in range(t):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	m = n // 2
	if n % 2 == 0:
		print('1' * m)
	else:
		print('7' + '1' * (m - 1))


for i in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		k = n // 2 - 1
		print('7' + '1' * k)
	else:
		k = n // 2
		print('1' * k)


def main():
	for _ in range(int(input())):
		n = int(input())
		if n % 2 == 1:
			ret = '7' + '1' * (n // 2 - 1)
		else:
			ret = '1' * (n // 2)
		print(ret)
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 != 0:
		x = n - 3
		y = 7 * 10 ** (x // 2)
		z = (10 ** (x // 2) - 1) // 9
		print(y + z)
	else:
		print((10 ** (n // 2) - 1) // 9)


t = int(input())
for m in range(t):
	n = int(input())
	d = n // 2
	no = ''
	for i in range(d - 1):
		no += '1'
	if n % 2 == 1:
		no = '7' + no
	else:
		no += '1'
	print(no)


for _ in [0] * int(input()):
	s = []
	n = int(input())
	if n % 2 == 0:
		s = ['1' for i in range(n // 2)]
	else:
		s = ['7']
		for i in range(n // 2 - 1):
			s.append('1')
	print(''.join(map(str, s)))


sevseg = {2: 1, 3: 7, 5: 5, 7: 8}

def myprint(l):
	for i in l:
		print(i, end='')
	print()
t = int(input())
while t > 0:
	m = int(input())
	lst = []
	for k in sevseg.keys():
		n = m
		if n < k:
			lst.append([0])
			continue
		n -= k
		l = [sevseg[k]]
		while True:
			if n == 1 or n == 0:
				break
			n -= 2
			l.append(1)
		lst.append(l)
	for i in range(3):
		if len(lst[i]) > len(lst[i + 1]):
			myprint(lst[i])
			break
		if len(lst[i]) == len(lst[i + 1]):
			if lst[i][0] > lst[i + 1][0]:
				myprint(lst[i])
			else:
				myprint(lst[i + 1])
			break
	t -= 1


t = int(input())
for T in range(t):
	n = int(input())
	val = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	if n == 3:
		print(7)
		continue
	v = n
	add = ''
	if n % 2 == 1:
		v -= 3
		add = '7'
	ans = '1' * (v // 2)
	ans += add
	print(ans[::-1])


t = int(input())
while t:
	n = int(input())
	number = ''
	ton = int(n / 2)
	while ton:
		number += '1'
		ton -= 1
	z = ''
	if n % 2 == 1:
		z = '7'
		number = z + number[:-1]
	print(number)
	t -= 1


from sys import stdin, stdout

def main():
	t = int(input())
	for c in range(t):
		n = int(input())
		ans = ''
		if n % 2 == 0:
			for i in range(n // 2):
				ans += '1'
		elif n == 3:
			ans = '7'
		else:
			ans += '7'
			for i in range(1, n // 2):
				ans += '1'
		print(ans)
main()


for _ in [0] * int(input()):
	led = int(input())
	if led % 2 == 0:
		print('1' * (led // 2))
	else:
		print('7' + '1' * (led // 2 - 1))


z = input
from math import ceil, log, gcd, sqrt
n = int(z())
for i in range(n):
	led = {2: 1, 4: 4, 5: 5, 3: 7, 7: 8, 6: 9}
	x = int(z())
	if x % 2 == 0:
		t2 = '1' * (x // 2)
	else:
		t2 = '7' + '1' * ((x - 3) // 2)
	print(t2)


t = int(input())
for i in range(t):
	num = int(input())
	if num == 3:
		print(7)
	else:
		if num % 2 == 0:
			out = '1' * (num // 2)
		else:
			out = '7' + '1' * ((num - 3) // 2)
		print(out)


n = int(input())
for _ in range(n):
	m = int(input())
	s = '1'
	s1 = '7'
	if m % 2 == 0:
		print(s * (m // 2))
	else:
		print(s1 + s * ((m - 3) // 2))


t = int(input())
reqs = [4, 2, 5, 5, 4, 5, 6, 3, 7, 6]

def solve():
	n = int(input())
	best_len = int(n / 2)
	num = ['1' for i in range(best_len)]
	if n % 2 == 1:
		num[0] = '7'
	print(''.join(num))
for i in range(t):
	solve()


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	n = read_int()
	s = ''
	s += '1' * (n // 2 - 1)
	r = n % 2
	if r == 1:
		s = '7' + s
	else:
		s += '1'
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	r = n // 2
	arr = [1] * r
	d = n % 2
	if d == 1:
		arr[0] = 7
	ans = ''.join(map(str, arr))
	print(ans)


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	if n < 2:
		print('0')
	elif n == 3:
		print('7')
	else:
		k = n // 2
		if n % 2 == 1:
			print(7, end='')
			for i in range(k - 1):
				print(1, end='')
		else:
			for i in range(k):
				print(1, end='')
		print('')


from math import *
mod = 1000000007

def binpow(a, b):
	global mod
	if b == 1:
		return a % mod
	u = binpow(a, b // 2)
	if b % 2 == 0:
		return u * u % mod
	else:
		return u * u * a % mod

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print('7' + '1' * (n // 2 - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	ans = []
	while n > 0:
		if n % 2 != 0:
			ans.append(7)
			n -= 3
		else:
			ans.append(1)
			n -= 2
	ans.sort(reverse=True)
	largest = ''
	for i in ans:
		largest += str(i)
	print(int(largest))


import sys
from sys import stdin, stdout

def get_ints():
	return list(map(float, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
t = int(input())
a = [0] * int(t)
for i in range(0, t):
	a[i] = int(input())
	if a[i] == 3:
		stdout.write('7')
	elif a[i] % 2 == 0:
		for k in range(0, a[i], 2):
			stdout.write('1')
	else:
		stdout.write('7')
		for k in range(0, a[i] - 3, 2):
			stdout.write('1')
	stdout.write('\n')


test_cases = int(input())
for z in range(test_cases):
	n = int(input())
	if n % 2 == 0:
		print('1' * int(n // 2))
	elif n == 3:
		print('7')
	else:
		print('7' + '1' * int((n - 3) // 2))