You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
390 B
Python

def atoi(x):
if x == '':
return 0
else:
return int(x)
_ = int(input())
s = input()
n = len(s)
l = r = n // 2
while l >= 0 and s[l] == '0':
l -= 1
while r < n and s[r] == '0':
r += 1
if l == r:
print(min(atoi(s[:sp]) + atoi(s[sp:]) for sp in [n // 2, (n + 1) // 2]))
else:
print(min(atoi(s[:sp]) + atoi(s[sp:]) for sp in [l, r]))