a, b = input(), input() a = ('0'*4999 + a)[-5000:] b = ('0'*4999 + b)[-5000:] a, b = int(a[:2000]) + int(b[:2000]), int(a[2000:]) + int(b[2000:]) if a == 0: print(b) exit() if len(str(b)) == 3001: a += int(str(b)[0]) b = int(str(b)[1:]) print(a, b, sep='')
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | a, b = input(), input() a = ('0'*4999 + a)[-5000:] b = ('0'*4999 + b)[-5000:] a, b = int(a[:2000]) + int(b[:2000]), int(a[2000:]) + int(b[2000:]) if a == 0: print(b) exit() if len(str(b)) == 3001: a += int(str(b)[0]) b = int(str(b)[1:]) print(a, b, sep='') |