1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
a = input()
b = input()

a = list(a[::-1])
b = list(b[::-1])

while len(a) < len(b):
    a.append("0")
while len(b) < len(a):
    b.append("0")

carry = 0
result = []

for i in range(len(a)):
    aa = int(a[i])
    bb = int(b[i])
    if aa + bb + carry >= 10:
        rest = aa + bb + carry - 10
        carry = 1
    else:
        rest = aa + bb + carry
        carry = 0
    result.append(str(rest))

if carry > 0:
    result.append(str(carry))

result = "".join(result[::-1])

print(result)