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
32
33
a = input()
b = input()
def zmiana(a,b):
    if len(a) >= len(b):
        return a,b
    return b,a
def add(a,b):
    a,b = zmiana(a,b)
    q = len(b)
    next = 0
    i = -1
    result = ""
    while i >= -q:
        new = int(a[i]) + int(b[i]) + next
        next = 0
        if new > 9:
            next = 1
        result = str(new%10) + result 
        i -= 1
    if next == 0:
        return a[:i+1] + result
    w = len(a)
    while i >= -w:
        if a[i] != "9":
            result = str(int(a[i])+1) + result
            return a[:i] + result
        else:
            result = "0" + result
        i -= 1
    if i == -w-1:
        result = "1" + result
    return result
print(add(a,b))