num = int(input('输入:'))
s = str(num)
g = int(s[3])
si = int(s[2])
b = int(s[1])
q = int(s[0])
g1 = str(g*7)
si1 = str(si*7)
b1 = str(b*7)
q1 = str(q*7)
print(int(g1[-1])+int(si1[-1])*10+int(b1[-1])*100+int(q1[-1])*1000)
num = int(input('输入:'))
s = str(num)
g = int(s[3])
si = int(s[2])
b = int(s[1])
q = int(s[0])
g1 = str(g*7)
si1 = str(si*7)
b1 = str(b*7)
q1 = str(q*7)
print(int(g1[-1])+int(si1[-1])*10+int(b1[-1])*100+int(q1[-1])*1000)