Stepan has the newest electronic device with a display. Different digits can be shown on it. Each digit is shown on a seven-section indicator like it is shown on the picture below. [Image] 

So, for example, to show the digit 3 on the display, 5 sections must be highlighted; and for the digit 6, 6 sections must be highlighted. 

The battery of the newest device allows to highlight at most n sections on the display. 

Stepan wants to know the maximum possible integer number which can be shown on the display of his newest device. Your task is to determine this number. Note that this number must not contain leading zeros. Assume that the size of the display is enough to show any integer.


-----Input-----

The first line contains the integer n (2 ≤ n ≤ 100 000) — the maximum number of sections which can be highlighted on the display.


-----Output-----

Print the maximum integer which can be shown on the display of Stepan's newest device.


-----Examples-----
Input
2

Output
1

Input
3

Output
7

Difficulty: EASY
Tags: Greedy algorithms

Implementation

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
sections = int(input())
ones = int(sections / 2)
printSeven = False
if sections % 2 != 0:
	ones = ones - 1
	printSeven = True
if printSeven:
	print('7', end='')
print('1' * ones)


from math import *
n = int(input())
if n % 2 != 0:
	n -= 3
	print(7, end='')
i = 0
while i < n:
	i += 2
	print(1, end='')


energia = int(input())
if energia % 2 == 0:
	print(int('1' * (energia // 2)))
else:
	print(int('7' + '1' * (energia // 2 - 1)))


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


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


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	n = ii()
	ans = []
	while n:
		if n == 3:
			ans.append('7')
			n -= 3
		else:
			ans.append('1')
			n -= 2
	print(''.join(ans[::-1]))
	pass
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')
main()


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


n = int(input())
if n == 2:
	print(1)
elif n % 2 == 1:
	k = (n - 3) // 2
	print('7' + '1' * k)
else:
	print('1' * (n // 2))


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


inpt = int(input())
ans = ''
if inpt & 1 == 1:
	inpt = inpt - 3
	ans = '7'
ans += '1' * (inpt >> 1)
print(ans)


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


n = int(input())
ans = ''
if n % 2 != 0:
	ans += '7'
	n -= 3
while n >= 2:
	ans += '1'
	n -= 2
print(ans)


import sys

def getMultiLineInput() -> []:
	lines = []
	while True:
		try:
			lines.append(input())
		except EOFError:
			break
	return lines

def printResult(number: int):
	result = 0
	remained = number
	check = int(number / 2)
	remained = number % 2
	if remained == 1:
		check -= 1
		remained += 2
	list = []
	if check > 0:
		list = ['1'] * check
	if remained > 0:
		list.insert(0, '7')
	result = int(''.join(list))
	print(result)
inputs = getMultiLineInput()
number = int(inputs[0])
printResult(number)


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')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
n = int(input())
use = {2: 1, 3: 7, 4: 4, 5: 3, 6: 9, 7: 8}
if n == 2 or n == 3:
	print(use[n])
else:
	if n % 2 == 0:
		ans = '1' * (n // 2)
	else:
		ans = '7'
		n -= 3
		ans += '1' * (n // 2)
	print(ans)


n = int(input())
if n <= 3:
	if n == 3:
		mensaje = '7'
	if n == 2:
		mensaje = '1'
elif n <= 7:
	if n == 4:
		mensaje = '11'
	if n == 5:
		mensaje = '71'
	if n == 6:
		mensaje = '111'
	if n == 7:
		mensaje = '711'
else:
	a = n // 2
	if n % 2 == 0:
		mensaje = '1' * a
	else:
		mensaje = '7' + '1' * (a - 1)
print(mensaje)


import sys
input = sys.stdin.readline
n = int(input())
if n < 100:
	dp = [0] * (n + 1)
	for sec in range(2, n + 1):
		dp[sec] = dp[sec - 1]
		for (val, cost) in ((9, 6), (8, 7), (7, 3), (5, 5), (4, 4), (1, 2)):
			if sec - cost >= 0:
				new_val = dp[sec - cost] * 10 + val
				dp[sec] = max(dp[sec], new_val)
	print(dp[-1])
elif n % 2 == 0:
	print('1' * (n // 2))
else:
	print('7' + '1' * ((n - 3) // 2))


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


n = int(input())
if n % 2:
	print(7, end='')
	print('1' * ((n - 3) // 2))
else:
	print('1' * (n // 2))


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


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


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
from itertools import accumulate
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
ans = '1' * (n // 2)
n = n % 2
if n == 1:
	ans = ans[:-1]
	ans += '7'
print(ans[::-1])


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


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


n = int(input())
ans = '1' * (n // 2)
if n % 2 == 1:
	ans = '7' + ans[1:]
print(ans)


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


n = int(input())
(a, b) = (n // 2, n % 2)
if b == 0:
	print('1' * a)
else:
	print('7' + '1' * (a - 1))


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


import bisect
import heapq
import math
import collections
import sys
import copy
from functools import reduce
import decimal
from io import BytesIO, IOBase
import os
sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque

class Graphs:

	def __init__(self):
		self.graph = graphDict(set)

	def add_edge(self, u, v):
		self.graph[u].add(v)
		self.graph[v].add(u)

	def delEdge(self, u, v):
		for ii in range(len(self.graph[u])):
			if self.graph[u][ii] == v:
				self[u].remove(v)
				break
		for ii in range(len(self[v])):
			if self[v][ii] == u:
				self[v].pop(i)
				break

	def dfs_utility(self, nodes, visited_nodes):
		visited_nodes.add(nodes)
		print(nodes, end='')
		for neighbour in self.graph[nodes]:
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes)

	def dfs(self, node):
		Visited = set()
		self.dfs_utility(node, Visited)

	def bfs(self, node):
		visited = set()
		if node not in visited:
			queue.append(node)
			visited.add(node)
		while queue:
			parent = queue.popleft()
			print(parent)
			for item in self.graph[parent]:
				if item not in visited:
					queue.append(item)
					visited.add(item)

class Tree:

	def __init__(self, data):
		self.data = data
		self.left = None
		self.right = None

def inorder(node):
	if node:
		inorder(node.left)
		print(node.data)
		inorder(node.right)

def leaf_node_sum(root):
	if root is None:
		return 0
	if root.left is None and root.right is None:
		return root.data
	return leaf_node_sum(root.left) + leaf_node_sum(root.right)

def hight(root):
	if root is None:
		return -1
	if root.left is None and root.right is None:
		return 0
	return max(hight(root.left), hight(root.right)) + 1

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

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)))
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))

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

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))
n = int(inp())
if n & 1:
	print('7' + '1' * (n // 2 - 1))
else:
	print('1' * (n // 2))


def main():
	n = int(input())
	if n % 2 == 0:
		print('1' * (n // 2))
	else:
		print(7, end='')
		if n > 3:
			print('1' * (n // 2 - 1))
main()


n = int(input())
print('17'[n & 1] + '1' * (n // 2 - 1))


import sys
n = int(sys.stdin.readline())
s = ''
if n % 2 == 1:
	n -= 3
	s = '7'
for i in range(0, n, 2):
	s += '1'
print(s)


n = int(input())
k1 = n // 2
k2 = n // 3
if k1 != k2:
	if n % 2 == 0:
		for i in range(0, k1):
			print(1, end='')
	else:
		print(7, end='')
		for i in range(1, k1):
			print(1, end='')
else:
	for i in range(0, k1):
		print(7, end='')


c = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
n = int(input())
for i in range(len(c)):
	c[i] = [c[i], i]
c = sorted(c)
s = ''
for i in range(len(c)):
	l = n % c[i][0]
	if l != 1:
		k = n // c[i][0]
		s += str(c[i][1]) * k
		n = l
	elif l == 1:
		k = n // c[i][0] - 1
		s += str(c[i][1]) * k
		n = l + c[i][0]
s = list(s)
s.reverse()
print(''.join(s))


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


n = int(input())
for i in range(n):
	if n % 2 == 0 and n != 0:
		print(1, end='')
		n = n - 2
	elif n % 2 != 0 and n != 0:
		print(7, end='')
		n = n - 3


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


n = int(input())
cnt = n // 6
n = n % 6
ans = ''
if n == 5:
	ans += '71'
if n == 4:
	ans += '11'
if n == 3:
	ans += '7'
if n == 2:
	ans += '1'
if n == 1:
	cnt = cnt - 1
	ans += '711'
while cnt > 0:
	ans += '111'
	cnt = cnt - 1
print(ans)


from collections import Counter
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')
n = int(input())
if n == 2:
	print(1)
elif n == 3:
	print(7)
elif n == 5:
	print(71)
elif n % 2 == 0:
	print('1' * (n // 2))
else:
	print('7' + '1' * ((n - 3) // 2))


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


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


n = int(input())
s = ''
if n % 2 == 1:
	s = s + '7'
	n = n - 2
from math import *
for i in range(0, floor(n / 2)):
	s = s + '1'
print(s)


n = int(input())
if n % 2 == 0:
	n = n // 2
	while n:
		print('1', end='')
		n -= 1
else:
	n -= 1
	n = n // 2
	ans_ = []
	while n:
		ans_.append('1')
		n -= 1
	ans_[0] = '7'
	print(''.join(ans_))


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


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


n = 0
one = 0
seven = 0
i = 0
j = 0
n = int(input())
if n % 2 == 0:
	for i in range(1, n // 2 + 1):
		print('1', end='')
else:
	print('7', end='')
	n = n - 3
	while n > 1:
		print('1', end='')
		n = n - 2


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	c = ''
	if n % 2 == 1:
		c = '7'
		n -= 3
	c += '1' * (n // 2)
	print(c)
main()


from sys import stdin, stdout, maxsize
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
d = {6: 9, 2: 1, 5: 5, 4: 4, 3: 7, 7: 8}
d2 = {2: 1, 3: 7}
n = I()
t = n
(s1, s2) = ('', '')
while n >= 2:
	s1 += str(d[2])
	n -= 2
c = 0
while t >= 2:
	if c >= 1:
		s2 += str(d[2])
		t -= 2
	else:
		if t > 2:
			s2 += str(d[3])
			t -= 3
		else:
			s2 += str(d[2])
			t -= 2
		c += 1
if len(s1) > len(s2):
	print(s1)
else:
	print(s2)


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


n = int(input())
ma = {1: 0, 2: 1, 3: 7, 4: 7, 5: 7, 6: 9, 7: 9, 0: 0}
x = n // 2
y = n % 2
if n % 2:
	ans = '7' + '1' * (x - 1)
else:
	ans = '1' * x
print(ans)


from sys import stdin, stdout, maxsize
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
n = I()
if n % 2:
	print('7' + '1' * ((n - 3) // 2))
else:
	print('1' * (n // 2))


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


def solve():
	d = {0: 6, 1: 2, 2: 5, 3: 6, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
	n = int(input())
	r = ''
	while n > 0:
		if n == 3:
			r = '7' + r
			n -= 3
		else:
			r += '1'
			n -= 2
	print(r)
solve()


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
if n % 2 == 0:
	print('1' * (n // 2))
else:
	n -= 3
	print('7', '1' * (n // 2), sep='')


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


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


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())
n = ii()
print('7' + (n - 3) // 2 * '1' if n & 1 else n // 2 * '1')


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