Dima worked all day and wrote down on a long paper strip his favorite number $n$ consisting of $l$ digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf.

To solve the issue, Dima decided to split the strip into two non-empty parts so that each of them contains a positive integer without leading zeros. After that he will compute the sum of the two integers and write it down on a new strip.

Dima wants the resulting integer to be as small as possible, because it increases the chances that the sum will fit it in the bookshelf. Help Dima decide what is the minimum sum he can obtain.


-----Input-----

The first line contains a single integer $l$ ($2 \le l \le 100\,000$) — the length of the Dima's favorite number.

The second line contains the positive integer $n$ initially written on the strip: the Dima's favorite number.

The integer $n$ consists of exactly $l$ digits and it does not contain leading zeros. Dima guarantees, that there is at least one valid way to split the strip.


-----Output-----

Print a single integer — the smallest number Dima can obtain.


-----Examples-----
Input
7
1234567

Output
1801

Input
3
101

Output
11



-----Note-----

In the first example Dima can split the number $1234567$ into integers $1234$ and $567$. Their sum is $1801$.

In the second example Dima can split the number $101$ into integers $10$ and $1$. Their sum is $11$. Note that it is impossible to split the strip into "1" and "01" since the numbers can't start with zeros.

Difficulty: MEDIUM
Tags: String algorithms

Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
L = int(input())
D = input()
s = 0
b = 42069666
for c in range(1, L):
	if D[c] != '0':
		if abs(L / 2 - c) < b:
			b = abs(L / 2 - c)
			s = c

def c(s):
	if s == '':
		return 0
	return int(s)
res = c(D[:s]) + c(D[s:])
if L % 2:
	r = L // 2
	if D[r] != '0':
		res = min(c(D[:r]) + c(D[r:]), res)
	if D[r + 1] != '0':
		res = min(c(D[:r + 1]) + c(D[r + 1:]), res)
print(res)


l = int(input())
n = input()
itr = l // 2 + l % 2
itr2 = itr - 1
while itr < l and n[itr] == '0':
	itr += 1
while n[itr2] == '0':
	itr2 -= 1
(x, y) = (itr - l // 2 - l % 2, l // 2 - itr2)
if x == y:
	p = n[0:itr]
	q = n[itr2:itr] + n[0:itr2]
	if int(p) > int(q):
		(a, b) = (n[0:itr2], n[itr2:l])
	else:
		(a, b) = (n[0:itr], n[itr:l])
elif x > y:
	(a, b) = (n[0:itr2], n[itr2:l])
else:
	(a, b) = (n[0:itr], n[itr:l])
print(int(a) + int(b))


l = int(input())
n = input()
res = int(n)
toCheck = [l // 2, (l + 1) // 2]
while toCheck[0] > 1 and n[toCheck[0]] == '0':
	toCheck[0] -= 1
while toCheck[1] < l - 1 and n[toCheck[1]] == '0':
	toCheck[1] += 1
for pos in toCheck:
	v1 = n[:pos]
	v2 = n[pos:]
	if v1[0] != '0' and v2[0] != '0':
		res = min(res, int(v1) + int(v2))
print(res)


(l, s) = (int(input()), input())
ans = int(s)

def check(a, b):
	b = b[::-1]
	(b, a) = (list(b), list(a))
	while len(b) and b[-1] == '0':
		b.pop()
		a.append('0')
	if not len(b):
		return
	b = b[::-1]
	b = ''.join(b)
	a = ''.join(a)
	global ans
	ans = min(ans, int(a) + int(b))

def check2(a, b):
	b = b[::-1]
	a = list(a)
	b = list(b)
	while len(a) and a[-1] == '0':
		a.pop()
		b.append('0')
	if len(a) <= 1:
		return
	b.append(a.pop())
	a = ''.join(a)
	b = ''.join(b)
	b = b[::-1]
	global ans
	ans = min(ans, int(a) + int(b))
check(s[:l // 2], s[l // 2:])
check2(s[:l // 2], s[l // 2:])
if l >= 3:
	check(s[:l // 2 + 1], s[l // 2 + 1:])
	check2(s[:l // 2 + 1], s[l // 2 + 1:])
print(ans)


n = int(input())
s = input()
a = int(s)
for k in range(-1, 2):
	if n // 2 + k >= 0 and n // 2 + k < n:
		for i in range(max(1, n // 2 + k), n):
			if s[i] != '0':
				a = min(a, int(s[i:]) + int(s[:i]))
				break
		for i in range(n // 2 + k, 0, -1):
			if s[i] != '0':
				a = min(a, int(s[i:]) + int(s[:i]))
				break
print(a)


n = int(input())
s = input()
best = []
b = 10 ** 9
for i in range(n - 1):
	if s[i + 1] == '0':
		continue
	x = max(i + 1, n - i - 1)
	if x < b:
		best = []
		b = x
	if x == b:
		best.append(i + 1)
res = int(s)
for i in best:
	res = min(res, int(s[0:i]) + int(s[i:]))
print(res)


l = int(input())
n = input()
ans = int('1' + '0' * 10 ** 5)
if l % 2 == 0:
	k = l // 2
	left = k
	while n[left] == '0':
		left -= 1
	right = k
	while right < l and n[right] == '0':
		right += 1
	if left > 0:
		ans = min(int(n[:left]) + int(n[left:]), ans)
	if right < l:
		ans = min(int(n[:right]) + int(n[right:]), ans)
else:
	for k in range(l // 2, l // 2 + 2):
		left = k
		while n[left] == '0':
			left -= 1
		right = k
		while right < l and n[right] == '0':
			right += 1
		if left > 0:
			ans = min(int(n[:left]) + int(n[left:]), ans)
		if right < l:
			ans = min(int(n[:right]) + int(n[right:]), ans)
print(ans)


l = int(input())
n = input()
m = int(l / 2)
cand1 = int(n)
for i in range(m + 1, l):
	if not n[i] == '0':
		left = int(n[:i])
		right = int(n[i:])
		cand1 = min(left + right, cand1)
		break
for i in range(m, 0, -1):
	if not n[i] == '0':
		left = int(n[:i])
		right = int(n[i:])
		cand1 = min(left + right, cand1)
		break
print(cand1)


n = int(input())
s = input()
k = int(s)
res = k
c = 0
for i in range(max(n // 2 - 2, 0), n):
	if s[i] == '0':
		continue
	x = k // 10 ** (n - i)
	y = k % 10 ** (n - i)
	res = min(res, x + y)
	c += 1
	if c == 3:
		break
c = 0
for i in range(min(n - 1, n // 2 + 2), 0, -1):
	if s[i] == '0':
		continue
	x = k // 10 ** (n - i)
	y = k % 10 ** (n - i)
	res = min(res, x + y)
	c += 1
	if c == 3:
		break
print(res)


n = int(input())
s = input()
print(min((int(s[:i]) + int(s[i:]) for i in sorted((i for i in range(1, n) if s[i] != '0'), key=lambda i: abs(i - n / 2))[:4])))


n = int(input())
s = input()
ans = 10 ** 100005
idx = n // 2
for i in range(idx, n):
	if s[i] != '0':
		ans = int(s[i:]) + int(s[:i])
		break
for i in range(idx + 1, 0, -1):
	if idx + 1 < n and s[i] != '0':
		ans = min(ans, int(s[i:]) + int(s[:i]))
		break
print(ans)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
l = int(input())
n = input()
ans = float('inf')
if l % 2 == 0:
	mid = l // 2
	r = mid
	l = mid
	while True:
		if n[r] != '0':
			ans = min(ans, int(n[:r]) + int(n[r:]))
		if n[l] != '0':
			ans = min(ans, int(n[:l]) + int(n[l:]))
		if ans != float('inf'):
			print(ans)
			break
		r += 1
		l -= 1
else:
	mid = l // 2
	r = mid + 1
	l = mid
	while True:
		if n[r] != '0':
			ans = min(ans, int(n[:r]) + int(n[r:]))
		if n[l] != '0':
			ans = min(ans, int(n[:l]) + int(n[l:]))
		if ans != float('inf'):
			print(ans)
			break
		r += 1
		l -= 1


n = int(input())
l = input()
arr = []
for i in range(len(l)):
	if l[i] != '0':
		arr.append((abs(n // 2 - i), i))
arr.sort()
ans = 10 ** 100001
for i in range(min(4, len(arr))):
	if arr[i][1] == 0:
		continue
	ans = min(ans, int(l[arr[i][1]:]) + int(l[:arr[i][1]]))
print(ans)


n = int(input())
mstr = str(input())
a = 0
b = int(mstr)
ans = 2 * b
i = 0
p = len(mstr)
l = len(mstr)
while mstr[p - 1] == '0':
	p = p - 1
id = int(l / 2)
clr = id + 1
cll = id
while clr < l and mstr[clr] == '0':
	clr = clr + 1
while cll > 0 and mstr[cll] == '0':
	cll = cll - 1
if clr < l:
	ans = min(ans, int(mstr[0:clr]) + int(mstr[clr:l]))
if cll > 0:
	ans = min(ans, int(mstr[0:cll]) + int(mstr[cll:l]))
print(ans)


l = int(input())
s = input()
k = l // 2
ans = int(s)
while k > 0:
	if s[k] == '0':
		k = k - 1
	else:
		ans = min(ans, int(s[:k]) + int(s[k:]))
		break
k = l // 2 + 1
while k < l:
	if s[k] == '0':
		k = k + 1
	else:
		ans = min(ans, int(s[:k]) + int(s[k:]))
		break
print(ans)


import math
n = int(input())
k = input()

def st(s):
	if s == '':
		return 0
	return int(s)

def cal(pos):
	if k[pos] == '0':
		return 1 << 400000
	return st(k[:pos]) + st(k[pos:])
mid_L = (n + 1) // 2
mid_R = n // 2
sum = -1
while k[mid_L] == k[mid_R] == '0':
	mid_L -= 1
	mid_R += 1
sum = min(cal(mid_L), cal(mid_R))
print(sum)


def string_sum(str1, str2):
	if len(str1) > len(str2):
		t = str1
		str1 = str2
		str2 = t
	str = ''
	n1 = len(str1)
	n2 = len(str2)
	str1 = str1[::-1]
	str2 = str2[::-1]
	carry = 0
	for i in range(n1):
		sum = ord(str1[i]) - 48 + (ord(str2[i]) - 48 + carry)
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	for i in range(n1, n2):
		sum = ord(str2[i]) - 48 + carry
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	if carry:
		str += chr(carry + 48)
	str = str[::-1]
	return str
l = int(input())
n = input()
if 1:
	res = 0
	s1 = ''
	s2 = ''
	n1 = str(n)
	cnt = 0
	for i in range(0, l // 2):
		s1 += n1[i]
	for i in range(l // 2, l):
		s2 += n1[i]
	if s2[0] != '0':
		res = string_sum(s1, s2)
	for i in s2:
		if i == '0':
			cnt += 1
		else:
			break
	res1 = 0
	if s2[cnt:] != '':
		res1 = string_sum(s1 + s2[:cnt], s2[cnt:])
	if res != 0 and res1 != 0:
		if len(res) < len(res1):
			res = res
		elif len(res) > len(res1):
			res = res1
		else:
			res = min(res, res1)
	elif res1 != 0:
		res = res1
	id1 = 0
	res2 = 0
	if 1:
		for i in range(len(s1)):
			if s1[i] != '0':
				id = i
		temp = ''
		for i in range(id, len(s1)):
			temp += s1[i]
		s2 = temp + s2
		temp = ''
		for i in range(0, id):
			temp += s1[i]
		s1 = temp
		res2 = 0
		if s1 != '' and s2 != '' and (s2[0] != '0'):
			res2 = string_sum(s1, s2)
	if res != 0 and res2 != 0:
		if len(res) < len(res2):
			res = res
		elif len(res) > len(res2):
			res = res2
		else:
			res = min(res, res2)
	elif res2 != 0:
		res = res2
	if l % 2 != 0:
		s1 = ''
		s2 = ''
		n1 = str(n)
		cnt = 0
		for i in range(0, l // 2 + 1):
			s1 += n1[i]
		for i in range(l // 2 + 1, l):
			s2 += n1[i]
		if s2[0] != '0' and res != 0:
			temp = string_sum(s1, s2)
			if len(res) < len(temp):
				res = res
			elif len(res) > len(temp):
				res = temp
			else:
				res = min(res, temp)
		for i in s2:
			if i == '0':
				cnt += 1
			else:
				break
		res1 = 0
		if s2[cnt:] != '':
			res1 = string_sum(s1 + s2[:cnt], s2[cnt:])
		if res != 0 and res1 != 0:
			if len(res) < len(res1):
				res = res
			elif len(res) > len(res1):
				res = res1
			else:
				res = min(res, res1)
		elif res1 != 0:
			res = res1
		id1 = 0
		res2 = 0
		if 1:
			for i in range(len(s1)):
				if s1[i] != '0':
					id = i
			temp = ''
			for i in range(id, len(s1)):
				temp += s1[i]
			s2 = temp + s2
			temp = ''
			for i in range(0, id):
				temp += s1[i]
			s1 = temp
			res2 = 0
			if s1 != '' and s2 != '' and (s2[0] != '0'):
				res2 = string_sum(s1, s2)
		if res != 0 and res2 != 0:
			if len(res) < len(res2):
				res = res
			elif len(res) > len(res2):
				res = res2
			else:
				res = min(res, res2)
		elif res2 != 0:
			res = res2
	print(res)


n = int(input())
s = input()
l = int(n / 2)
r = int((n + 1) / 2)
while l and s[l] == '0':
	l -= 1
while r != n - 1 and s[r] == '0':
	r += 1
if l == 0 or r == n - 1:
	if l == 0:
		ans = int(s[:r]) + int(s[r:])
	else:
		ans = int(s[:l]) + int(s[l:])
else:
	ans = min(int(s[:l]) + int(s[l:]), int(s[:r]) + int(s[r:]))
print(ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def findSum(str1, str2):
	if len(str1) > len(str2):
		temp = str1
		str1 = str2
		str2 = temp
	str3 = ''
	n1 = len(str1)
	n2 = len(str2)
	diff = n2 - n1
	carry = 0
	for i in range(n1 - 1, -1, -1):
		sum = ord(str1[i]) - ord('0') + int(ord(str2[i + diff]) - ord('0')) + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	for i in range(n2 - n1 - 1, -1, -1):
		sum = ord(str2[i]) - ord('0') + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	if carry:
		str3 += str(str(carry))
	str3 = str3[::-1]
	return str3

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		a = list(rs())
		mid = n // 2
		if n % 2 == 0:
			mid -= 1
		i = mid
		while i >= 0:
			if a[i + 1] == '0':
				i -= 1
			else:
				break
		doosra1 = a[i + 1:]
		pehla1 = a[:i + 1]
		i = mid
		while i < n - 1:
			if a[i + 1] == '0':
				i += 1
			else:
				break
		doosra2 = a[i + 1:]
		pehla2 = a[:i + 1]
		z = []
		if len(pehla1) != 0:
			z.append([pehla1, doosra1])
		if len(doosra2) != 0:
			z.append([pehla2, doosra2])
		if len(pehla1) == len(pehla2):
			npehla1 = pehla1 + [doosra1[0]]
			ndoosra1 = doosra1[1:]
			npehla2 = pehla2[:len(pehla2) - 1]
			ndoosra2 = [pehla2[len(pehla2) - 1]] + doosra2
			if len(npehla1) > 0 and len(ndoosra1) > 0 and (ndoosra1[0] != '0'):
				z.append([npehla1, ndoosra1])
			if len(npehla2) > 0 and len(ndoosra2) > 0 and (ndoosra2[0] != '0'):
				z.append([npehla2, ndoosra2])
		m = '9' * 100005
		for i in z:
			k = findSum(''.join(i[0]), ''.join(i[1]))
			if len(k) < len(m):
				m = k
			if len(k) == len(m):
				m = min(m, k)
		print(m)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
l = str(input())

def summ(l1, l2):
	l1.reverse()
	l2.reverse()
	n_ = max(len(l1), len(l2))
	k = n_ - min(len(l1), len(l2))
	l1.extend(['0'] * k)
	l2.extend(['0'] * k)
	l3 = []
	re = 0
	for i in range(n_):
		x = int(l1[i]) + int(l2[i]) + re
		l3.append(x % 10)
		re = x // 10
	if re == 1:
		l3.append(re)
	l3.reverse()
	kq = ''
	for i in l3:
		kq += str(i)
	return kq

def com(r1, r2):
	g = len(r1)
	h = len(r2)
	if g > h:
		return r2
	elif h > g:
		return r1
	else:
		for i in range(g):
			if int(r1[i]) == int(r2[i]):
				continue
			elif int(r1[i]) < int(r2[i]):
				return r1
			elif int(r1[i]) > int(r2[i]):
				return r2
		return r1
if n % 2 == 0:
	l1 = list(l[:n // 2])
	l2 = list(l[n // 2:])
	if l2[0] != '0':
		print(summ(l1, l2))
	elif l2[0] == '0':
		inde = n // 2
		q = '9' * n
		kq_ = '9' * n
		for i in range(n // 2, n):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2:
			l2 = list(l[inde:])
			l1 = list(l[:inde])
			q = summ(l1, l2)
		inde = n // 2
		for i in range(n // 2, 0, -1):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2:
			l2 = list(l[inde:])
			l1 = list(l[:inde])
			kq_ = summ(l1, l2)
		print(com(q, kq_))
else:
	l1 = list(l[:n // 2])
	l2 = list(l[n // 2:])
	r1 = '9' * n
	r2 = '9' * n
	fi = '9' * n
	se = '9' * n
	if l2[0] != '0':
		r1 = summ(l1, l2)
	elif l2[0] == '0':
		inde = n // 2
		kq = '9' * n
		kq_ = '9' * n
		for i in range(n // 2, n):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2:
			l2 = list(l[inde:])
			l1 = list(l[:inde])
			kq = summ(l1, l2)
		inde = n // 2
		for i in range(n // 2, 0, -1):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2:
			l2 = list(l[inde:])
			l1 = list(l[:inde])
			kq_ = summ(l1, l2)
		fi = com(kq, kq_)
	v1 = list(l[:n // 2 + 1])
	v2 = list(l[n // 2 + 1:])
	if v2[0] != '0':
		r2 = summ(v1, v2)
	elif v2[0] == '0':
		inde = n // 2 + 1
		kq = '9' * n
		kq_ = '9' * n
		for i in range(n // 2 + 1, n):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2 + 1:
			v2 = list(l[inde:])
			v1 = list(l[:inde])
			kq = summ(v1, v2)
		inde = n // 2 + 1
		for i in range(n // 2 + 1, 0, -1):
			if l[i] != '0':
				inde = i
				break
		if inde != n // 2 + 1:
			v2 = list(l[inde:])
			v1 = list(l[:inde])
			kq_ = summ(v1, v2)
		se = com(kq, kq_)
	r1 = com(r1, r2)
	r1 = com(r1, fi)
	r1 = com(r1, se)
	print(r1)


def do(s, j):
	return int(s[:j]) + int(s[j:])

def main():
	n = int(input())
	x = input()
	mid = n // 2
	cnt = 0
	best = None
	for i in range(mid + 2):
		j = mid + i
		if j < n and x[j] != '0':
			val = do(x, j)
			cnt += 1
			if best is None:
				best = val
			else:
				best = min(best, val)
		j = mid - i
		if j > 0 and x[j] != '0':
			val = do(x, j)
			cnt += 1
			if best is None:
				best = val
			else:
				best = min(best, val)
		if cnt >= 7:
			break
	print(best)

def __starting_point():
	main()
__starting_point()


import collections
l = int(input())
n = input()
i = l // 2
if not l % 2 and n[i] != '0':
	print(int(n[:i]) + int(n[i:]))
else:
	j = i + 1
	while n[i] == '0':
		i -= 1
	while j < l and n[j] == '0':
		j += 1
	if i > 0 and j < l - 1:
		print(min(int(n[:i]) + int(n[i:]), int(n[:j]) + int(n[j:])))
	elif not i:
		print(int(n[:j]) + int(n[j:]))
	else:
		print(int(n[:i]) + int(n[i:]))


n = int(input())
s = '0' + input()
n += 1
ind = n // 2
ans = []
i = c = 0
while ind - i > 0 and ind + i < n:
	if s[ind + i] != '0':
		ans.append(int(s[:ind + i]) + int(s[ind + i:]))
		c += 1
	if s[ind - i] != '0':
		ans.append(int(s[:ind - i]) + int(s[ind - i:]))
		c += 1
	i += 1
	if c > 4:
		break
if n == 3 and s[2] != '0':
	ans.append(int(s[1]) + int(s[2]))
print(min(ans))


l = int(input())
s = input()
r = int(s)
(x, y) = (-1, -1)
for i in range(0, l // 2):
	if s[i + 1] != '0':
		x = i
for i in range((l + 1) // 2, l):
	if s[i] != '0':
		y = i
		break
if x != -1:
	r = min(r, int(s[:x + 1]) + int(s[x + 1:]))
if y != -1:
	r = min(r, int(s[:y]) + int(s[y:]))
print(r)


l = int(input())
s = input()
i = l // 2
j = i + 1
while i > 1 and s[i] == '0':
	i -= 1
while j < l - 1 and s[j] == '0':
	j += 1
a = int(s[:i]) + int(s[i:])
b = int(s[:j]) + int(s[j:])
if s[i] == '0':
	print(b)
elif s[j] == '0':
	print(a)
else:
	print(min(a, b))


import sys
l = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
mid = l // 2

def getz(a, dr, ed):
	for i in range(a, ed, dr):
		if s[i] != '0':
			return i
	return -1
if l % 2 == 0:
	sp1 = getz(mid - 1, -1, 0)
	sp2 = getz(mid, 1, l)
else:
	sp1 = getz(mid, -1, 0)
	sp2 = getz(mid + 1, 1, l)
if sp1 < 0:
	print(int(s[0:sp2]) + int(s[sp2:]))
elif sp2 < 0:
	print(int(s[0:sp1]) + int(s[sp1:]))
else:
	print(min(int(s[0:sp1]) + int(s[sp1:]), int(s[0:sp2]) + int(s[sp2:])))


n = int(input())
m = n // 2
l = input()
i = m + 1
j = m
while i < n and l[i] == '0':
	i = i + 1
while j >= 0 and l[j] == '0':
	j = j - 1
if i == n:
	print(int(l[0:j]) + int(l[j:n]))
elif j == 0:
	print(int(l[0:i]) + int(l[i:n]))
else:
	print(min(int(l[0:i]) + int(l[i:n]), int(l[0:j]) + int(l[j:n])))


def getnumber(A, a):
	return int(int(A[a + 1:]) + int(A[:a + 1]))
n = int(input())
A = input()
k = n // 2 - 1
if n % 2 == 0:
	a = k
	if A[k + 1] == '0':
		while A[k + 1] == '0' and k < n - 2:
			k += 1
		while A[a + 1] == '0' and a >= 0:
			a -= 1
		if A[k + 1] != '0' and a != -1:
			print(min(getnumber(A, k), getnumber(A, a)))
		elif A[k + 1] != '0' and a == 0:
			print(getnumber(A, k))
		elif A[k + 1] == '0' and a != -1:
			print(getnumber(A, a))
		else:
			print(A)
	else:
		print(getnumber(A, k))
else:
	k = k + 1
	if A[k + 1] != '0' and A[k] != '0':
		print(min(getnumber(A, k), getnumber(A, k - 1)))
	elif A[k + 1] != '0':
		print(getnumber(A, k))
	elif A[k] != '0':
		print(getnumber(A, k - 1))
	else:
		a = k - 1
		while A[k + 1] == '0' and k < n - 2:
			k += 1
		while A[a + 1] == '0' and a >= 0:
			a -= 1
		if A[k + 1] != '0' and a != -1:
			print(min(getnumber(A, k), getnumber(A, a)))
		elif A[k + 1] != '0' and a == -1:
			print(getnumber(A, k))
		elif A[k + 1] == '0' and a != -1:
			print(getnumber(A, a))
		else:
			print(A)


n = int(input())
s = str(input())
ans = int(s)
mid = n // 2
for i in range(mid, -1, -1):
	if s[i + 1] == '0':
		continue
	ans = min(ans, int(s[:i + 1]) + int(s[i + 1:n]))
	break
for i in range(mid, n - 1):
	if s[i] == '0':
		continue
	ans = min(ans, int(s[:i]) + int(s[i:n]))
	break
print(ans)


from sys import stdin
input = stdin.readline
n = int(input())
s = input()
m = 10 ** 10 ** 5
p = []
for i in range(n // 2, 0, -1):
	if s[i] == '0':
		continue
	p.append(i)
	break
for i in range(n // 2 + 1, n):
	if s[i] == '0':
		continue
	p.append(i)
	break
for i in p:
	m = min(m, int(s[i:]) + int(s[:i]))
print(m)


def main():
	length = int(input(''))
	number = input('')
	sol = half(number, length, 0, 0)
	if sol != None:
		print(int(sol[0]) + int(sol[1]))

def half(number, length, target, i):
	if target == 0:
		target = length // 2
	fHalf = number[:target]
	lHalf = number[target:]
	while lHalf[0] == '0':
		if i % 2 == 0:
			target = target - i
		else:
			target = target + i
		fHalf = number[:target]
		lHalf = number[target:]
		i = i + 1
	sols = check(number, length, target, i)
	if sols != None:
		return sols

def check(number, length, target, i):
	fHalf = number[:target]
	lHalf = number[target:]
	if number[target] >= fHalf[0] and length % 2 != 0 and (target < length / 2):
		j = 0
		while fHalf[:j] == lHalf[:j]:
			j = j + 1
			if j * 2 >= length:
				j = 0
				return (number[:target], number[target:])
				break
			if fHalf[:j] < lHalf[:j] and (not (j > len(fHalf) or j > len(lHalf))):
				half(number, length, target + 1, i)
				break
		if not (fHalf[:j] < lHalf[:j] and (not (j > len(fHalf) or j > len(lHalf)))):
			return (number[:target], number[target:])
	elif (len(fHalf) == 1 or len(lHalf) == 1) and length > 4 and (lHalf[-1] != '0'):
		if i % 2 == 0:
			target = target - i
		else:
			target = target + i
		fHalf2 = number[:target]
		lHalf2 = number[target:]
		if int(lHalf) + int(fHalf) > int(lHalf2) + int(fHalf2):
			return (fHalf2, lHalf2)
		else:
			return (fHalf, lHalf)
	else:
		print(int(fHalf) + int(lHalf))
main()


import os
from io import BytesIO, StringIO
DEBUG = True
debug_print = print if DEBUG else lambda *x, **y: None

def input_as_list():
	return list(map(int, input().split()))

def array_of(f, *dim):
	return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def main():
	l = int(input())
	n = input()
	mind = 100000
	idx = []
	for (i, c) in enumerate(n):
		if i > 0:
			if c != '0':
				d = max(i, l - i)
				if d == mind:
					idx.append(i)
				elif d < mind:
					mind = d
					idx = [i]
	for (i, c) in enumerate(n):
		if i > 0:
			if c != '0':
				d = max(i, l - i)
				if d == mind + 1:
					idx.append(i)
	minv = int(n[:idx[0]]) + int(n[idx[0]:])
	for i in idx:
		minv = min(minv, int(n[:i]) + int(n[i:]))
	print(minv)
main()


n = int(input())
s = input().strip()
mid = n // 2
while mid + 1 < n and s[mid + 1] == '0':
	mid += 1
left = s[:mid + 1]
right = s[mid + 1:]
if not right or not left:
	var1 = int(s)
else:
	var1 = int(s[:mid + 1]) + int(s[mid + 1:])
mid = n // 2
while mid >= 0 and s[mid] == '0':
	mid -= 1
left = s[:mid]
right = s[mid:]
if not left or not right:
	var2 = var1
else:
	var2 = int(s[:mid]) + int(s[mid:])
print(min(var1, var2))


len = int(input())
number = input()
mid1 = len // 2
while mid1 > 0 and number[mid1] == '0':
	mid1 -= 1
mid2 = (len + 1) // 2
while mid2 < len and number[mid2] == '0':
	mid2 += 1
num11 = int(number[0:mid1]) if mid1 > 0 else 0
num12 = int(number[mid1:]) if mid1 < len else 0
num21 = int(number[0:mid2]) if mid2 > 0 else 0
num22 = int(number[mid2:]) if mid2 < len else 0
result = min(num11 + num12, num21 + num22)
print(result)


def main():
	n = int(input())
	s = input()
	res = int(s)
	i = n // 2
	j = (n + 1) // 2
	while i >= 0 and s[i] == '0':
		i -= 1
	while j < n and s[j] == '0':
		j += 1
	assert i > 0 or j < n
	if i > 0:
		res = min(res, int(s[:i]) + int(s[i:]))
	if j < n:
		res = min(res, int(s[:j]) + int(s[j:]))
	print(res)
main()


l = int(input())
n = int(input())
s = str(n)
mmax = 1e309

def cal(x):
	if x < 1 or x > l - 1:
		return mmax
	elif s[l - x] == '0':
		return mmax
	else:
		base = pow(10, x)
		tmp = n // base + n % base
		return tmp
index = l // 2
mmin = min(min(cal(index), cal(l - index)), min(cal(index - 1), cal(n + 1 - index)))
while mmin == mmax:
	index -= 1
	mmin = min(cal(index), cal(l - index))
print(mmin)


n = input()
s = input()
s = str(s)
mid = int(len(s) / 2)
num = -1
i = mid - 1
while i >= 0:
	if s[i + 1] == '0':
		i = i - 1
		continue
	s1 = s[:i + 1]
	s2 = s[i + 1:]
	if num == -1:
		num = int(s1) + int(s2)
	else:
		num = min(int(s1) + int(s2), num)
	break
	i = i - 1
for i in range(mid, len(s) - 1):
	if s[i + 1] == '0':
		continue
	s1 = s[:i + 1]
	s2 = s[i + 1:]
	if num == -1:
		num = int(s1) + int(s2)
	else:
		num = min(int(s1) + int(s2), num)
	break
print(num)


l = int(input())
n = str(input(''))
k = int(l / 2)
c = int(n)
for i in range(k, 0, -1):
	if n[i] != '0':
		a = int(n[:i])
		b = int(n[i:])
		c = a + b
		break
for i in range(k + 1, len(n)):
	if n[i] != '0':
		d = int(n[:i])
		f = int(n[i:])
		g = d + f
		c = min(c, g)
		break
print(c)


le = int(input())
num = input()
data = [0] * 2
for i in range(le // 2 + 1, le):
	if num[i] != '0':
		data[1] = i
		break
for i in range(le // 2, -1, -1):
	if num[i] != '0':
		data[0] = i
		break
num = '0' + num
print(min(int(num[:data[0] + 1]) + int(num[data[0] + 1:]), int(num[:data[1] + 1]) + int(num[data[1] + 1:])))


n = int(input())
a = input()
i_l = n // 2
i_r = n // 2 + 1
while i_r < n and a[i_r] == '0':
	i_r += 1
min1 = 2 ** 64 - 1
if i_r != n:
	min1 = int(a[0:i_r]) + int(a[i_r:])
while i_l >= 0 and a[i_l] == '0':
	i_l -= 1
if i_l > 0:
	min1 = min(min1, int(a[0:i_l]) + int(a[i_l:]))
print(min1)


n = int(input())
a = input()
l = len(a)
aa = int(a)
ans = -1
pos = int(l / 2)
pos1 = pos
pos2 = pos
while pos1 < l and a[pos1] == '0':
	pos1 += 1
while pos2 >= 0 and a[pos2] == '0':
	pos2 -= 1
try:
	n1 = a[:pos1]
	n2 = a[pos1:]
	ans = int(n1) + int(n2)
except:
	pass
if pos1 + 1 < l and a[pos1 + 1] != '0':
	n3 = a[:pos1 + 1]
	n4 = a[pos1 + 1:]
	if ans != -1:
		ans = min(ans, int(n3) + int(n4))
	else:
		ans = int(n3) + int(n4)
try:
	n1 = a[:pos2]
	n2 = a[pos2:]
	if ans != -1:
		ans = min(ans, int(n1) + int(n2))
	else:
		ans = int(n1) + int(n2)
except ValueError:
	pass
if pos2 - 1 > 0 and a[pos2 - 1] != '0':
	n3 = a[:pos2 - 1]
	n4 = a[pos2 - 1:]
	ans = min(ans, int(n3) + int(n4))
	if ans != -1:
		ans = min(ans, int(n3) + int(n4))
	else:
		ans = int(n3) + int(n4)
print(ans)


n = int(input())
s = input()
ans = int(s)
i = n // 2 + 1
while i < n and s[i] == '0':
	i += 1
if i < n:
	ans = min(ans, int(s[0:i]) + int(s[i:n]))
i = n // 2
while i > 0 and s[i] == '0':
	i -= 1
if i > 0:
	ans = min(ans, int(s[0:i]) + int(s[i:n]))
print(ans)


n = int(input())
s = input()
mid = n // 2
i = mid
j = mid + 1
while i >= 0 and s[i] == '0':
	i -= 1
while j < n and s[j] == '0':
	j += 1
if i == 0:
	print(int(s[0:j]) + int(s[j:n]))
elif j == n:
	print(int(s[0:i]) + int(s[i:n]))
else:
	print(min(int(s[0:i]) + int(s[i:n]), int(s[0:j]) + int(s[j:n])))


def findSum(str1, str2):
	if len(str1) > len(str2):
		t = str1
		str1 = str2
		str2 = t
	str = ''
	n1 = len(str1)
	n2 = len(str2)
	str1 = str1[::-1]
	str2 = str2[::-1]
	carry = 0
	for i in range(n1):
		sum = ord(str1[i]) - 48 + (ord(str2[i]) - 48 + carry)
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	for i in range(n1, n2):
		sum = ord(str2[i]) - 48 + carry
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	if carry:
		str += chr(carry + 48)
	str = str[::-1]
	return str
l = int(input())
s = input()
i = l // 2 + 1
while i < l and s[i] == '0':
	i += 1
j = l // 2
while j >= 0 and s[j] == '0':
	j -= 1
j -= 1
if i != l and j != -1:
	a1 = findSum(s[0:i], s[i:])
	a2 = findSum(s[0:j + 1], s[j + 1:])
	if len(a1) < len(a2):
		print(a1)
	elif len(a2) < len(a1):
		print(a2)
	else:
		print(min(a1, a2))
elif i != l:
	print(findSum(s[0:i], s[i:]))
else:
	print(findSum(s[0:j + 1], s[j + 1:]))


t = int(input())
s = input()
l = 0
r = t - 1
mid = t / 2
for i in range(t):
	if s[i] != '0':
		if i <= mid:
			l = i
		else:
			r = min(r, i)
if r == t - 1 and s[r] == '0':
	r = l - 1
h1 = pow(10, t - r)
h2 = pow(10, t - l)
s = int(s)
ans = min(s // h1 + s % h1, s // h2 + s % h2)
print(ans)


n = int(input())
v = input()
c = n // 2
while c > 0 and v[c] == '0':
	c -= 1
d = n // 2 + 1
while d < n - 1 and v[d] == '0':
	d += 1
a = int(v[:d]) + int(v[d:])
if v[d] == '0':
	a = 10 ** 100100
if c == 0:
	c = d
b = int(v[:c]) + int(v[c:])
print(min(a, b))


a = input()
a = int(a)
c = input()
b = str(c)
l = int(a / 2)
while l >= 1:
	if b[l] == '0':
		l -= 1
	else:
		break
r = int(a / 2) + 1
while r < a:
	if b[r] == '0':
		r += 1
	else:
		break
if l == 0:
	print(str(int(b[:r]) + int(b[r:])))
elif r == a:
	print(str(int(b[:l]) + int(b[l:])))
else:
	print(str(min(int(b[:r]) + int(b[r:]), int(b[:l]) + int(b[l:]))))


from math import *
n = int(input())
s = input()
ans = 10 ** 10 ** 6
if n % 2 == 0:
	for i in range(int(n / 2)):
		if s[int(n / 2 - i)] != '0':
			ans = min(ans, int(s[0:int(n / 2 - i)]) + int(s[int(n / 2 - i):n]))
			break
	for i in range(int(n / 2)):
		if s[int(n / 2 + i)] != '0':
			ans = min(ans, int(s[0:int(n / 2 + i)]) + int(s[int(n / 2 + i):n]))
			break
else:
	for i in range(int(n / 2) + 1):
		if s[int(n / 2 - i) + 1] != '0':
			ans = min(ans, int(s[0:int(n / 2 - i) + 1]) + int(s[int(n / 2 - i) + 1:n]))
			break
	for i in range(int(n / 2) + 1):
		if s[int(n / 2 + i)] != '0':
			ans = min(ans, int(s[0:int(n / 2 + i)]) + int(s[int(n / 2 + i):n]))
			break
print(ans)


n = int(input())
s = input()
i = 0
mini = 789546312675
while i + 1 < n:
	if i + 1 == n:
		break
	if s[i + 1] != '0':
		len1 = i + 1
		len2 = n - i - 1
		mini = min(mini, max(len1, len2))
	i += 1
ans = int(s)
i = 0
while i + 1 < n:
	if i + 1 == n:
		break
	if s[i + 1] != '0':
		len1 = i + 1
		len2 = n - i - 1
		if max(len1, len2) <= mini + 1:
			str1 = ''
			str2 = ''
			for it in range(n):
				if it < len1:
					str1 += s[it]
				else:
					str2 += s[it]
			ans = min(ans, int(str1) + int(str2))
	i += 1
print(ans)


n = int(input())
s = input()
x = n // 2
ans = int(s)
if s[x] != '0':
	ans = min(ans, int(s[:x]) + int(s[x:]))
for i in range(x + 1, n):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
for i in range(x - 1, 0, -1):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
print(ans)


n = int(input())
s = input()
resp = 10 ** (n + 1)
cnt = 0
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		cnt += 1
		s2 = s[:i]
		s3 = s[i:]
		if len(s2) >= 1 and len(s3) >= 1:
			resp = min(resp, int(s2) + int(s3))
	if cnt == 2:
		break
cnt = 0
for i in range(n // 2, n):
	if s[i] != '0':
		cnt += 1
		s2 = s[:i]
		s3 = s[i:]
		if len(s2) >= 1 and len(s3) >= 1:
			resp = min(resp, int(s2) + int(s3))
	if cnt == 2:
		break
print(resp)


import math
l = int(input())
s = input()
m = l // 2
m1 = m
m2 = m + 1
if m1 > 0 and s[m1] == '0':
	while m1 > 0 and s[m1] == '0':
		m1 -= 1
if m2 < l and s[m2] == '0':
	while m2 < l and s[m2] == '0':
		m2 += 1
val1 = math.inf
val2 = math.inf
if m1 >= 1:
	val1 = int(s[m1:]) + int(s[:m1])
if m2 <= l - 1:
	val2 = int(s[m2:]) + int(s[:m2])
print(min(val1, val2))


import sys

def main():
	l = input('')
	n = input('')
	min = -1
	n = str(n)
	i = 0
	j = 1
	while i < int(len(n) // 2):
		if len(n) % 2 == 0:
			if n[int(len(n) // 2) + i] != '0':
				a = n[:int(len(n) // 2) + i]
				b = n[int(len(n) // 2) + i:]
				sum = int(a) + int(b)
				if sum < min or min == -1:
					min = sum
			if n[int(len(n) // 2) - i] != '0':
				a = n[:int(len(n) // 2) - i]
				b = n[int(len(n) // 2) - i:]
				sum = int(a) + int(b)
				if sum < min or min == -1:
					min = sum
			i += 1
			if min != -1:
				break
		else:
			if n[int(len(n) // 2) + j] != '0':
				a = n[:int(len(n) // 2) + j]
				b = n[int(len(n) // 2) + j:]
				sum = int(a) + int(b)
				if sum < min or min == -1:
					min = sum
			if n[int(len(n) // 2) - i] != '0':
				a = n[:int(len(n) // 2) - i]
				b = n[int(len(n) // 2) - i:]
				sum = int(a) + int(b)
				if sum < min or min == -1:
					min = sum
			i += 1
			j += 1
			if min != -1:
				break
	print(min)
main()


len = int(input())
str = input()
mid = len // 2 - 1
ans = int(str)
lcnt = 2
for i in range(mid, -1, -1):
	if str[i + 1] != '0':
		sum = int(str[:i + 1]) + int(str[i + 1:])
		if sum < ans:
			ans = sum
		lcnt -= 1
		if lcnt == 0:
			break
rcnt = 2
for i in range(mid + 1, len - 1):
	if str[i + 1] != '0':
		sum = int(str[:i + 1]) + int(str[i + 1:])
		if sum < ans:
			ans = sum
		rcnt -= 1
		if rcnt == 0:
			break
print(ans)


a = int(input())
b = str(input())
ans = int(b)
counter = 1
for i in range(0, a // 2 + 1):
	s = a // 2 - i
	if s > 0:
		if b[s] != '0':
			ans = min(ans, int(b[:s]) + int(b[s:]))
			if counter == 1:
				counter = 2
	s = a // 2 + i
	if a - s > 0:
		if b[s] != '0':
			ans = min(ans, int(b[:s]) + int(b[s:]))
			if counter == 1:
				counter = 2
	if counter >= 2:
		counter = counter + 1
	if counter == 4:
		break
print(ans)


n = int(input())
d = input()
l = len(d)
half = int(l / 2)
minV = None
cnt = 0
for i in range(half, l):
	if d[i] == '0':
		continue
	val = int(d[:i]) + int(d[i:])
	cnt += 1
	if minV is not None:
		minV = min(minV, val)
	else:
		minV = val
	if cnt >= 2:
		break
cnt = 0
for i in range(half, 0, -1):
	if d[i] == '0':
		continue
	val = int(d[:i]) + int(d[i:])
	cnt += 1
	if minV is not None:
		minV = min(minV, val)
	else:
		minV = val
	if cnt >= 2:
		break
print(minV)


(n, s) = (int(input()), input())
for i in range((n - 1) // 2, -1, -1):
	if s[i + 1] == '0':
		continue
	best = int(s[:i + 1]) + int(s[i + 1:])
	break
for i in range(n // 2, n):
	if s[i] == '0':
		continue
	best = min(best, int(s[:i]) + int(s[i:]))
	break
print(best)


n = int(input())
s = input()
ans = int(s)
mid = n // 2
for i in range(mid, 0, -1):
	if s[i] != '0':
		val = int(s[:i]) + int(s[i:])
		if val < ans:
			ans = val
		break
for i in range(mid + 1, n):
	if s[i] != '0':
		val = int(s[:i]) + int(s[i:])
		if val < ans:
			ans = val
		break
print(ans)


x = int(input())
li_t = list(input())
len1 = len(li_t)
len1 = len1 // 2
li_t1 = li_t[:len1]
li_t2 = li_t[len1:]
i = 0
if li_t1[-1] == '0' and li_t2[0] == '0':
	while i <= len(li_t2) - 1 and li_t2[i] == '0':
		i += 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans1 = li_t1 + li_t2
	li_t1 = li_t[:len1]
	li_t2 = li_t[len1:]
	i = -1
	while i >= -1 * len(li_t1) and li_t1[i] == '0':
		i -= 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans2 = li_t1 + li_t2
elif li_t2[0] == '0':
	i = 0
	while i <= len(li_t2) - 1 and li_t2[i] == '0':
		i = i + 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans1 = li_t1 + li_t2
	li_t1 = li_t[:len1]
	li_t2 = li_t[len1:]
	try:
		i = -1
		li_t1 = li_t[:len1 + i]
		li_t2 = li_t[len1 + i:]
		if li_t1 != []:
			li_t1 = int(''.join(li_t1))
		else:
			li_t1 = 0
		if li_t2 != []:
			li_t2 = int(''.join(li_t2))
		else:
			li_t2 = 0
		ans2 = li_t1 + li_t2
	except:
		ans2 = 0
elif li_t1[-1] == '0':
	i = -1
	while i >= -1 * len(li_t1) and li_t1[i] == '0':
		i = i - 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans1 = li_t1 + li_t2
	li_t1 = li_t[:len1]
	li_t2 = li_t[len1:]
	i = 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans2 = li_t1 + li_t2
else:
	i = 0
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans1 = li_t1 + li_t2
	i = 1
	li_t1 = li_t[:len1 + i]
	li_t2 = li_t[len1 + i:]
	if li_t1 != []:
		li_t1 = int(''.join(li_t1))
	else:
		li_t1 = 0
	if li_t2 != []:
		li_t2 = int(''.join(li_t2))
	else:
		li_t2 = 0
	ans2 = li_t1 + li_t2
if ans1 > ans2:
	print(ans2)
else:
	print(ans1)


n = int(input())
s = input()
c = 0
ans = -1
k = n % 2
if n == 2:
	print(int(s[0]) + int(s[1]))
else:
	if s[n // 2] != '0' and n % 2 == 1:
		ans = int(s[0:n // 2]) + int(s[n // 2:])
	while s[n // 2 - c - 1] == '0' and s[n // 2 + c + k] == '0':
		c += 1
	if s[n // 2 - c - 1] != '0' and n // 2 - c - 1 != 0:
		temp = int(s[0:n // 2 - c - 1]) + int(s[n // 2 - c - 1:])
		if ans == -1:
			ans = temp
		else:
			ans = min(ans, temp)
	if s[n // 2 + c + k] != '0':
		temp = int(s[0:n // 2 + c + k]) + int(s[n // 2 + c + k:])
		if ans == -1:
			ans = temp
		else:
			ans = min(ans, temp)
	print(ans)


l = int(input())
n = input()
best = int(n)
p = (l - 1) // 2
for i in range(p, -1, -1):
	if n[i + 1] == '0':
		continue
	best = min(best, int(n[0:i + 1]) + int(n[i + 1:]))
	break
p = l // 2
for i in range(p, l):
	if n[i] == '0':
		continue
	best = min(best, int(n[0:i]) + int(n[i:]))
	break
print(best)


l = int(input())
str = input()
md = l // 2
md1 = md + 1
ans = -1
global num
while md > 0:
	if str[md] != '0':
		i1 = int(str[0:md])
		i2 = int(str[md::1])
		num = i1 + i2
		if num < ans or ans == -1:
			ans = num
		break
	md -= 1
	if md == -1:
		break
while md1 < l:
	if str[md1] != '0':
		i1 = int(str[0:md1])
		i2 = int(str[md1::1])
		num = i1 + i2
		if num < ans or ans == -1:
			ans = num
		break
	md1 += 1
	if md1 == l:
		break
print(ans)


a = int(input())
b = input()
ans = int(b)
mid1 = a // 2
mid2 = a // 2 + 1
while mid1 >= 1:
	if b[mid1] != '0':
		ans = min(ans, int(b[0:mid1]) + int(b[mid1:]))
		break
	mid1 = mid1 - 1
while mid2 < a:
	if b[mid2] != '0':
		ans = min(ans, int(b[0:mid2]) + int(b[mid2:]))
		break
	mid2 = mid2 + 1
print(ans)


def main():
	n = int(input())
	s = input().strip()
	if n % 2 == 0:
		if s[n // 2] != '0':
			print(int(s[:n // 2]) + int(s[n // 2:]))
		else:
			i = n // 2
			while i > 0 and s[i] == '0':
				i -= 1
			if i != 0:
				ans1 = int(s[:i]) + int(s[i:])
			else:
				ans1 = -1
			i += 1
			while i < n and s[i] == '0':
				i += 1
			if i != n:
				ans2 = int(s[:i]) + int(s[i:])
			else:
				ans2 = -1
			if ans1 == -1:
				print(ans2)
			elif ans2 == -1:
				print(ans1)
			else:
				print(min(ans1, ans2))
	elif s[n // 2] == '0' or s[n // 2 + 1] == '0':
		if s[n // 2] == '0':
			i = n // 2
			while i > 0 and s[i] == '0':
				i -= 1
			if i != 0:
				ans1 = int(s[:i]) + int(s[i:])
			else:
				ans1 = -1
			i += 1
			while i < n and s[i] == '0':
				i += 1
			if i != n:
				ans2 = int(s[:i]) + int(s[i:])
			else:
				ans2 = -1
			if ans1 == -1:
				print(ans2)
			elif ans2 == -1:
				print(ans1)
			else:
				print(min(ans1, ans2))
		else:
			i = n // 2 + 1
			while i > 0 and s[i] == '0':
				i -= 1
			if i != 0:
				ans1 = int(s[:i]) + int(s[i:])
			else:
				ans1 = -1
			i += 1
			while i < n and s[i] == '0':
				i += 1
			if i != n:
				ans2 = int(s[:i]) + int(s[i:])
			else:
				ans2 = -1
			if ans1 == -1:
				print(ans2)
			elif ans2 == -1:
				print(ans1)
			else:
				print(min(ans1, ans2))
	else:
		print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])))
main()


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)

def add(s1, s2):
	if len(s2) > len(s1):
		t = s2
		s2 = s1
		s1 = t
	s1 = list(s1)
	s2 = list(s2)
	s1.reverse()
	s2.reverse()
	s2 += ['0'] * (len(s1) - len(s2))
	a = []
	c = 0
	for i in range(len(s1)):
		a.append(str((int(s1[i]) + int(s2[i]) + c) % 10))
		c = (int(s1[i]) + int(s2[i]) + c) // 10
	if c != 0:
		a.append(str(c))
	a.reverse()
	return ''.join(a)

def minString(s1, s2):
	if len(s1) < len(s2):
		return s1
	elif len(s1) > len(s2):
		return s2
	else:
		for i in range(len(s1)):
			if int(s1[i]) > int(s2[i]):
				return s2
			elif int(s1[i]) < int(s2[i]):
				return s1
		return s1
n = int(input())
s = input()
m = n // 2
(x, y) = (None, None)
(w, z) = (None, None)
for i in range(m - 1, n):
	if s[i] != '0':
		if x is None:
			x = add(s[:i], s[i:])
		elif y is None:
			y = add(s[:i], s[i:])
		else:
			break
for i in range(min(m + 1, n - 1), -1, -1):
	if s[i] != '0':
		if w is None:
			w = add(s[:i], s[i:])
		elif z is None:
			z = add(s[:i], s[i:])
		else:
			break
if x is None:
	x = '9' * 10 ** 5
if y is None:
	y = '9' * 10 ** 5
if w is None:
	w = '9' * 10 ** 5
if z is None:
	z = '9' * 10 ** 5
print(minString(minString(x, y), minString(w, z)))


l = int(input())
s = input()
ans = int(s)
min_len = l
pos = []
for i in range(l - 1):
	if s[i + 1] == '0':
		continue
	ll = max(i + 1, l - 1 - i) + 1
	if ll < min_len:
		pos = [i]
		min_len = ll
	elif ll == min_len:
		pos.append(i)
	else:
		continue
for p in pos:
	ss = int(s[:p + 1]) + int(s[p + 1:])
	if ss < ans:
		ans = ss
print(int(ans))


import math
n = int(input())
s = input()
l = len(s)
sum1 = math.inf
if l % 2 == 0:
	zz = l // 2
	if s[zz] == '0':
		x = zz + 1
		while x < n and s[x] == '0':
			x = x + 1
		if x < n:
			sum1 = int(s[:x]) + int(s[x:])
		x = zz - 1
		while x >= 0 and s[x] == '0':
			x = x - 1
		if x > 0:
			sum1 = min(sum1, int(s[:x]) + int(s[x:]))
	else:
		sum1 = int(s[:zz]) + int(s[zz:])
else:
	zz = l // 2
	x = zz
	while x < n and s[x] == '0':
		x = x + 1
	if x < n:
		sum1 = int(s[:x]) + int(s[x:])
	x = zz + 1
	while x < n and s[x] == '0':
		x = x + 1
	if x < n:
		sum1 = min(sum1, int(s[:x]) + int(s[x:]))
	x = zz - 1
	while x >= 0 and s[x] == '0':
		x = x - 1
	if x > 0:
		sum1 = min(sum1, int(s[:x]) + int(s[x:]))
print(sum1)


n = int(input())
s = input()
a = [i for i in range(1, n) if s[i] != '0']
a.sort(key=lambda i: abs(i - n / 2))
ans = float('inf')
for i in a[:6]:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


l = int(input())
s = input()
if l % 2 == 0:
	inda = l // 2
	indb = l // 2
else:
	inda = l // 2
	indb = l // 2 + 1
while s[inda] == '0' and inda > 1:
	inda -= 1
while s[indb] == '0' and indb < l - 1:
	indb += 1
al = s[:inda]
ar = s[inda:]
bl = s[:indb]
br = s[indb:]
aside = int(s[:inda]) + int(s[inda:])
bside = int(s[:indb]) + int(s[indb:])
if ar[0] == '0':
	min_sum = bside
elif br[0] == '0':
	min_sum = aside
elif aside < bside:
	min_sum = aside
else:
	min_sum = bside
print(min_sum)


def findNotZero(s, half):
	min = 10000000
	pos = 0
	for i in s:
		if int(i) != 0:
			if abs(pos - half) < abs(min - half):
				min = pos
			elif abs(pos - half) == abs(min - half):
				first = ''
				second = ''
				for i in s[min:]:
					first += str(i)
				for i in s[:pos]:
					second += str(i)
				if first == '':
					min = pos
				elif int(first) > int(second):
					min = pos
		pos += 1
	return min

def findResult(first, second):
	pos = 0
	first = first[::-1]
	second = second[::-1]
	res = ''
	r = 0
	for i in range(len(first)):
		if i < len(second):
			plus = first[i] + second[i] + r
		else:
			plus = first[i] + r
		res += str(plus % 10)
		r = plus // 10
		pos += 1
	if r != 0:
		res += str(r)
	print(res[::-1])
l = int(input())
s = [int(i) for i in input()]
half = len(s) // 2
if s[half] == 0:
	half = findNotZero(s, half)
	first = s[:half]
	second = s[half:]
elif l % 2 == 1 and s[half] > s[0]:
	first = s[:half + 1]
	second = s[half + 1:]
elif l % 2 == 1 and s[half] == s[0]:
	first = ''
	second = ''
	for i in s[:half + 1]:
		first += str(i)
	for i in s[half:]:
		second += str(i)
	if first > second:
		first = s[:half]
		second = s[half:]
	else:
		first = s[:half + 1]
		second = s[half + 1:]
else:
	first = s[:half]
	second = s[half:]
if len(first) >= len(second):
	findResult(first, second)
else:
	findResult(second, first)


l = int(input())
s = input()
j = l // 2
i = j + 1
while j > 0 and s[j] == '0':
	j -= 1
while i < l and s[i] == '0':
	i += 1
print(min(int(s[0 if i >= l else i:]) + int(s[:i]), int(s[j:]) + int(s[:l if j == 0 else j])))


k = int(input())
p = input()
if k % 2 == 0:
	m = int(k // 2)
	c = m
	d = m
	if int(p[m]) == 0:
		while c <= k - 1:
			if int(p[c]) != 0:
				break
			c += 1
		while int(p[d]) == 0:
			d -= 1
		if c == k:
			print(int(p[:d]) + int(p[d:]))
		elif int(p[:c]) + int(p[c:]) > int(p[:d]) + int(p[d:]):
			print(int(p[:d]) + int(p[d:]))
		else:
			print(int(p[:c]) + int(p[c:]))
	else:
		print(int(p[:m]) + int(p[m:]))
elif k % 2 != 0:
	m = int(k // 2)
	c = m
	d = m
	if k == 3:
		print(11)
	elif int(p[m]) == 0:
		while c <= k - 1:
			if int(p[c]) != 0:
				break
			c += 1
		while int(p[d]) == 0:
			d -= 1
		if c == k:
			print(int(p[:d]) + int(p[d:]))
		elif int(p[:c]) + int(p[c:]) > int(p[:d]) + int(p[d:]):
			print(int(p[:d]) + int(p[d:]))
		else:
			print(int(p[:c]) + int(p[c:]))
	elif int(p[:m]) + int(p[m:]) > int(p[:m + 1]) + int(p[m + 1:]):
		print(int(p[:m + 1]) + int(p[m + 1:]))
	elif int(p[:m + 1]) + int(p[m + 1:]) > int(p[:m]) + int(p[m:]):
		print(int(p[:m]) + int(p[m:]))


l = int(input())
s = input()
n = int(s)
mid = l // 2
ans = 10 ** l
for i in range(mid + 1, l):
	if s[i].isdigit() and s[i] != '0':
		exp = 10 ** (l - i)
		fir = n // exp
		sec = n % exp
		ans = min(ans, fir + sec)
		break
for i in range(mid, 0, -1):
	if s[i].isdigit() and s[i] != '0':
		exp = 10 ** (l - i)
		fir = n // exp
		sec = n % exp
		ans = min(ans, fir + sec)
		break
print(ans)


from math import inf
l = int(input())
s = input()
m = inf
k = l // 2
while k >= 0 and s[k] == '0':
	k -= 1
if k <= 0:
	pass
else:
	m = min(m, int(s[:k]) + int(s[k:]))
k = l // 2
while k < l and s[k] == '0':
	k += 1
if k >= l:
	pass
else:
	m = min(m, int(s[:k]) + int(s[k:]))
k = l // 2 + 1
while k >= 0 and s[k] == '0':
	k -= 1
if k <= 0:
	pass
else:
	m = min(m, int(s[:k]) + int(s[k:]))
k = l // 2 + 1
while k < l and s[k] == '0':
	k += 1
if k >= l:
	pass
else:
	m = min(m, int(s[:k]) + int(s[k:]))
print(m)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
l = ii()
n = input().strip()
ans = int(n)
mid = (l - 1) // 2
for i in range(mid, -1, -1):
	if n[i + 1] == '0':
		continue
	ans = min(ans, int(n[0:i + 1]) + int(n[i + 1:]))
	break
mid = l // 2
for i in range(mid, l, 1):
	if n[i] == '0':
		continue
	ans = min(ans, int(n[0:i]) + int(n[i:]))
	break
print(ans)


n = int(input())
m = input()
if n % 2 == 0:
	if m[n // 2] == '0':
		k1 = n // 2
		while m[k1] == '0':
			k1 += 1
			if k1 >= n:
				break
		k2 = n // 2
		while m[k2] == '0':
			k2 -= 1
			if k2 <= 0:
				break
		if k1 == n:
			print(int(m[:k2]) + int(m[k2:]))
		elif k2 == 0:
			print(int(m[:k1]) + int(m[k1:]))
		else:
			print(min(int(m[:k2]) + int(m[k2:]), int(m[:k1]) + int(m[k1:])))
	else:
		print(int(m[:n // 2]) + int(m[n // 2:]))
elif m[n // 2] == '0' and m[n // 2 + 1] == '0':
	k1 = n // 2
	while m[k1] == '0':
		k1 += 1
		if k1 >= n:
			break
	k2 = n // 2
	while m[k2] == '0':
		k2 -= 1
		if k2 <= 0:
			break
	if k1 == n:
		print(int(m[:k2]) + int(m[k2:]))
	elif k2 == 0:
		print(int(m[:k1]) + int(m[k1:]))
	else:
		print(min(int(m[:k2]) + int(m[k2:]), int(m[:k1]) + int(m[k1:])))
elif m[n // 2] == '0':
	k2 = n // 2 + 1
	print(int(m[:k2]) + int(m[k2:]))
elif m[n // 2 + 1] == '0':
	k2 = n // 2
	print(int(m[:k2]) + int(m[k2:]))
else:
	k1 = n // 2
	k2 = n // 2 + 1
	print(min(int(m[:k2]) + int(m[k2:]), int(m[:k1]) + int(m[k1:])))


l = int(input())
s = input()
mi = int(s)
c = 0
for i in range(int(l / 2 + 1), l):
	if s[i] == '0':
		continue
	n1 = int(s[:i])
	n2 = int(s[i:])
	mi = min(mi, n1 + n2)
	c += 1
	if c >= 2:
		break
c = 0
for i in range(int(l / 2), 0, -1):
	if s[i] == '0':
		continue
	n1 = int(s[:i])
	n2 = int(s[i:])
	mi = min(mi, n1 + n2)
	break
	c += 1
	if c >= 2:
		break
print(mi)


n = int(input())
s = input()
mn = int(s)
k = n // 2
while k >= 1:
	if s[k] == '0':
		k = k - 1
		continue
	mn = min(mn, int(s[:k]) + int(s[k:]))
	break
k = n // 2 + 1
while k < n:
	if s[k] == '0':
		k = k + 1
		continue
	mn = min(mn, int(s[:k]) + int(s[k:]))
	break
print(mn)


l = int(input())
s1 = input()
ans = int(s1)
cnt = 0
for i in range(int(l / 2 + 1), l):
	if s1[i] == '0':
		continue
	num1 = int(s1[:i])
	num2 = int(s1[i:])
	ans = min(ans, num1 + num2)
	cnt += 1
	if cnt >= 2:
		break
cnt = 0
for i in range(int(l / 2), 0, -1):
	if s1[i] == '0':
		continue
	num1 = int(s1[:i])
	num2 = int(s1[i:])
	ans = min(ans, num1 + num2)
	cnt += 1
	if cnt >= 2:
		break
print(ans)


l = int(input())
n = input()
mid = l // 2
if l % 2 != 0:
	i = 0
	while n[i] == n[l // 2 + i]:
		i += 1
	if n[i] < n[l // 2 + i]:
		mid += 1
m1 = m2 = mid
while m1 < l and n[m1] == '0':
	m1 += 1
while m2 > 0 and n[m2] == '0':
	m2 -= 1
out = int(n)
if m1 != l:
	out = min(out, int(n[:m1]) + int(n[m1:]))
if m2 != 0:
	out = min(out, int(n[:m2]) + int(n[m2:]))
print(out)


def mp():
	return map(int, input().split())
n = int(input())
a = input()
b = cnt = 0
for i in range(n // 2, n):
	if a[i] != '0':
		t = int(int(a[:i]) + int(a[i:]))
		if b == 0 or t < b:
			b = t
		cnt += 1
	if cnt > 2:
		break
cnt = 0
for i in range(n // 2, 0, -1):
	if a[i] != '0':
		t = int(int(a[:i]) + int(a[i:]))
		if b == 0 or t < b:
			b = t
		cnt += 1
	if cnt > 2:
		break
print(b)


from collections import defaultdict as dd
import math
import sys

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
n = nn()
s = input()
j = 1
minjd = float('+Inf')
bestj = None
minval = float('+Inf')
while j < n:
	if not s[j] == '0':
		d = abs(n - 2 * j)
		if d < minjd:
			bestj = j
			minjd = d
		elif d == minjd:
			v1 = int(s[:bestj]) + int(s[bestj:])
			v2 = int(s[:j]) + int(s[j:])
			minval = min(v1, v2)
	j += 1
if minval < float('+Inf'):
	print(minval)
else:
	print(int(s[:bestj]) + int(s[bestj:]))


def f(s, inx, len):
	l = int(s[0:inx])
	r = int(s[inx:len])
	return l + r

def _main():
	n = int(input())
	s = input()
	res = -1
	i = n // 2
	t = 10
	while t != 0:
		i += 1
		if i > n - 1:
			break
		if s[i] == '0':
			continue
		t -= 1
		if res == -1:
			res = f(s, i, n)
		else:
			res = min(res, f(s, i, n))
	t = 10
	i = n // 2 + 1
	while t != 0:
		i -= 1
		if i <= 0:
			break
		if s[i] == '0':
			continue
		t -= 1
		if res == -1:
			res = f(s, i, n)
		else:
			res = min(res, f(s, i, n))
	print(res)
_main()


n = int(input())
s = input()
res = int(s)
for i in range(-1, 2):
	mid = n // 2 + i
	while mid > 0 and mid < n and (s[mid] == '0'):
		mid += -1 if i < 0 else 1
	if mid > 0 and mid < n:
		res = min(res, int(s[:mid]) + int(s[mid:]))
print(res)


a = int(input())
s = input()
x = a // 2
m = s[:x]
n = s[x:]
o = s[:x + 1]
p = s[x + 1:]
l = a // 2
c = a // 2
for ll in range(a // 2, a):
	if s[ll] == '0':
		c += 1
	else:
		break
for ww in range(a // 2, 0, -1):
	if s[ww] == '0':
		l -= 1
	else:
		break
if a == 2:
	print(int(s[0]) + int(s[1]))
elif c == l:
	print(min(int(m) + int(n), int(o) + int(p)))
elif c == a:
	print(min(int(s), int(s[:l]) + int(s[l:])))
elif l == 0:
	print(min(int(s[:c]) + int(s[c:]), int(s)))
else:
	print(min(int(s[:c]) + int(s[c:]), int(s[:l]) + int(s[l:])))


n = int(input())
s = [*map(int, input())]

def f(i):
	a = s[:i]
	b = s[i:]
	c = []
	carry = 0
	while a or b:
		c.append((a if a else [0]).pop() + (b if b else [0]).pop() + carry)
		carry = c[-1] // 10
		c[-1] %= 10
	c.reverse()
	return c

def key(x, y):
	if len(x) != len(y):
		return len(x) < len(y)
	return x < y
c = []
i = n // 2
while i > 0 and s[i] == 0:
	i -= 1
if i > 0:
	c.append(i)
i = (n + 1) // 2
while i < n and s[i] == 0:
	i += 1
if i < n:
	c.append(i)
res = s[:]
for e in c:
	curr = f(e)
	if key(curr, res):
		res = curr
print(''.join(map(str, res)))


def findright(ind):
	mid1 = float('+inf')
	for i in range(ind + 1, nils):
		if nil[i] != nil[i - 1] + 1:
			mid1 = nil[i - 1] + 1
			break
	if nil[-1] < n - 1:
		mid1 = min(mid1, nil[-1] + 1)
	return mid1

def findleft(ind):
	mid2 = 0
	if ind == 0:
		mid2 = nil[ind] - 1
	else:
		for i in range(ind - 1, -1, -1):
			if nil[i] != nil[i + 1] - 1:
				mid2 = nil[i + 1] - 1
				break
	if mid2 == 0 and nil[0] > 1:
		mid2 = nil[0] - 1
	return mid2
n = int(input())
s = input()
nil = []
for i in range(n):
	if s[i] == '0':
		nil.append(i)
nils = len(nil)
mid = n // 2
S1 = S2 = S3 = float('+inf')
if mid in nil:
	ind = nil.index(mid)
	r = findright(ind)
	l = findleft(ind)
	if r != float('+inf'):
		S1 = int(s[r:]) + int(s[:r])
	if l != 0:
		S1 = min(S1, int(s[:l]) + int(s[l:]))
else:
	S1 = int(s[:mid]) + int(s[mid:])
if mid > 1:
	if mid - 1 in nil:
		ind = nil.index(mid - 1)
		r = findright(ind)
		l = findleft(ind)
		if r != float('+inf'):
			S2 = int(s[r:]) + int(s[:r])
		if l != 0:
			S2 = min(S2, int(s[:l]) + int(s[l:]))
	else:
		S2 = int(s[:mid - 1]) + int(s[mid - 1:])
if mid + 1 < n:
	if mid + 1 in nil:
		ind = nil.index(mid + 1)
		r = findright(ind)
		l = findleft(ind)
		if r != float('+inf'):
			S3 = int(s[r:]) + int(s[:r])
		if l != 0:
			S3 = min(S3, int(s[:l]) + int(s[l:]))
	else:
		S3 = int(s[:mid + 1]) + int(s[mid + 1:])
print(min(S1, S2, S3))


n = int(input())
x = input()
l = n // 2
r = (n + 1) // 2
fn = lambda i: int(x[:i]) + int(x[i:])
while x[l] == '0':
	l -= 1
while x[r] == '0':
	r += 1
	if r == n:
		break
ans = float('inf')
if l != 0:
	ans = min(ans, fn(l))
if r != n:
	ans = min(ans, fn(r))
print(ans)


n = int(input())
s = input()
l = n // 2
r = (n + 1) // 2
while s[l] == '0' == s[r]:
	l -= 1
	r += 1
f = []
if l and s[l] != '0':
	f.append(int(s[:l]) + int(s[l:]))
if r < n and s[r] != '0':
	f.append(int(s[:r]) + int(s[r:]))
print(min(f))


import sys
f = sys.stdin
out = sys.stdout
l = int(f.readline().rstrip('\r\n'))
n = f.readline().rstrip('\r\n')
ans = int(n)
p = l >> 1
while p < l and n[p] == '0':
	p += 1
if p < l:
	ans = min(ans, int(n[:p]) + int(n[p:]))
p += 1
while p < l and n[p] == '0':
	p += 1
if p < l:
	ans = min(ans, int(n[:p]) + int(n[p:]))
p = l >> 1
while p >= 0 and n[p] == '0':
	p -= 1
if p > 0:
	ans = min(ans, int(n[:p]) + int(n[p:]))
p -= 1
while p >= 0 and n[p] == '0':
	p -= 1
if p > 0:
	ans = min(ans, int(n[:p]) + int(n[p:]))
out.write(str(ans))


n = int(input())
string = input()
ans = float('inf')
mid = len(string) // 2
cnt = 0
for i in range(mid, n):
	if cnt >= 2:
		break
	if string[i] != '0':
		l = int(string[0:i])
		r = int(string[i:])
		cnt += 1
		ans = min(ans, l + r)
cnt = 0
for i in range(mid, 0, -1):
	if cnt >= 2:
		break
	if string[i] != '0':
		l = int(string[0:i])
		r = int(string[i:])
		cnt += 1
		ans = min(ans, l + r)
print(ans)


import sys
try:
	sys.stdin = open('in.in', 'r')
except:
	pass
n = int(input())
s = input().strip()
l_non0 = [-1] * n
r_non0 = [-1] * n
for i in range(n):
	if s[i] == '0':
		l_non0[i] = -1 if i == 0 else l_non0[i - 1]
	else:
		l_non0[i] = i
for i in range(n - 1, -1, -1):
	if s[i] == '0':
		r_non0[i] = -1 if i == n - 1 else r_non0[i + 1]
	else:
		r_non0[i] = i
bl = max(0, n // 2 - 2)
br = min(n, n // 2 + 2)

def Calc(pos):
	return int(s[0:pos]) + int(s[pos:n])
ans = -1
for i in range(bl, br):
	if l_non0[i] != -1 and l_non0[i] != 0:
		tans = Calc(l_non0[i])
		if ans == -1 or ans > tans:
			ans = tans
	if r_non0[i] != -1 and r_non0[i] != 0:
		tans = Calc(r_non0[i])
		if ans == -1 or ans > tans:
			ans = tans
print(ans)


n = int(input())
s = input()
l = n // 2
ans = int(s)
if s[l] != '0':
	ans = int('0' + s[:l]) + int('0' + s[l:])
for i in range(1, n):
	if l + i < n and s[l + i] != '0':
		ans = min(ans, int('0' + s[:l + i]) + int('0' + s[l + i:]))
	if l - i >= 0 and s[l - i] != '0':
		ans = min(ans, int('0' + s[:l - i]) + int('0' + s[l - i:]))
	if l + i >= n or l - 1 <= 0 or s[l + i] != '0' or (s[l - i] != '0'):
		break
print(ans)


n = int(input())
s = input()
S = 10 ** 100000

def raspil(number):
	global S
	pos = number
	while pos < n and s[pos] == '0':
		pos += 1
	if pos < n:
		S = min(S, int(s[pos:]) + int(s[:pos]))
	pos = number
	while pos >= 0 and s[pos] == '0':
		pos -= 1
	if pos > 0:
		S = min(S, int(s[pos:]) + int(s[:pos]))
raspil(n // 2)
raspil((n + 1) // 2)
print(S)


from math import floor, ceil
size = int(input())
num = str(input())
lsplit = floor(size / 2)
rsplit = ceil(size / 2)
s1 = float('inf')
s2 = float('inf')
try:
	while num[lsplit] == '0':
		lsplit -= 1
	s1 = int(num[0:lsplit]) + int(num[lsplit:])
except:
	pass
try:
	while num[rsplit] == '0':
		rsplit += 1
	s2 = int(num[0:rsplit]) + int(num[rsplit:])
except:
	pass
print(min(s1, s2))


import sys
a = sys.stdin.read().split()[1].strip()
ans = int(a)
n = len(a)
k = n // 2
m = 0
i = k
while m < 3 and i < n:
	if a[i] != '0':
		m += 1
		s = int(a[:i]) + int(a[i:])
		if s < ans:
			ans = s
	i += 1
m = 0
i = k
while m < 3 and i > 0:
	if a[i] != '0':
		m += 1
		s = int(a[:i]) + int(a[i:])
		if s < ans:
			ans = s
	i -= 1
print(ans)


import math
from collections import OrderedDict
from collections import deque
import heapq

def ll(i):
	if i == 0:
		return input()
	if i == 1:
		return list(map(int, input().split()))
n = int(ll(0))
p = ll(0)
pp = int(p)
l = list(p)
m = int(l[n // 2])
if m == 0:
	i1 = -1
	i2 = -1
	for i in range(n // 2 + 1, n):
		if int(l[i]) != 0:
			i1 = i
			break
	for i in range(n // 2, -1, -1):
		if int(l[i]) != 0:
			i2 = i
			break
	i2 = i2 - 1
	val1 = 0
	str1 = ''
	str2 = ''
	if i1 != -1:
		for i in range(i1):
			str1 = str1 + l[i]
		for i in range(i1, n):
			str2 = str2 + l[i]
		val1 = int(str1) + int(str2)
	else:
		val1 = pp
	val2 = 0
	str1 = ''
	str2 = ''
	if i2 != -1:
		for i in range(i2 + 1):
			str1 = str1 + l[i]
		for i in range(i2 + 1, n):
			str2 = str2 + l[i]
		val2 = int(str1) + int(str2)
	else:
		val2 = pp
	print(min(val1, val2))
elif n % 2 == 0:
	str1 = ''
	str2 = ''
	val1 = 0
	val2 = 0
	for i in range(n // 2 + 1):
		str1 = str1 + l[i]
	for i in range(n // 2 + 1, n):
		str2 = str2 + l[i]
	val1 = int(str1) + int(str2)
	str1 = ''
	str2 = ''
	if int(l[n // 2 - 1]) != 0:
		for i in range(n // 2):
			str1 = str1 + l[i]
		for i in range(n // 2, n):
			str2 = str2 + l[i]
		val2 = int(str1) + int(str2)
		print(min(val1, val2))
	else:
		print(val1)
else:
	str1 = ''
	str2 = ''
	val1 = 0
	for i in range(n // 2 + 1):
		str1 = str1 + l[i]
	for i in range(n // 2 + 1, n):
		str2 = str2 + l[i]
	val1 = int(str1) + int(str2)
	str1 = ''
	str2 = ''
	val2 = 0
	for i in range(n // 2):
		str1 = str1 + l[i]
	for i in range(n // 2, n):
		str2 = str2 + l[i]
	val2 = int(str1) + int(str2)
	print(min(val1, val2))


length = int(input())
n = input()
if length == 2:
	Bestans = int(n[0]) + int(n[1])
	print(Bestans)
else:
	bestAns = int(n)
	p = length // 2
	for i in range(p, -1, -1):
		if n[i + 1] == '0':
			continue
		bestAns = min(bestAns, int(n[0:i + 1]) + int(n[i + 1:]))
		break
	p = length // 2
	for i in range(p, length):
		if n[i] == '0':
			continue
		bestAns = min(bestAns, int(n[:i]) + int(n[i:]))
		break
	print(bestAns)


def trial(s, k):
	n = int('0' + s[k:])
	if not n:
		return []
	k = len(str(n))
	return [int(s[:-k]) + int(s[-k:])]

def trial2(s, k):
	r = ''.join(reversed(s))
	n = int('0' + r[k:])
	if not n:
		return []
	k = len(str(n))
	if k < 2:
		return []
	return [int(s[:k - 1]) + int(s[k - 1:])]
n = int(input())
s = input().strip()
print(min(trial(s, n // 2) + trial(s, n // 2 + 1) + trial2(s, n // 2) + trial2(s, n // 2 + 1)))


l = int(input())
n = input()
sol_in = 0
best_len = 1000000.0

def zbr(ind):
	a = n[:ind]
	b = n[ind:]
	return int(a) + int(b)
for i in range(1, l):
	if n[i] == '0':
		continue
	if max(i, l - i) == best_len:
		if zbr(i) < zbr(sol_in):
			sol_in = i
	if max(i, l - i) < best_len:
		best_len = max(i, l - i)
		sol_in = i
print(zbr(sol_in))


l = int(input())
n = input()

def solve(a):
	x = n[:a]
	y = n[a:]
	if x == '' or y == '':
		return None
	elif x[0] == '0' or y[0] == '0':
		return None
	while len(x) < len(y):
		x = '0' + x
	while len(y) < len(x):
		y = '0' + y
	(z, c) = ('', 0)
	for (xr, yr) in zip(x[::-1], y[::-1]):
		z += chr(48 + (int(xr) + int(yr) + c) % 10)
		c = (int(xr) + int(yr) + c) // 10
	if c == 1:
		z += '1'
	return z[::-1]

def minN(a):
	ms = None
	for s in a:
		if ms == None:
			ms = s
		elif s == None:
			pass
		elif len(s) < len(ms):
			ms = s
		elif len(s) > len(ms):
			pass
		elif s < ms:
			ms = s
	return ms
a = l // 2
while n[a] == '0':
	a -= 1
b = l - l // 2
while n[b] == '0':
	b += 1
	if b >= l:
		b = a
		break
r = minN([solve(a), solve(b)])
print(r)


n = int(input())
s = input()
len = 1000000000
ans = int(s)
for i in range(0, n - 1):
	if s[i + 1] != '0':
		len = min(len, max(i + 1, n - i - 1))
for i in range(0, n - 1):
	if max(i + 1, n - i - 1) == len and s[i + 1] != '0':
		ans = min(ans, int(s[0:i + 1]) + int(s[i + 1:n]))
print(ans)


from sys import stdin, stdout
import math
from itertools import combinations
from copy import deepcopy
import math

def print_special(ans):
	aux = []
	for i in range(len(ans)):
		if ans[i] == 0:
			pass
		else:
			for j in range(i, len(ans)):
				aux.append(str(ans[j]))
			print(''.join(aux))
			return

def get_bigger(ans1, ans2):
	aux1 = []
	aux2 = []
	for i in range(len(ans1)):
		if ans1[i] == 0:
			pass
		else:
			for j in range(i, len(ans1)):
				aux1.append(ans1[j])
			break
	for i in range(len(ans2)):
		if ans2[i] == 0:
			pass
		else:
			for j in range(i, len(ans2)):
				aux2.append(ans2[j])
			break
	if len(aux1) < len(aux2):
		return ans1
	elif len(aux1) > len(aux2):
		return ans2
	else:
		for i in range(len(aux1)):
			if aux1[i] < aux2[i]:
				return ans1
			elif aux1[i] > aux2[i]:
				return ans2
			else:
				continue
	return ans1

def do_sum(first, second, bigger):
	ans = [0] * (len(bigger) + 1)
	carry = 0
	for i in range(len(ans) - 1, 0, -1):
		temp = first[i - 1] + second[i - 1] + carry
		if temp > 9:
			unit = temp % 10
			carry = temp // 10
			ans[i] = unit
		else:
			ans[i] = temp
			carry = 0
	if carry > 0:
		ans[0] = carry
	return ans

def get_non_zero_left(index):
	if arr[index] != 0:
		return index
	for i in range(index - 1, -1, -1):
		if arr[i] != 0:
			return i
	return 0

def get_non_zero_right(index):
	if arr[index] != 0:
		return index
	for i in range(index + 1, len(arr)):
		if arr[i] != 0:
			return i
	return len(arr) - 1

def left_index(index):
	if index < len(arr):
		while index + 1 < len(arr):
			if arr[index + 1] != 0:
				return index
			index += 1
		return index
	return 0

def right_index(index):
	if index < len(arr):
		if arr[index] != 0:
			return index
		for i in range(index - 1, -1, -1):
			if arr[i] != 0:
				return i
	return 0
l = int(stdin.readline().strip())
arr = list(map(int, list(stdin.readline().strip())))
if l % 2 == 0:
	index = left_index(l // 2 - 1)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(l - 1, index, -1):
		second[j] = arr[i]
		j -= 1
	j = -1
	for i in range(index, -1, -1):
		first[j] = arr[i]
		j -= 1
	ans1 = do_sum(first, second, get_bigger(first, second))
	index = right_index(l // 2)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(index - 1, -1, -1):
		first[j] = arr[i]
		j -= 1
	j = -1
	for i in range(l - 1, index - 1, -1):
		second[j] = arr[i]
		j -= 1
	ans2 = do_sum(first, second, get_bigger(first, second))
	ans = get_bigger(ans1, ans2)
	print_special(ans)
else:
	index = left_index(l // 2)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(l - 1, index, -1):
		second[j] = arr[i]
		j -= 1
	j = -1
	for i in range(index, -1, -1):
		first[j] = arr[i]
		j -= 1
	ans1 = do_sum(first, second, get_bigger(first, second))
	index = right_index(l // 2 + 1)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(index - 1, -1, -1):
		first[j] = arr[i]
		j -= 1
	j = -1
	for i in range(l - 1, index - 1, -1):
		second[j] = arr[i]
		j -= 1
	ans2 = do_sum(first, second, get_bigger(first, second))
	ans_a = get_bigger(ans1, ans2)
	index = left_index(l // 2 - 1)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(l - 1, index, -1):
		second[j] = arr[i]
		j -= 1
	j = -1
	for i in range(index, -1, -1):
		first[j] = arr[i]
		j -= 1
	ans1 = do_sum(first, second, get_bigger(first, second))
	index = right_index(l // 2)
	second = [0] * max(l - index, index + 1)
	first = [0] * max(l - index, index + 1)
	j = -1
	for i in range(index - 1, -1, -1):
		first[j] = arr[i]
		j -= 1
	j = -1
	for i in range(l - 1, index - 1, -1):
		second[j] = arr[i]
		j -= 1
	ans2 = do_sum(first, second, get_bigger(first, second))
	ans_b = get_bigger(ans1, ans2)
	ans = get_bigger(ans_a, ans_b)
	print_special(ans)


n = int(input())
s = input()
p = [i for i in range(n) if s[i] != '0'][1:]
p = sorted(p, key=lambda x: abs(x - n / 2))
minn = int(s)
for i in range(min(4, len(p))):
	minn = min(minn, int(s[:p[i]]) + int(s[p[i]:]))
print(minn)


import math
import sys
l = int(input())
n = input().strip()
p1 = -1
p2 = -1
for i in reversed(range(1, l // 2 + 1)):
	if n[i] != '0':
		p1 = i
		break
for i in range(l // 2 + 1, l):
	if n[i] != '0':
		p2 = i
		break
n1 = int('9' * l)
n2 = int('9' * l)
if p1 != -1:
	n1 = int(n[:p1]) + int(n[p1:])
if p2 != -1:
	n2 = int(n[:p2]) + int(n[p2:])
print(min(n1, n2))


n = int(input())
l = input()
r = int(l)
c = 0
while n // 2 > c:
	(a, b) = (0, 0)
	if l[n // 2 - c] == '0':
		a = r
	else:
		a = int(l[:n // 2 - c]) + int(l[n // 2 - c:])
	if l[(n + 1) // 2 + c] == '0':
		b = r
	else:
		b = int(l[:(n + 1) // 2 + c]) + int(l[(n + 1) // 2 - c:])
	a = min(a, b)
	if a ^ r:
		r = a
		break
	c += 1
print(r)


input()
n = input()
x = []
for i in range(1, len(n)):
	if n[i] == '0':
		continue
	x.append((max(i, len(n) - i), i))
x.sort()
y = []
for (_, i) in x[:10]:
	y.append(int(n[:i]) + int(n[i:]))
print(min(y))


d = int(input())
n = input()
j = (d + 1) // 2
i = j - 1
while i > 0 and n[i] == '0':
	i -= 1
while j < d and n[j] == '0':
	j += 1
ans = int(n)
if j < d:
	ans = min(ans, int(n[:j]) + int(n[j:]))
if i > 0:
	ans = min(ans, int(n[:i]) + int(n[i:]))
print(ans)


l = int(input())
s = input()
L = l // 2
R = l // 2 + 1
R = min(l - 1, R)
while s[L] == '0' and L > 1:
	L -= 1
while s[R] == '0' and R < l - 1:
	R += 1
a = int(s[0:L]) + int(s[L:l])
b = int(s[0:R]) + int(s[R:l])
if s[L] == '0':
	print(b)
elif s[R] == '0':
	print(a)
else:
	print(min(a, b))


length = int(input())
number = list(filter(lambda x: x, input()))

def make_num(tab):
	if tab:
		return int(''.join(tab) if tab else '0') if tab[0] != '0' else float('inf')
	return 0

def solve(number, n):
	current_min = float('inf')
	for (index_right, digit_right) in enumerate(number[n // 2:]):
		if digit_right != '0':
			break
	index_right += n // 2
	for (index_left, digit_left) in enumerate(reversed(number[:n // 2])):
		if digit_left != '0':
			break
	index_left = n // 2 - index_left - 1
	current_min = min(make_num(number[index_right:]) + make_num(number[:index_right]), make_num(number[index_left:]) + make_num(number[:index_left]))
	for i in range(1, 4):
		try:
			current_min = min(make_num(number[index_right + i:]) + make_num(number[:index_right + i]), current_min)
		except:
			break
	for i in range(1, 4):
		try:
			current_min = min(make_num(number[index_right - i:]) + make_num(number[:index_right - i]), current_min)
		except:
			break
	for i in range(1, 4):
		try:
			current_min = min(make_num(number[index_left + i:]) + make_num(number[:index_left + i]), current_min)
		except:
			break
	for i in range(1, 4):
		try:
			current_min = min(make_num(number[index_left - i:]) + make_num(number[:index_left - i]), current_min)
		except:
			break
	return current_min
print(solve(number, length))


def main():
	N = int(input())
	S = str(input())
	mid = 100010
	C = 10 ** mid
	for i in range(1, N):
		if S[i] != '0':
			mid = min(mid, max(i, N - i) + 2)
	for i in range(1, N):
		if S[i] != '0' and max(i, N - i) <= mid:
			T = int(S[:i]) + int(S[i:])
			C = min(C, T)
	print(C)
main()


import os

def _f(l, n):
	sn = str(n)
	i1 = l // 2 - int(not l % 2)
	i2 = l // 2
	r1 = None
	while i1 >= 0 and sn[i1 + 1] == '0':
		i1 -= 1
	if i1 >= 0:
		r1 = int(sn[:i1 + 1]) + int(sn[i1 + 1:])
	r2 = None
	while i2 < l and sn[i2] == '0':
		i2 += 1
	if i2 < l:
		r2 = int(sn[0:i2]) + int(sn[i2:])
	if r1 and r2:
		return min(r1, r2)
	else:
		return r1 if r1 else r2

def f(l, n):
	return _f(l, n)
if os.environ.get('DEBUG', False):
	print(f'{f(2, 11)} = 2')
	print(f'{f(6, 110000)} = 10001')
	print(f'{f(4, 1234)} = 46')
	print(f'{f(4, 1204)} = 124')
	print(f'{f(5, 10101)} = 111')
	print(f'{f(5, 12345)} = 168')
	print(f'{f(7, 1234567)} = 1801')
	print(f'{f(3, 101)} = 11')
else:
	l = int(input())
	n = int(input())
	print(f(l, n))


n = int(input())
import math
counter = math.inf
counter1 = 0
a = input()
for i in range(n // 2, n):
	if a[i] != '0':
		counter = min(counter, int(a[:i]) + int(a[i:]))
		if i != n // 2:
			break
for i in range(n // 2, 0, -1):
	if a[i] != '0':
		counter = min(counter, int(a[:i]) + int(a[i:]))
		break
print(counter)


l = int(input())
n = input()
if n[l // 2] != '0' and n[l // 2 - 1] != '0':
	print(min(int(n[:l // 2 + 1]) + int(n[l // 2 + 1:]), int(n[:l // 2]) + int(n[l // 2:])))
else:
	i = l // 2
	while n[i] == '0':
		i -= 1
	if i != 0:
		a = int(n[:i]) + int(n[i:])
	else:
		a = int(n)
	i = l // 2
	while i < l and n[i] == '0':
		i += 1
	if i != l:
		b = int(n[:i]) + int(n[i:])
	else:
		b = int(n)
	print(min(a, b))


l = int(input())
n = input()
res = 0
mn = int(n)
find = False
for i in range(l // 2, l):
	if find and i > l // 2 + 3:
		break
	if n[i] != '0':
		mn = min(mn, int(n[:i]) + int(n[i:]))
		find = True
for i in range(l // 2, 0, -1):
	if n[i] != '0':
		mn = min(mn, int(n[:i]) + int(n[i:]))
		break
print(mn)


n = int(input())
l = input()
i = n // 2
c = i
if l[i] == '0':
	while i < n and l[i] == '0':
		i += 1
	if i == n:
		i = 1
	while l[c] == '0':
		c -= 1
	if c == 0:
		c = i
	x = int(l[:c])
	y = int(l[c:])
	s4 = x + y
	x = int(l[:i])
	y = int(l[i:])
	s2 = x + y
	print(min(s4, s2))
else:
	x = int(l[:i])
	y = int(l[i:])
	s1 = x + y
	x = int(l[:i + 1])
	y = int(l[i + 1:])
	s3 = x + y
	print(min(s1, s3))


def de(n, le):
	if n % 2 == 0:
		if le % 2 == 0:
			return le // 2 - 1 - n // 2
		else:
			return le // 2 - n // 2
	elif le % 2 == 0:
		return le // 2 + n // 2
	else:
		return (le + 1) // 2 + n // 2
l = int(input())
n = input()
ans = []
for i in range(l):
	d = de(i, l)
	if d == l - 1:
		continue
	if n[d + 1] != '0':
		s1 = n[:d + 1]
		s2 = n[d + 1:]
		if not s1 or not s2:
			continue
		ans.append(int(s1) + int(s2))
	if len(ans) > 3:
		break
print(min(ans))


n = int(input())
s = input()
ok = False
if n % 2:
	if s[n // 2] != '0':
		print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])))
		ok = True
elif s[n // 2] != '0':
	s1 = s[:n // 2]
	s2 = s[n // 2:]
	print(int(s1) + int(s2))
	ok = True
if ok == False:
	r = l = n // 2
	while l >= 0:
		if s[l] != '0':
			break
		l -= 1
	while r < n:
		if s[r] != '0':
			break
		r += 1
	mn = int(s)
	if l != 0:
		mn = min(mn, int(s[:l]) + int(s[l:]))
	if r != n:
		mn = min(mn, int(s[:r]) + int(s[r:]))
	print(mn)


l = int(input())
n = input()
t = int(l / 2)
if l == 2:
	print(int(n[0]) + int(n[1]))
elif l == 3:
	if n[1] == '0':
		print(int(n[0:2]) + int(n[2]))
	else:
		print(min(int(n[0:2]) + int(n[2]), int(n[0]) + int(n[1:3])))
elif l % 2 == 0:
	if n[t] != '0':
		print(int(n[0:t]) + int(n[t:l]))
	else:
		for i in range(1, t):
			if n[t + i] != '0' or n[t - i] != '0':
				if n[t + i] != '0' and n[t - i] != '0':
					print(min(int(n[0:t - i]) + int(n[t - i:l]), int(n[0:t + i]) + int(n[t + i:l])))
				elif n[t + i] != '0' and n[t - i] == '0':
					print(int(n[0:t + i]) + int(n[t + i:l]))
				elif n[t + i] == '0' and n[t - i] != '0':
					print(int(n[0:t - i]) + int(n[t - i:l]))
				break
else:
	for i in range(0, t):
		if n[t + 1 + i] != '0' or n[t - i] != '0':
			if n[t + 1 + i] != '0' and n[t - i] != '0':
				print(min(int(n[0:t - i]) + int(n[t - i:l]), int(n[0:t + 1 + i]) + int(n[t + 1 + i:l])))
			elif n[t + 1 + i] != '0' and n[t - i] == '0':
				print(int(n[0:t + 1 + i]) + int(n[t + 1 + i:l]))
			elif n[t + 1 + i] == '0' and n[t - i] != '0':
				print(int(n[0:t - i]) + int(n[t - i:l]))
			break


import sys
L = int(input())
S = input()
res = 0
if L % 2 == 1:
	for i in range(int(L / 2)):
		if S[int(L / 2) + i + 1] != '0' or S[int(L / 2) - i] != '0':
			if S[int(L / 2) + i + 1] != '0':
				res = int(S[0:int(L / 2) + i + 1]) + int(S[int(L / 2) + i + 1:L])
				if S[int(L / 2) - i] != '0' and int(S[0:int(L / 2) - i]) + int(S[int(L / 2) - i:L]) < res:
					res = int(S[0:int(L / 2) - i]) + int(S[int(L / 2) - i:L])
			else:
				res = int(S[0:int(L / 2) - i]) + int(S[int(L / 2) - i:L])
			print(res)
			sys.exit()
elif S[int(L / 2)] != '0':
	res = int(S[0:int(L / 2)]) + int(S[int(L / 2):L])
	print(res)
	sys.exit()
else:
	for i in range(int(L / 2) - 1):
		if S[int(L / 2) + i + 1] != '0' or S[int(L / 2) - i - 1] != '0':
			if S[int(L / 2) + i + 1] != '0':
				res = int(S[0:int(L / 2) + i + 1]) + int(S[int(L / 2) + i + 1:L])
				if S[int(L / 2) - i - 1] != '0' and int(S[0:int(L / 2) - i - 1]) + int(S[int(L / 2) - i - 1:L]) < res:
					res = int(S[0:int(L / 2) - i - 1]) + int(S[int(L / 2) - i - 1:L])
			else:
				res = int(S[0:int(L / 2) - i - 1]) + int(S[int(L / 2) - i - 1:L])
			print(res)
			sys.exit()


def main():
	n = int(input())
	x = input()
	mid = n // 2
	cnt = 0
	ans = None
	for i in range(mid + 2):
		j = mid + i
		if j < n and x[j] != '0':
			val = int(x[:j]) + int(x[j:])
			cnt += 1
			if ans is None:
				ans = val
			else:
				ans = min(ans, val)
		j = mid - i
		if j > 0 and x[j] != '0':
			val = int(x[:j]) + int(x[j:])
			cnt += 1
			if ans is None:
				ans = val
			else:
				ans = min(ans, val)
		if cnt >= 7:
			break
	print(ans)
main()


l = int(input())
n = input()
if l % 2 == 0:
	(res1, res2) = (n[:l // 2], n[l // 2:])
	(i, j) = (l // 2 - 1, 0)
else:
	(a, b) = (n[:l // 2 + 1], n[l // 2:])
	if int(a) < int(b):
		(res1, res2) = (a, n[l // 2 + 1:])
		(i, j) = (l // 2, 0)
	else:
		(res1, res2) = (n[:l // 2], b)
		(i, j) = (l // 2 - 1, 0)
(x1, y1, x2, y2) = (res1, res2, res1, res2)
for u in range(l // 2):
	if res1[i] == '0':
		x1 = x1[:-1]
		y1 = '0' + y1
		i -= 1
	if res2[j] == '0':
		x2 += '0'
		y2 = y2[1:]
		j += 1
if y1[0] == '0':
	a = x1[i]
	(x1, y1) = (x1[:-1], a + y1)
if x1 == '':
	print(int(x2) + int(y2))
elif y2 == '':
	print(int(x1) + int(y1))
else:
	print(min(int(x2) + int(y2), int(x1) + int(y1)))


def get_sum(string, d):
	s1 = s[:d]
	s2 = s[d:]
	if s1 == '' or s2 == '' or s2[0] == '0':
		return int(string)
	return int(s1) + int(s2)

def solve(string):
	if len(string) == 2:
		return int(s[0]) + int(s[1])
	x = len(string) // 2
	x1 = x
	while x < len(string) and string[x] == '0':
		x += 1
	while x1 > 0 and string[x1] == '0':
		x1 -= 1
	s1 = get_sum(string, x)
	s2 = get_sum(string, x1)
	s3 = get_sum(string, x - 1)
	s4 = get_sum(string, x + 1)
	return min(s1, s2, s3, s4)
input()
s = input()
print(str(solve(s)))


def digits2num(digit_list):
	n = len(digit_list) - 1
	ans = 0
	for i in range(len(digit_list)):
		ans += digit_list[i] * 10 ** n
		n -= 1
	return ans

def magic(numList):
	s = map(str, numList)
	s = ''.join(s)
	s = int(s)
	return s

def split_number(digits, n):
	if n % 2 == 0:
		mid = n // 2
		if digits[mid] != 0:
			return magic(digits[0:mid]) + magic(digits[mid:n])
		else:
			i = 1
			while digits[mid - i] == 0 and digits[mid + i] == 0:
				i += 1
			if digits[mid - i] != 0 and digits[mid + i] == 0:
				return magic(digits[0:mid - i]) + magic(digits[mid - i:n])
			if digits[mid + i] != 0 and digits[mid - i] == 0:
				return magic(digits[0:mid + i]) + magic(digits[mid + i:n])
			if digits[mid - i] != 0 and digits[mid + i] != 0:
				sum1 = magic(digits[0:mid - i]) + magic(digits[mid - i:n])
				sum2 = magic(digits[0:mid + i]) + magic(digits[mid + i:n])
				return min(sum1, sum2)
	else:
		mid = (n - 1) // 2
		if digits[mid] != 0:
			if digits[mid + 1] == 0:
				return magic(digits[0:mid]) + magic(digits[mid:n])
			else:
				sum1 = magic(digits[0:mid]) + magic(digits[mid:n])
				sum2 = magic(digits[0:mid + 1]) + magic(digits[mid + 1:n])
				return min(sum1, sum2)
		else:
			i = 1
			while digits[mid - i] == 0 and digits[mid + i] == 0:
				i += 1
			if digits[mid + i] != 0:
				return magic(digits[0:mid + i]) + magic(digits[mid + i:n])
			elif digits[mid + i + 1] == 0:
				return magic(digits[0:mid - i]) + magic(digits[mid - i:n])
			else:
				sum1 = magic(digits[0:mid - i]) + magic(digits[mid - i:n])
				sum2 = magic(digits[0:mid + i + 1]) + magic(digits[mid + i + 1:n])
				return min(sum1, sum2)
n = int(input())
digits = [int(x) for x in list(input())]
print(split_number(digits, n))


p = int(input())
n = int(input())
s = str(n)
c = n
k = p // 2
while k < p and s[k] == '0':
	k += 1
if k < p:
	y = int(s[k:])
	x = int(s[:k])
	c = min(c, x + y)
k = p // 2
k += 1
while k < p and s[k] == '0':
	k += 1
if k < p:
	y = int(s[k:])
	x = int(s[:k])
	c = min(c, x + y)
k = p // 2
k -= 1
while k > 0 and s[k] == '0':
	k -= 1
if k > 0:
	y = int(s[k:])
	x = int(s[:k])
	c = min(c, x + y)
print(c)


(n, s, a) = (int(input()), input(), 9 ** 9)
for i in range(1, n):
	if s[i] != '0':
		if max(a, n - a) > max(i, n - i):
			a = i
		elif max(a, n - a) == max(i, n - i) and int(s[:a]) + int(s[a:]) > int(s[:i]) + int(s[i:]):
			a = i
print(int(s[:a]) + int(s[a:]))


n = int(input())
s = input()
p = len(s) // 2
(i, j) = (1, 0)
while p + i < len(s) and s[p + i] == '0':
	i += 1
while p - j >= 0 and s[p - j] == '0':
	j += 1
(s1, s2) = (s[:i + p], s[i + p:])
(s3, s4) = (s[:p - j], s[p - j:])
(n1, n2) = (0, 0)
if s1 != '':
	n1 += int(s1)
if s2 != '':
	n1 += int(s2)
if s3 != '':
	n2 += int(s3)
if s4 != '':
	n2 += int(s4)
if n1 < n2:
	print(n1)
else:
	print(n2)


n = int(input())
s = input()
ans = 1e309
ind1 = n // 2
ind2 = n // 2 + 1
while ind1 >= 0 and s[ind1] == '0':
	ind1 -= 1
while ind2 < n and s[ind2] == '0':
	ind2 += 1
if ind1 >= 1:
	ans = min(ans, int(s[:ind1]) + int(s[ind1:]))
if ind2 < n:
	ans = min(ans, int(s[:ind2]) + int(s[ind2:]))
print(ans)


import math
n = int(input())
s = input()
i = (n + 1) // 2
j = n // 2
while i < n and s[i] == '0':
	i += 1
while j > 0 and s[j] == '0':
	j -= 1
ans = math.inf
if j != 0:
	ans = min(ans, int(s[j:]) + int(s[:j]))
if i != n:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


n = int(input())
A = str(input())
v = int(A)
for (k, i) in ((-1, n // 2), (1, (n + 1) // 2)):
	while i < n and '1' > A[i]:
		i += k
	if 0 < i < n:
		v = min(v, int(A[:i]) + int(A[i:]))
print(v)


from sys import stdout, stdin
l = int(stdin.readline())
s = stdin.readline()
i = l // 2
j = (l + 1) // 2
while 1:
	if i >= 0 and s[i] != '0' and (s[j] != '0') and (j < l):
		x = int(s[:i]) + int(s[i:])
		y = int(s[:j]) + int(s[j:])
		if x < y:
			stdout.write(str(x))
		else:
			stdout.write(str(y))
		break
	elif i >= 0 and s[i] != '0':
		x = int(s[:i]) + int(s[i:])
		stdout.write(str(x))
		break
	elif j < l and s[j] != '0':
		x = int(s[:j]) + int(s[j:])
		stdout.write(str(x))
		break
	i -= 1
	j += 1


n = int(input())
s = input()
res = int(s)
center = int(n / 2)
q1 = s[:center]
q2 = s[center:]
if q2[0] != '0':
	res = min(res, int(q1) + int(q2))
else:
	while s[center] == '0' and center < n - 1:
		center += 1
	q1 = s[:center]
	q2 = s[center:]
	if q2[0] != '0':
		res = min(res, int(q1) + int(q2))
	center = int(n / 2)
	while s[center] == '0' and center > 1:
		center -= 1
	q1 = s[:center]
	q2 = s[center:]
	if q2[0] != '0':
		res = min(res, int(q1) + int(q2))
center = int(n / 2) + 1
if center < n:
	q1 = s[:center]
	q2 = s[center:]
	if q2[0] != '0':
		res = min(res, int(q1) + int(q2))
	else:
		while s[center] == '0' and center < n - 1:
			center += 1
		q1 = s[:center]
		q2 = s[center:]
		if q2[0] != '0':
			res = min(res, int(q1) + int(q2))
		center = int(n / 2) + 1
		while s[center] == '0' and center > 1:
			center -= 1
		q1 = s[:center]
		q2 = s[center:]
		if q2[0] != '0':
			res = min(res, int(q1) + int(q2))
center = int(n / 2) - 1
if center > 0:
	q1 = s[:center]
	q2 = s[center:]
	if q2[0] != '0':
		res = min(res, int(q1) + int(q2))
	else:
		while s[center] == '0' and center < n - 1:
			center += 1
		q1 = s[:center]
		q2 = s[center:]
		if q2[0] != '0':
			res = min(res, int(q1) + int(q2))
		center = int(n / 2) - 1
		while s[center] == '0' and center > 1:
			center -= 1
		q1 = s[:center]
		q2 = s[center:]
		if q2[0] != '0':
			res = min(res, int(q1) + int(q2))
print(res)


def sum(str1, str2):
	if len(str1) > len(str2):
		t = str1
		str1 = str2
		str2 = t
	str = ''
	n1 = len(str1)
	n2 = len(str2)
	str1 = str1[::-1]
	str2 = str2[::-1]
	carry = 0
	for i in range(n1):
		sum = ord(str1[i]) - 48 + (ord(str2[i]) - 48 + carry)
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	for i in range(n1, n2):
		sum = ord(str2[i]) - 48 + carry
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	if carry:
		str += chr(carry + 48)
	str = str[::-1]
	return str

def compare(str1, str2):
	if len(str1) > len(str2):
		return str2
	elif len(str1) < len(str2):
		return str1
	for i in range(len(str1)):
		if str1[i] > str2[i]:
			return str2
		elif str1[i] < str2[i]:
			return str1
	return str1
n = int(input())
str = input()
result1 = ''
result2 = ''
bl1 = False
bl2 = False
if n % 2 == 0:
	u = n // 2
	v = u
else:
	u = n // 2
	v = u + 1
while 1:
	if str[u] != '0' and u != 0:
		result1 = sum(str[0:u], str[u:len(str)])
		bl1 = True
		break
	else:
		if u == 0:
			break
		u -= 1
while 1:
	if str[v] != '0':
		result2 = sum(str[0:v], str[v:len(str)])
		bl2 = True
		break
	else:
		v += 1
	if v == n:
		break
if bl1 == True and bl2 == True:
	print(compare(result1, result2))
elif bl1 == True:
	print(result1)
elif bl2 == True:
	print(result2)


import sys
l = int(input())
n = int(input())
s = str(n)
length = len(s)
pos1 = max(length // 2 - 1, 1)
pos2 = min(length // 2 + 1, length - 1)
while pos1 > 1 and s[pos1] == '0':
	pos1 -= 1
while pos2 < length - 1 and s[pos2] == '0':
	pos2 += 1
sum = n
for p in range(pos1, pos2 + 1):
	if s[p] != '0':
		sum = min(sum, int(s[0:p]) + int(s[p:length]))
print(sum)
sys.exit(0)


import math
l = int(input())
n = input()
h = int(l / 2)
if l % 2 == 0:
	x = int(l / 2) - 1
	y = int(l / 2)
else:
	x = int(l / 2)
	y = int(l / 2) + 1
while x > 0 and n[x] == '0':
	x = x - 1
while y < l and n[y] == '0':
	y = y + 1
min1 = math.inf
min2 = math.inf
if x != 0:
	min1 = int(n[:x]) + int(n[x:])
if y != l:
	min2 = int(n[:y]) + int(n[y:])
min3 = math.inf
if l % 2 == 0 and n[h] != '0':
	min3 = int(n[:h]) + int(n[h:])
print(min(min1, min2, min3))


import math
n = int(input())
num = int(input())
s = str(num)
ans = num
tp = 0
a = []
t = n
cnt = 0
for i in range(1, n):
	if s[i] != '0':
		a.append(i)
		cnt += 1

def go(x):
	return max(x, n - x) - min(x, n - x)

def cal(x):
	return int(s[:x]) + int(s[x:])
if cnt == 1:
	print(cal(a[0]))
else:
	for i in range(cnt):
		pos = a[i]
		tp = go(pos)
		if t > tp:
			t = tp
		elif t == tp:
			ans = min(cal(a[i - 1]), cal(a[i]))
			break
		else:
			ans = cal(a[i - 1])
			break
	print(ans)


input()
s = input()
x = []
for i in range(1, len(s)):
	if s[i] == '0':
		continue
	x += [(max(i, len(s) - i), i)]
x.sort()
y = []
for (j, i) in x[:10]:
	y += [int(s[:i]) + int(s[i:])]
y.sort()
print(y[0])


l = int(input())
n = str(input())
ans = int(n)
mid = int(l / 2 + 1)
while mid < int(l):
	if n[mid] == '0':
		mid += 1
		continue
	l1 = n[0:mid]
	l2 = n[mid:]
	ans1 = int(l1) + int(l2)
	ans = min(ans, ans1)
	mid += 1
	break
mid = int(l / 2)
while mid > 0:
	if n[mid] == '0':
		mid -= 1
		continue
	l1 = n[0:mid]
	l2 = n[mid:]
	ans1 = int(l1) + int(l2)
	ans = min(ans, ans1)
	mid -= 1
	break
print(ans)


n = int(input())
s = input()
a = s[:n // 2 + n % 2]
b = s[n // 2 + n % 2:]
ch1 = ch3 = int(a)
ch2 = ch4 = int(b)
fa = 0
for i in range(len(a) - 1, 0, -1):
	if a[i] != '0':
		fa = i
		break
for i in range(len(b)):
	if b[i] != '0':
		fb = i
		break
if b[0] == '0':
	if fa != 0:
		ch1 = int(a[:fa])
	else:
		ch1 = int(s) + 1
	ch2 = int(a[fa:] + b)
	if b.count('0') != len(b):
		ch3 = int(a + b[:fb])
		ch4 = int(b[fb:])
		print(min(ch1 + ch2, ch3 + ch4))
	else:
		print(ch1 + ch2)
elif a[-1] == '0':
	print(ch1 + ch2)
else:
	print(min(ch1 + ch2, int(s[:n // 2]) + int(s[n // 2:])))


def calc(i):
	res = -1
	a = s[0:i + 1]
	b = s[i + 1:]
	if b[0] != '0':
		if res == -1:
			res = int(a) + int(b)
		else:
			res = min(int(a) + int(b), res)
	return res
n = int(input())
s = input()
x = n // 2
y = (n + 1) // 2
a = []
for i in range(n):
	l = x - i - 1
	r = y + i - 1
	t1 = -1
	t2 = -1
	if l >= 0:
		t1 = calc(l)
	if r < n - 1:
		t2 = calc(r)
	if t1 != -1:
		a.append(t1)
	if t2 != -1:
		a.append(t2)
	if len(a) > 5:
		break
a.sort()
print(a[0])


n = int(input())
s = str(input())
ans = -1
cnt = 0
le = len(s)
i = max(1, le // 2)
while i < le and cnt < 7:
	while i + 1 < le and s[i] == '0':
		i += 1
	l = s[:i]
	r = s[i:]
	cnt += 1
	i += 1
	if l[0] == '0' or r[0] == '0':
		continue
	if ans == -1:
		ans = int(l) + int(r)
	else:
		ans = min(ans, int(l) + int(r))
i = max(1, le // 2)
cnt = 0
while i < le and cnt < 7:
	while i > 1 and s[i] == '0':
		i -= 1
	if i <= 0 or s[i] == '0':
		break
	l = s[:i]
	r = s[i:]
	cnt += 1
	i -= 1
	if l[0] == '0' or r[0] == '0':
		continue
	if ans == -1:
		ans = int(l) + int(r)
	else:
		ans = min(ans, int(l) + int(r))
assert ans != -1
print(ans)


n = int(input())
string = input()
n = len(string)
res = 0

def getMin(left, right):
	left1 = left
	right1 = right
	left2 = left
	right2 = right
	while right1.startswith('0') and len(right1) > 1:
		left1 = left1 + right1[0]
		right1 = right1[1:len(right1)]
	while right2.startswith('0') and len(left2) > 1:
		right2 = left2[len(left2) - 1] + right2
		left2 = left2[0:len(left2) - 1]
	if not right2.startswith('0') and (not right1.startswith('0')):
		res = min(int(left1) + int(right1), int(left2) + int(right2))
	elif not right2.startswith('0'):
		res = int(left2) + int(right2)
	elif not right1.startswith('0'):
		res = int(left1) + int(right2)
	return res
if n % 2 == 0:
	left = string[0:int(n / 2)]
	right = string[int(n / 2):n]
	if not right.startswith('0'):
		res = int(left) + int(right)
	else:
		res = getMin(left, right)
else:
	left1 = string[0:int(n / 2) + 1]
	right1 = string[int(n / 2) + 1:n]
	left2 = string[0:int(n / 2)]
	right2 = string[int(n / 2):n]
	res = min(getMin(left1, right1), getMin(left2, right2))
print(res)


nn = int(input())
n = input()
d = list(n)
if nn % 2 == 0:
	p = nn // 2
	if n[p] == '0':
		q = p - 1
		while n[p] == '0' and n[q] == '0':
			p = p + 1
			q = q - 1
		if n[p] == '0':
			print(int(n[:q]) + int(n[q:]))
		else:
			print(int(n[:p]) + int(n[p:]))
	else:
		print(int(n[:p]) + int(n[p:]))
else:
	p = nn // 2
	if n[p] == '0':
		q = p
		while n[p] == '0' and n[q] == '0':
			p = p + 1
			q = q - 1
		if n[p] == '0':
			print(int(n[:q]) + int(n[q:]))
		else:
			print(int(n[:p]) + int(n[p:]))
	elif n[p] > n[0]:
		print(int(n[:p + 1]) + int(n[p + 1:]))
	elif n[p] == n[0]:
		if int(n[:p + 1]) > int(n[p:]):
			print(int(n[:p]) + int(n[p:]))
		else:
			print(int(n[:p + 1]) + int(n[p + 1:]))
	else:
		print(int(n[:p]) + int(n[p:]))


l = int(input())
number = int(input())
s = str(number)

def nextNum(num):
	if num < l / 2:
		return l - num
	else:
		return l - 1 - num
m = l // 2
while s[m] == '0':
	m = nextNum(m)
f = int(s[:m]) + int(s[m:])
next = nextNum(m)
if next > 0 and s[next] != '0':
	g = int(s[:next]) + int(s[next:])
	print(min(f, g))
else:
	print(f)


L = int(input())
n = input()
ans = int(n)

def v(k):
	if k[0] == '0':
		return False
	return True
if L % 2 == 0:
	for i in range(L // 2):
		split1 = L // 2 + i
		split2 = L // 2 - i
		if n[split1] != '0':
			sum1 = int(n[:split1]) + int(n[split1:])
			if ans > sum1:
				ans = sum1
				if n[split2] != '0':
					sum2 = int(n[:split2]) + int(n[split2:])
					if ans > sum2:
						ans = sum2
				break
		if n[split2] != '0':
			sum2 = int(n[:split2]) + int(n[split2:])
			if ans > sum2:
				ans = sum2
				break
else:
	for i in range(L // 2):
		split1 = L // 2 + i + 1
		split2 = L // 2 - i
		if n[split1] != '0':
			sum1 = int(n[:split1]) + int(n[split1:])
			if ans > sum1:
				ans = sum1
				split1 = -1
				if n[split2] != '0':
					sum2 = int(n[:split2]) + int(n[split2:])
					if ans > sum2:
						ans = sum2
				break
		if n[split2] != '0':
			sum2 = int(n[:split2]) + int(n[split2:])
			if ans > sum2:
				ans = sum2
				break
print(ans)


n = int(input())
s = input()
len1 = n // 2
len2 = (n + 1) // 2
S = 10 ** 100000

def calc(d):
	nonlocal S
	h = d
	while h < n and s[h] == '0':
		h += 1
	if h < n:
		S = min(S, int(s[h:]) + int(s[:h]))
	h = d
	while 0 <= h and s[h] == '0':
		h -= 1
	if 0 < h:
		S = min(S, int(s[h:]) + int(s[:h]))
calc(len1)
calc(len2)
print(S)


def smallest(a, b):
	if len(a) < len(b):
		return a
	elif len(b) < len(a):
		return b
	else:
		i = 0
		while i < len(a) and a[i] == b[i]:
			i += 1
		if i >= len(a):
			return a
		if a[i] < b[i]:
			return a
		elif a[i] > b[i]:
			return b

def addingFunc(number1, number2):
	n1 = len(number1)
	n2 = len(number2)
	greater = number2
	smaller = number1
	if n1 > n2:
		greater = number1
		smaller = number2
	diff = abs(n1 - n2)
	result = ''
	c = 0
	for i in range(len(smaller) - 1, -1, -1):
		sumVal = str(int(greater[diff + i]) + int(smaller[i]) + c)
		c = 0
		if len(sumVal) > 1:
			c = int(sumVal[0])
			sumVal = sumVal[1]
		result += sumVal
	for i in range(diff - 1, -1, -1):
		sumVal = str(int(greater[i]) + c)
		c = 0
		if len(sumVal) >= 2:
			c = int(sumVal[0])
			sumVal = sumVal[1]
		result += sumVal
	if c > 0:
		result += str(c)
	return result[::-1]

def main():
	l = int(input())
	string = input()
	if l % 2 == 0:
		part1 = string[0:int(l // 2)]
		part2 = string[int(l // 2):]
		l1 = 0
		while int(l // 2) + l1 < len(string) and string[int(l // 2) + l1] == '0':
			l1 += 1
		l2 = 0
		while int(l // 2) - l2 < len(string) and string[int(l // 2) - l2] == '0':
			l2 += 1
		small = min(l1 + 1, l2)
		if small == l1 + 1:
			small -= 1
			part1 = string[:int(l // 2) + small]
			part2 = string[int(l // 2) + small:]
		else:
			part1 = string[int(l // 2) - small:]
			part2 = string[:int(l // 2) - small]
		print(addingFunc(part1, part2))
	else:
		first = string[0:int(l / 2) + 1]
		second = string[int(l / 2):]
		cut1 = l // 2 + 1
		cut2 = l // 2
		l1 = 0
		while int(cut1) + l1 < len(string) and string[int(cut1) + l1] == '0':
			l1 += 1
		l2 = 0
		while int(cut1) - l2 >= 0 and string[int(cut1) - l2] == '0':
			l2 += 1
		small = min(l1, l2)
		if small == l1:
			c1part1 = string[:int(cut1) + small]
			c1part2 = string[int(cut1) + small:]
		else:
			c1part1 = string[int(cut1) - small:]
			c1part2 = string[:int(cut1) - small]
		l1 = 0
		while int(cut2) + l1 < len(string) and string[int(cut2) + l1] == '0':
			l1 += 1
		l2 = 0
		while int(cut2) - l2 >= 0 and string[int(cut2) - l2] == '0':
			l2 += 1
		small = min(l1, l2)
		if small == l1:
			c2part1 = string[:int(cut2) + small]
			c2part2 = string[int(cut2) + small:]
		else:
			c2part1 = string[int(cut2) - small:]
			c2part2 = string[:int(cut2) - small]
		print(smallest(addingFunc(c1part1, c1part2), addingFunc(c2part1, c2part2)))
main()


from math import *
n = int(input())
f = input()
m = int(f)
ans = -1
c = 0
for i in range(n // 2, n, 1):
	if f[i] != '0':
		a = m // 10 ** (n - i)
		b = m % 10 ** (n - i)
		c += 1
		if ans == -1:
			ans = a + b
		else:
			ans = min(ans, a + b)
		if c >= 2:
			break
for i in range(n // 2, 0, -1):
	if f[i] != '0':
		a = m // 10 ** (n - i)
		b = m % 10 ** (n - i)
		c += 1
		if ans == -1:
			ans = a + b
		else:
			ans = min(ans, a + b)
		if c >= 2:
			break
print(ans)


n = int(input())
a = input()
pos = n // 2
ans = -1
for it in range(n // 2, n // 2 - 5, -1):
	while pos >= 0 and a[pos] == '0':
		pos -= 1
	if pos < 0:
		break
	if pos > 0:
		cur = int(a[0:pos]) + int(a[pos:len(a)])
		if ans == -1:
			ans = cur
		else:
			ans = min(ans, cur)
	pos -= 1
pos = n // 2
for it in range(n // 2, n // 2 + 5):
	while pos < n and a[pos] == '0':
		pos += 1
	if pos >= n:
		break
	if pos > 0:
		cur = int(a[0:pos]) + int(a[pos:len(a)])
		if ans == -1:
			ans = cur
		else:
			ans = min(ans, cur)
	pos += 1
print(ans)


n = int(input())
s = input()
if n % 2 == 0:
	t1 = n // 2 - 1
	t2 = n // 2
	while s[t1] == '0':
		t1 -= 1
	while t2 < n and s[t2] == '0':
		t2 += 1
	if t2 == n:
		ans = int(s[:t1]) + int(s[t1:])
	elif t1 > 0:
		ans = min(int(s[:t2]) + int(s[t2:]), int(s[:t1]) + int(s[t1:]))
	else:
		ans = int(s[:t2]) + int(s[t2:])
else:
	t1 = n // 2 - 1
	t2 = n // 2
	while s[t1] == '0':
		t1 -= 1
	while t2 < n and s[t2] == '0':
		t2 += 1
	if t2 == n:
		ans = int(s[:t1]) + int(s[t1:])
	elif t1 > 0:
		ans = min(int(s[:t2]) + int(s[t2:]), int(s[:t1]) + int(s[t1:]))
	else:
		ans = int(s[:t2]) + int(s[t2:])
	t1 = n // 2
	t2 = n // 2 + 1
	while s[t1] == '0':
		t1 -= 1
	while t2 < n and s[t2] == '0':
		t2 += 1
	if t2 == n:
		ans = min(ans, int(s[:t1]) + int(s[t1:]))
	elif t1 > 0:
		ans = min(ans, int(s[:t2]) + int(s[t2:]), int(s[:t1]) + int(s[t1:]))
	else:
		ans = min(ans, int(s[:t2]) + int(s[t2:]))
print(ans)


minn = 10 ** 100001
n = int(input())
a = input()
for i in range(int((n + 1) / 2) - 1, n - 1):
	if a[i + 1] == '0':
		continue
	buf = int(a[i + 1:n]) + int(a[0:i + 1])
	if buf < minn:
		minn = buf
	break
for i in range(int(n / 2) - 1, -1, -1):
	if a[i + 1] == '0':
		continue
	buf = int(a[i + 1:n]) + int(a[0:i + 1])
	if buf < minn:
		minn = buf
	break
print(minn)


n = int(input())
s = input().strip()
ans = int(s)
mid = n // 2 + 1
mid1 = n // 2
while mid < n and s[mid] == '0':
	mid = mid + 1
while mid1 > 0 and s[mid1] == '0':
	mid1 = mid1 - 1
try:
	if mid1 > 0:
		ans = min(ans, int(s[0:mid1]) + int(s[mid1:]))
	if mid < n:
		ans = min(ans, int(s[0:mid]) + int(s[mid:]))
except:
	pass
print(ans)


l = int(input())
x = input()
y = (l + 1) // 2
z = int(x)
while y < l and x[y] == '0':
	y += 1
if y < l and x[y] != '0':
	z = min(z, int(x[:y]) + int(x[y:]))
y = l // 2
while y > 0 and x[y] == '0':
	y -= 1
if y > 0 and x[y] != '0':
	z = min(z, int(x[:y]) + int(x[y:]))
print(z)


def solve(x, str):
	i = (x + 1) // 2
	j = i - 1
	while i < x and str[i] == '0':
		i += 1
	while j > 0 and str[j] == '0':
		j -= 1
	res = min(int(str[:i]) + int(str[i:] if i != x else 10 ** 100000), int(str[:j] if j != 0 else 10 ** 100000) + int(str[j:]))
	return res

def main():
	x = int(input())
	st = input()
	print(solve(x, st))
main()


l = int(input())
n = input()
t = int(l // 2)
sm1 = int(n)
for i in range(t, 0, -1):
	if n[i] != '0':
		lt = int(n[:i])
		rt = int(n[i:])
		sm1 = lt + rt
		break
for i in range(t + 1, l):
	if n[i] != '0':
		lt = int(n[:i])
		rt = int(n[i:])
		sm2 = lt + rt
		sm1 = min(sm1, sm2)
		break
print(sm1)


n = int(input())
s = input()
if s[n // 2] == '0':
	i = n // 2
	while i >= 0 and s[i] == '0':
		i -= 1
	if i < 1:
		z1 = -1
	else:
		l1 = int(s[:i])
		r1 = int(s[i:])
		z1 = l1 + r1
	j = n // 2
	while j < n and s[j] == '0':
		j += 1
	if j == n:
		z2 = -1
	else:
		l2 = int(s[:j])
		r2 = int(s[j:])
		z2 = l2 + r2
	if z1 == -1:
		print(z2)
	elif z2 == -1:
		print(z1)
	else:
		print(min(z1, z2))
elif n % 2 == 0:
	print(int(s[:n // 2]) + int(s[n // 2:]))
else:
	print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 + 1]) + int(s[1 + n // 2:])))


l = int(input())
n = input()
(left, right) = (l // 2, l // 2 + (1 if l & 1 else 0))
while n[left] == '0':
	left -= 1
while right < l and n[right] == '0':
	right += 1
if left == 0:
	ans = int(n[:right]) + int(n[right:])
elif right == l:
	ans = int(n[:left]) + int(n[left:])
else:
	ans = min(int(n[:left]) + int(n[left:]), int(n[:right]) + int(n[right:]))
print(ans)


a = int(input(''))
b = str(input(''))
c = int(a / 2)
g = int(b)
for i in range(c, 0, -1):
	if b[i] != '0':
		e = int(b[:i])
		f = int(b[i:])
		g = e + f
		break
for i in range(c + 1, len(b)):
	if b[i] != '0':
		h = int(b[:i])
		j = int(b[i:])
		k = h + j
		g = min(g, k)
		break
print(g)


n = eval(input())
s = input()
l = n // 2
Sum = 0
kk = 1
for i in range(l, n):
	if s[i] != '0':
		if Sum == 0:
			Sum = int(s[i:]) + int(s[0:i])
		else:
			Sum = min(Sum, int(s[i:]) + int(s[0:i]))
		kk += 1
		if kk == 3:
			break
kk = 1
for i in range(l, 0, -1):
	if s[i] != '0':
		if Sum == 0:
			Sum = int(s[i:]) + int(s[0:i])
		else:
			Sum = min(Sum, int(s[i:]) + int(s[0:i]))
		kk += 1
		if kk == 3:
			break
print(Sum)


l = input()
n = input()
l = int(l)
half = l // 2
if l % 2 == 1:
	half1 = l // 2 + 1
else:
	half1 = l // 2
while n[half] == '0' and n[half1] == '0' and (half > 1):
	half = half - 1
	half1 = half1 + 1
sum1 = int(n[:half]) + int(n[half:])
sum2 = int(n[:half1]) + int(n[half1:])
if n[half] == '0':
	sum1 = int(n)
if n[half1] == '0':
	sum2 = int(n)
if sum1 < sum2:
	print(sum1)
else:
	print(sum2)


l = int(input())
a = input()
i = l // 2
ans = -1
while i > 0 and a[i] == '0':
	i -= 1
r = l // 2 + 1
while r < l and a[r] == '0':
	r += 1
for j in [i, i - 1, r, r + 1]:
	if j > 0 and j < l:
		if a[j] != '0':
			if ans == -1:
				ans = int(a[:j]) + int(a[j:])
			else:
				ans = min(ans, int(a[:j]) + int(a[j:]))
print(ans)


l = int(input())
n = input()

def solvef(n, i):
	while n[i] == '0':
		i = i + 1
		if i == len(n):
			return 1000000000000000
	n1 = n[0:i]
	n2 = n[i:]
	return int(n1) + int(n2)

def solveb(n, i):
	while n[i] == '0':
		i = i - 1
		if i == -1:
			return 1000000000000000
	n1 = n[0:i]
	n2 = n[i:]
	return int(n1) + int(n2)
if l % 2 == 0:
	i = l // 2
	print(min(solvef(n, i), solveb(n, i)))
else:
	i = l // 2
	print(min(min(solvef(n, i), solveb(n, i + 1)), min(solvef(n, i), solveb(n, i + 1))))


l = int(input())
n = input()
pos1 = l // 2
pos2 = pos1 + 1
while pos1 >= 0 and n[pos1] == '0':
	pos1 -= 1
while pos2 < l and n[pos2] == '0':
	pos2 += 1
s1 = int('0' + n[:pos1]) + int('0' + n[pos1:])
s2 = int('0' + n[:pos2]) + int('0' + n[pos2:])
print(min(s1, s2))


l = int(input())
s = str(input())
m = int(s)
if l == 2:
	print(int(s[0]) + int(s[1]))
else:
	for i in range(l // 2, l):
		if s[i] != '0':
			m = min(int(s[i:]) + int(s[:i]), m)
			break
	for i in range(l // 2 + 1, 0, -1):
		if s[i] != '0':
			m = min(int(s[i:]) + int(s[:i]), m)
			break
	print(m)


n = int(input())
s = input()
mn = 99999999
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		mn = int(s[:i]) + int(s[i:])
		break
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		mn = min(mn, int(s[:i]) + int(s[i:]))
		break
print(mn)


k = int(input())
s = input()
k2 = k / 2
Y = k + 1
if k - s.count('0') > 1:
	for i in range(k):
		if s[i] != '0':
			z = abs(i - k2)
			if z < Y:
				Y = z
			elif z == Y:
				kk1 = int(s[int(Y + k2):])
				kk3 = int(s[:int(Y + k2)])
				kk2 = int(s[int(-Y + k2):])
				kk4 = int(s[:int(-Y + k2)])
				print(min(kk1 + kk3, kk2 + kk4))
	if Y != 0:
		if Y != k + 1:
			if s[int(-Y + k2)] == '0':
				kk1 = int(s[int(Y + k2):])
				kk3 = int(s[:int(Y + k2)])
				print(kk1 + kk3)
			elif s[int(Y + k2)] == '0':
				kk2 = int(s[int(-Y + k2):])
				kk4 = int(s[:int(-Y + k2)])
				print(kk2 + kk4)
		else:
			print(s)
	else:
		print(int(s[int(k2):]) + int(s[:int(k2)]))
else:
	print(s)


def smaller(x, y):
	if x < y:
		return x
	return y
L = int(input())
N = input()
middle = L // 2
if L % 2 == 0:
	if N[middle] != '0':
		print(int(N[:middle]) + int(N[middle:]))
	else:
		index = 1
		while True:
			flag1 = N[middle - index] != '0'
			flag2 = N[middle + index] != '0'
			if flag1 and flag2:
				X = int(N[:middle - index]) + int(N[middle - index:])
				Y = int(N[:middle + index]) + int(N[middle + index:])
				print(smaller(X, Y))
				break
			elif flag1:
				X = int(N[:middle - index]) + int(N[middle - index:])
				print(X)
				break
			elif flag2:
				Y = int(N[:middle + index]) + int(N[middle + index:])
				print(Y)
				break
			index += 1
else:
	flag1 = N[middle] != '0'
	flag2 = N[middle + 1] != '0'
	if flag1 and flag2:
		X = int(N[:middle]) + int(N[middle:])
		Y = int(N[:middle + 1]) + int(N[middle + 1:])
		print(smaller(X, Y))
	elif flag1:
		X = int(N[:middle]) + int(N[middle:])
		print(X)
	elif flag2:
		Y = int(N[:middle + 1]) + int(N[middle + 1:])
		print(Y)
	else:
		index = 1
		while True:
			flag1 = N[middle - index] != '0'
			flag2 = N[middle + 1 + index] != '0'
			if flag1 and flag2:
				X = int(N[:middle - index]) + int(N[middle - index:])
				Y = int(N[:middle + 1 + index]) + int(N[middle + 1 + index:])
				print(smaller(X, Y))
				break
			elif flag1:
				X = int(N[:middle - index]) + int(N[middle - index:])
				print(X)
				break
			elif flag2:
				Y = int(N[:middle + 1 + index]) + int(N[middle + 1 + index:])
				print(Y)
				break
			index += 1


length = int(input())
s = input()
i = int(length / 2)
j = int((length + 1) / 2)
minm = 10 ** 100005
while True:
	flag = False
	if s[i] != '0':
		i1 = int(s[:i])
		i2 = int(s[i:])
		minm = min(minm, i1 + i2)
		flag = True
	if s[j] != '0':
		i1 = int(s[:j])
		i2 = int(s[j:])
		minm = min(minm, i1 + i2)
		flag = True
	if flag:
		break
	i = i - 1
	j = j + 1
print(minm)


import math
n = int(input())
str = input()
i = (n + 1) // 2
j = n // 2
while i < n and str[i] == '0':
	i += 1
while j > 0 and str[j] == '0':
	j -= 1
str1 = str[:i]
str2 = str[i:]
str3 = str[:j]
str4 = str[j:]
ans = math.inf
if str1 != '' and str2 != '':
	ans = min(ans, int(str1) + int(str2))
if str3 != '' and str4 != '':
	ans = min(ans, int(str3) + int(str4))
print(ans)


len_num = int(input())
num_str = input()
len_1 = len_num // 2
len_2 = len_1
if len_num & 1:
	len_2 += 1
flag = 0
ans = 0
while True:
	if num_str[len_1] != '0':
		num1 = int(num_str[:len_1]) + int(num_str[len_1:len_num])
		ans = num1
		flag = 1
	if len_2 < len_num and num_str[len_2] != '0':
		num2 = int(num_str[:len_2]) + int(num_str[len_2:len_num])
		if flag:
			if ans > num2:
				ans = num2
		else:
			ans = num2
		flag = 1
	len_1 -= 1
	len_2 += 1
	if flag:
		break
print(ans)


def v(s):
	return len(s) > 0 and s[0] != '0'

def i(s):
	try:
		return int(s)
	except:
		return 0
n = int(input())
s = input()
a = n // 2
b = n // 2 + 1
while a > 0 and s[a] == '0':
	a -= 1
while b < n and s[b] == '0':
	b += 1
print(min(i(s[:a]) + i(s[a:]), i(s[:b]) + i(s[b:])))


n = int(input())
s = input()
good = []
for i in range(1, n):
	if s[i] != '0':
		good.append([max(n - i, i), i])
good = sorted(good)
if len(good) == 0:
	good.append([n - 1, n - 1])
if len(good) == 1:
	good.append(good[0])
ans = int(s[:good[0][1]]) + int(s[-(n - good[0][1]):])
ans = min(ans, int(s[:good[1][1]]) + int(s[-(n - good[1][1]):]))
print(ans)


import math
l = int(input())
n = input()
m = float('inf')
b = 0
for i in range(l // 2, l, 1):
	if int(n[i]) > 0:
		m = min(m, int(n[:i]) + int(n[i:]))
		b += 1
	if b > 3:
		break
b = 0
for i in range(l // 2, 0, -1):
	if int(n[i]) > 0:
		m = min(m, int(n[:i]) + int(n[i:]))
		b += 1
	if b > 3:
		break
print(m)


a = int(input())
b = input()
mid = a // 2
f = mid
s = mid
while f > 0 and b[f] == '0':
	f = f - 1
while s < a - 1 and b[s] == '0':
	s = s + 1
ans = 1e309
for number in [-1, 0, 1]:
	keysA = f + number
	keysB = s + number
	fa = 0
	fb = 0
	sa = 0
	sb = 0
	if len(b[:keysA]) > 0:
		fa = int(b[:keysA])
	if len(b[keysA:]) > 0:
		fb = int(b[keysA:])
	if len(b[:keysB]) > 0:
		sa = int(b[:keysB])
	if len(b[keysB:]) > 0:
		sb = int(b[keysB:])
	if keysA >= 0 and keysA <= a - 1 and (b[keysA] != '0'):
		ans = min(ans, fa + fb)
	if keysB >= 0 and keysB <= a - 1 and (b[keysB] != '0'):
		ans = min(ans, sa + sb)
print(ans)


_ = input()
num = input()
ansi = len(num) - 1
leni = len(num)
for i in range(leni):
	if i == 0 or num[i] == '0':
		continue
	ansi = min(ansi, max(i, leni - i))
l = []
for i in range(leni):
	if i == 0 or num[i] == '0':
		continue
	tk = max(i, leni - i)
	if tk == ansi or tk - 1 == ansi:
		l.append(int(num[0:i]) + int(num[i:]))
mini = l[0]
for i in l:
	if i < mini:
		mini = i
print(mini)


L = int(input())
num = input()
rem = []
for i in range(1, L):
	if num[i] != '0':
		a = i
		b = L - i
		rem.append((max(a, b), max(a, b) + 1, i))
rem.sort()
ans = int(num[:rem[0][2]]) + int(num[rem[0][2]:])
for item in rem:
	if item[0] > rem[0][1]:
		break
	tmp = int(num[:item[2]]) + int(num[item[2]:])
	ans = min(ans, tmp)
print(ans)


l = int(input())
n = input()
m = int(n)
for i in range(l // 2, l):
	if n[i] != '0':
		m = int(n[0:i]) + int(n[i:])
		break
for i in range(l // 2, l):
	if n[l - i] != '0':
		print(min(m, int(n[0:l - i]) + int(n[l - i:])))
		break


def solve_left(num, len):
	x = num[0:(len + 1) // 2]
	y = num[(len + 1) // 2:len]
	ptr = 1
	while y.startswith('0'):
		x = num[0:(len + 1) // 2 - ptr]
		y = num[(len + 1) // 2 - ptr:len]
		ptr = ptr + 1
		if y == num:
			return int(y)
	return int(x) + int(y)

def solve_right(num, len):
	x = num[0:len // 2]
	y = num[len // 2:len]
	ptr = 1
	while y.startswith('0'):
		x = num[0:(len + 1) // 2 + ptr]
		y = num[(len + 1) // 2 + ptr:len]
		ptr = ptr + 1
		if x == num:
			return int(x)
	return int(x) + int(y)

def main():
	len = int(input())
	num = input()
	print(min(solve_left(num, len), solve_right(num, len)))
main()


n = int(input())
numstr = input()
mid = len(numstr) // 2
mn = int(numstr) * 10
zright = mid
while zright < len(numstr) and numstr[zright] == '0':
	zright += 1
zleft = mid
while zleft > 0 and numstr[zleft] == '0':
	zleft -= 1
todo = {i for i in range(zleft - 5, zleft + 5)}
for i in range(zright - 5, zright + 5):
	todo.add(i)
for i in todo:
	if i < 1 or i >= len(numstr):
		continue
	second = numstr[i:]
	if second[0] == '0':
		continue
	mn = min(mn, int(numstr[:i]) + int(second))
print(mn)


def main():
	n = int(input())
	num = int(input())
	string = str(num)
	if n % 2:
		half = n // 2
		if string[half] == '0':
			i = half - 1
			j = half + 1
			while i >= 0 and string[i] == '0':
				i -= 1
			while j < n and string[j] == '0':
				j += 1
			print(min(int(max(string[:i], '0')) + int(max(string[i:], '0')), int(max(string[:j], '0')) + int(max(string[j:], '0'))))
		else:
			print(min(int(string[:n // 2 + 1]) + int(string[n // 2 + 1:]), int(string[:n // 2]) + int(string[n // 2:])))
	else:
		half = n // 2
		if string[half] == '0':
			i = half - 1
			j = half + 1
			while i >= 0 and string[i] == '0':
				i -= 1
			while j < n and string[j] == '0':
				j += 1
			print(min(int(max(string[:i], '0')) + int(max(string[i:], '0')), int(max(string[:j], '0')) + int(max(string[j:], '0'))))
		else:
			print(int(string[:n // 2]) + int(string[n // 2:]))
main()


n = int(input())
s = input()
d = set(s)
if '0' in d:
	mi = 0
	m = len(s)
	for i in range(n // 2 - 1, 0, -1):
		if s[i] != '0':
			mi = i
			break
	for i in range(n // 2, len(s)):
		if s[i] != '0':
			m = i
			break
	if mi == 0:
		mi = int(s)
	else:
		mi = int(s[mi:]) + int(s[:mi])
	if m == len(s):
		m = int(s)
	else:
		m = int(s[m:]) + int(s[:m])
	print(min(mi, m))
elif n % 2 != 0:
	a = int(s[:n // 2]) + int(s[n // 2:])
	b = int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])
	print(min(a, b))
else:
	print(int(s[:n // 2]) + int(s[n // 2:]))


import sys

def rl(proc=None):
	if proc is not None:
		return proc(sys.stdin.readline())
	else:
		return sys.stdin.readline().rstrip()

def srl(proc=None):
	if proc is not None:
		return list(map(proc, rl().split()))
	else:
		return rl().split()

def test(r, s, p):
	if p <= 0 or p >= len(s) or s[p] == '0':
		return r
	return min(r, int(s[:p]) + int(s[p:]))

def main():
	rl()
	x = rl()
	r = int(x)
	p = len(x) // 2
	for i in range(-3, 3):
		r = test(r, x, p + i)
	for t in range(p - 3, 0, -1):
		if x[t] != '0':
			r = test(r, x, t)
			break
	for t in range(p + 3, len(x)):
		if x[t] != '0':
			r = test(r, x, t)
			break
	print(r)
main()


l = int(input())
n = input()
ans = int(n)
i = l // 2 + 1
j = l // 2
flag1 = False
flag2 = False
if (i < l) & (j > 0):
	while n[i] == '0' and i < l:
		i += 1
		if i >= l:
			flag1 = True
			break
	while n[j] == '0' and j > 0:
		j -= 1
		if j <= 0:
			flag2 = True
			break
elif i >= l:
	flag1 = True
elif j <= 0:
	flag2 = True
if (i < l) & (flag1 == False):
	ans = min(int(n[i:]) + int(n[:i]), ans)
if (j > 0) & (flag2 == False):
	ans = min(int(n[j:]) + int(n[:j]), ans)
print(ans)


l = int(input())
n = str(input())
mid = int(l / 2)
m1 = int(n)
m2 = int(n)
sp = mid
for i in range(sp, 0, -1):
	if n[i] != '0':
		temp = int(n[:i]) + int(n[i:])
		if m1 > temp:
			m1 = temp
		else:
			break
	else:
		pass
sp = mid + 1
for i in range(sp, len(n)):
	if n[i] != '0':
		temp = int(n[:i]) + int(n[i:])
		if m2 > temp:
			m2 = temp
		else:
			break
	else:
		pass
print(min(m1, m2))


import sys
n = int(input())
s = input()
k1 = int(s)
d = list(s)
mini = sys.maxsize
k = n // 2
if s[k] == '0':
	(lo, bo) = (10 ** 18, 10 ** 18)
	for i in range(k, n):
		if s[i] != '0':
			z = n - i
			b = int(s[:i]) + int(s[i:])
			if s[z] != 0 and s[n - i] != '0':
				a = int(s[:z]) + int(s[z:])
				b = int(s[:i]) + int(s[i:])
				lo = min(a, b)
			else:
				lo = b
			break
	for i in range(k, 0, -1):
		if s[i] != '0':
			z = n - i
			b1 = int(s[:i]) + int(s[i:])
			if s[z] != 0 and s[n - i] != '0':
				a = int(s[:z]) + int(s[z:])
				b1 = int(s[:i]) + int(s[i:])
				bo = min(a, b1)
			else:
				bo = b1
			break
	print(min(bo, lo))
elif n % 2 == 0:
	a = int(s[:k]) + int(s[k:])
	print(a)
elif s[k + 1] != '0':
	z = k + 1
	a = int(s[:k]) + int(s[k:])
	b = int(s[:z]) + int(s[z:])
	print(min(a, b))


import math
l = int(input())
s = str(input())
mid1 = int(0)
mid2 = int(0)
if l % 2 == 1:
	mid1 = l // 2
	mid2 = mid1 + 1
else:
	mid1 = l // 2 - 1
	mid2 = l // 2
ans = int(s)
for i in range(mid1, 0, -1):
	if not s[i] == '0':
		if i == 0:
			s1 = '0'
		else:
			s1 = s[:i]
		s2 = s[i:]
		ans = int(s1) + int(s2)
		break
for i in range(mid2, len(s)):
	if not s[i] == '0':
		s1 = s[:i]
		s2 = s[i:]
		ans = min(ans, int(s1) + int(s2))
		break
print(ans)


n = eval(input())
s = input()
ans = 0
k = int(0)
for i in range(n):
	f1 = 0
	f2 = 0
	ans1 = 0
	ans2 = 0
	if n // 2 - k > 0 and s[n // 2 - k] != '0':
		s1 = s[0:n // 2 - k]
		s2 = s[n // 2 - k:n]
		ans1 = eval(s1) + eval(s2)
		f1 = 1
	m = n - (n // 2 - k)
	if m > 0 and s[m] != '0':
		f2 = 1
		s1 = s[0:m]
		s2 = s[m:n]
		ans2 = eval(s1) + eval(s2)
	if f1 == 1 and f2 == 1:
		print(min(ans1, ans2))
		break
	elif f1 == 1:
		print(ans1)
		break
	elif f2 == 1:
		print(ans2)
		break
	k = k + 1


n = int(input())
s = input().strip()
mid = n // 2
ans = int(s)
if s[mid] != '0':
	num = int(s[:mid]) + int(s[mid:])
	ans = min(ans, num)
for i in range(mid + 1, n):
	if s[i] != '0':
		num = int(s[:i]) + int(s[i:])
		ans = min(ans, num)
		break
for i in range(mid - 1, 0, -1):
	if s[i] != '0':
		num = int(s[:i]) + int(s[i:])
		ans = min(ans, num)
		break
print(ans)


n = int(input())
s = input()
mid1 = n // 2
if n % 2 == 0:
	mid1 -= 1
	mid2 = mid1
else:
	mid2 = mid1
	mid1 -= 1
while mid1 >= 0 and s[mid1 + 1] == '0':
	mid1 -= 1
while mid2 + 1 < n and s[mid2 + 1] == '0':
	mid2 += 1
ans = -1
if 0 <= mid1 < n - 1:
	a = s[:mid1 + 1]
	b = s[mid1 + 1:]
	if ans == -1:
		ans = int(a) + int(b)
if 0 <= mid2 < n - 1:
	c = s[:mid2 + 1]
	d = s[mid2 + 1:]
	if ans == -1:
		ans = int(c) + int(d)
	elif ans > int(c) + int(d):
		ans = int(c) + int(d)
print(ans)


import math
l = int(input())
s = input()
a1 = a2 = a3 = math.inf
if l > 2:
	i = int(l / 2)
	j = int(l / 2) + 1
elif s[1] == '0':
	i = 0
	j = 0
else:
	i = 1
	j = 1
while i > 0 and s[i] == '0':
	i -= 1
while j < l - 1 and s[j] == '0':
	j += 1
if i != 0:
	a1 = int(s[:i]) + int(s[i:])
else:
	a1 = int(s)
if s[j] != '0':
	a2 = int(s[:j]) + int(s[j:])
if l % 2 == 0 and i == l / 2 and (s[i - 1] != '0'):
	a3 = int(s[:i]) + int(s[i:])
print(min(a1, a2, a3))


n = int(input())
number = input()
ans = 0

def give_sum(split_point):
	str1 = ''
	for i in range(split_point):
		str1 = str1 + number[i]
	str2 = ''
	for i in range(split_point, n):
		str2 = str2 + number[i]
	n1 = 0
	n2 = 0
	if str1 != '':
		n1 = int(str1)
	if str2 != '':
		n2 = int(str2)
	return n1 + n2
split_point = n // 2
actual_split_point = n
for i in range(split_point):
	if number[i + 1] != '0':
		actual_split_point = i + 1
actual_split_point2 = n
for i in range(split_point, n - 1):
	if number[i + 1] != '0':
		actual_split_point2 = i + 1
		break
ans = give_sum(actual_split_point)
ans2 = give_sum(actual_split_point2)
ans = min(ans, ans2)
print(ans)


le = int(input())
n = input()
l = le // 2
if le % 2 == 0:
	l -= 1
r = le // 2
if le % 2 != 0:
	r += 1
minSum = -1
while l >= 0 and r < le:
	if int(n[l]) != 0:
		s = int(n[:l]) + int(n[l:])
		if minSum == -1 or s < minSum:
			minSum = s
	if int(n[r]) != 0:
		s = int(n[:r]) + int(n[r:])
		if minSum == -1 or s < minSum:
			minSum = s
	if minSum != -1:
		break
	l -= 1
	r += 1
print(minSum)


n = int(input())
s = input()
if n % 2:
	for i in range(int(n / 2 + 1)):
		a = None
		b = None
		ind1 = int(n / 2 - i)
		ind2 = int(n / 2 + 1 + i)
		if s[ind1] != '0' and s[ind2] == '0':
			print(int(s[0:ind1]) + int(s[ind1:]))
			break
		elif s[ind2] != '0' and s[ind1] == '0':
			print(int(s[0:ind2]) + int(s[ind2:]))
			break
		elif s[ind1] != '0' and s[ind2] != '0':
			x = min(int(s[0:ind1]) + int(s[ind1:]), int(s[0:ind2]) + int(s[ind2:]))
			print(x)
			break
	pass
else:
	for i in range(int(n / 2 + 1)):
		a = None
		b = None
		ind1 = int(n / 2 - i)
		ind2 = int(n / 2 + i)
		if s[ind1] != '0' and s[ind2] == '0':
			print(int(s[0:ind1]) + int(s[ind1:]))
			break
		elif s[ind2] != '0' and s[ind1] == '0':
			print(int(s[0:ind2]) + int(s[ind2:]))
			break
		elif s[ind1] != '0' and s[ind2] != '0':
			x = min(int(s[0:ind1]) + int(s[ind1:]), int(s[0:ind2]) + int(s[ind2:]))
			print(x)
			break
	pass


n = int(input())
s = input()
ans = 1e309
mid = n // 2
i = mid
while i > 0:
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = a + b
		break
	i -= 1
i = mid + 1
while i < len(s):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = min(ans, a + b)
		break
	i += 1
print(ans)


n = int(input())
s = input()

def conv(x):
	try:
		return int(x)
	except:
		return 0
mid = n // 2
if s[mid] == '0':
	rmid = mid
	lmid = mid
	while rmid < n and s[rmid] == '0':
		rmid += 1
	while lmid >= 0 and s[lmid] == '0':
		lmid -= 1
	if rmid == n:
		rmid = lmid
	print(min(conv(s[0:rmid]) + conv(s[rmid:]), conv(s[0:lmid]) + conv(s[lmid:])))
elif n % 2 == 0:
	print(conv(s[0:mid]) + conv(s[mid:]))
else:
	print(min(conv(s[0:mid + 1]) + conv(s[mid + 1:]), conv(s[0:mid]) + conv(s[mid:])))


from math import inf
n = int(input())
s = input()
ans = inf
for l in range(n // 2, n):
	if s[l] != '0':
		ans = min(ans, int(s[l:]) + int(s[:l]))
		break
for l in range(n - n // 2, 0, -1):
	if s[l] != '0':
		ans = min(ans, int(s[l:]) + int(s[:l]))
		break
print(ans)


l = int(input())
s = input()
var = []
z = int(s[0])
n = len(s)
for i in range(1, n):
	if s[i] != '0':
		var.append((i, n - i, int(s[i])))
for i in range(0, len(var)):
	if var[i][0] > var[i][1]:
		break
z = i
arr = []
for j in range(max(i - 1, 0), min(i + 1, len(var))):
	arr.append(int(s[:var[j][0]]) + int(s[var[j][0]:]))
print(min(arr))


import sys
sys.setrecursionlimit(150000)
n = int(input())
str1 = input()
mid = n // 2
ck1 = mid - 1
ck2 = mid
fl1 = fl2 = 0
while ck1 >= 0:
	if str1[ck1 + 1] != '0':
		fl1 = 1
		break
	ck1 = ck1 - 1
while ck2 < n - 1:
	if str1[ck2 + 1] != '0':
		fl2 = 1
		break
	ck2 = ck2 + 1
in1 = in2 = int(str1)
if fl1:
	in1 = int(str1[0:ck1 + 1]) + int(str1[ck1 + 1:n])
if fl2:
	in2 = int(str1[0:ck2 + 1]) + int(str1[ck2 + 1:n])
print(min(in1, in2))


l = int(input())
s = input()
i = len(s) // 2
j = len(s) // 2 + 1
res = int(s)
while i > 0 and s[i] == '0':
	i -= 1
if i > 0:
	res = min(res, int(s[:i]) + int(s[i:]))
while j < len(s) and s[j] == '0':
	j += 1
if j < len(s):
	res = min(res, int(s[:j]) + int(s[j:]))
print(res)


def main():
	l = int(input())
	n = input()
	data = []
	for i in range(1, l):
		if n[i] == '0':
			continue
		data.append((abs(l // 2 - i), i))
	data.sort()
	res = -1
	for i in range(0, min(10, len(data))):
		start = data[i][1]
		x = int(n[0:start])
		y = int(n[start:])
		z = x + y
		if res == -1:
			res = z
		else:
			res = min(res, z)
	print(res)
main()


n = int(input())
a = input()
minsum = -1
if n > 1000:
	start = n // 2 - 3
	end = n // 2 + 3
else:
	start = 1
	end = n
i = start
while start < end and start < n:
	str1 = a[:start]
	str2 = a[start:]
	if str1[0] != '0' and str2[0] != '0':
		temp = int(str1) + int(str2)
		if minsum == -1 or temp < minsum:
			minsum = temp
	if minsum == -1 and end <= n:
		end += 1
	start += 1
print(minsum)


l = int(input())
n = input()
mndig = l
consid = 10 ** (l + 1)
for i in range(1, l):
	if n[i] != '0':
		dig = max((i, l - i))
		mndig = min((mndig, dig))
for i in range(1, l):
	if n[i] != '0':
		dig = max((i, l - i))
		if dig <= mndig + 2:
			consid = min((consid, int(n[:i]) + int(n[i:])))
print(consid)


(n, c) = (int(input()), input())
(x, y) = (n // 2, (n + 1) // 2)
while x >= 1 and y < n:
	if c[x] == '0' and c[y] == '0':
		x -= 1
		y += 1
		continue
	a = int(c[:x]) + int(c[x:])
	b = int(c[:y]) + int(c[y:])
	if c[x] == '0':
		print(b)
	elif c[y] == '0':
		print(a)
	else:
		print(min(a, b))
	break


n = int(input())
s = input()
idx = (n + 1) // 2 - 1
if n % 2 == 1:
	x = idx + 1
	ans = int(s)
	while x < n and s[x] == '0':
		x += 1
	if x < n:
		t1 = int(s[0:x])
		t2 = int(s[x:n])
		ans = min(t1 + t2, ans)
	x = idx
	while x >= 0 and s[x] == '0':
		x -= 1
	if x > 0:
		t1 = int(s[0:x])
		t2 = int(s[x:n])
		ans = min(t1 + t2, ans)
else:
	x = idx + 1
	ans = int(s)
	while x < n and s[x] == '0':
		x += 1
	if x < n:
		t1 = int(s[0:x])
		t2 = int(s[x:n])
		ans = min(t1 + t2, ans)
	x = idx
	while x >= 0 and s[x] == '0':
		x -= 1
	if x > 0:
		t1 = int(s[0:x])
		t2 = int(s[x:n])
		ans = min(t1 + t2, ans)
print(ans)


n = int(input())
s = input()
mid = n // 2
a = s[:mid]
b = s[mid:]
c = s[:mid + 1]
d = s[mid + 1:]
if len(b) > 0:
	while b[0] == '0':
		if len(b) > 0:
			b = b[1:]
			if len(b) <= 0:
				break
			a = a + '0'
		else:
			break
if len(d) > 0:
	while d[0] == '0':
		if len(d) > 0:
			d = d[1:]
			if len(d) <= 0:
				break
			c = c + '0'
		else:
			break
fl = False
ans = 0
if len(a) > 0 and len(b) > 0 and (b[0] != '0'):
	sa = int(a) + int(b)
	if fl == False:
		ans = sa
		fl = True
	else:
		ans = min(ans, sa)
if len(c) > 0 and len(d) > 0 and (d[0] != '0'):
	sc = int(c) + int(d)
	if fl == False:
		ans = sc
		fl = True
	else:
		ans = min(ans, sc)
aa = s[:mid]
bb = s[mid:]
cc = s[:mid + 1]
dd = s[mid + 1:]
if len(bb) > 0:
	while bb[0] == '0':
		if len(aa) > 0:
			bb = aa[-1] + bb
			aa = aa[:-1]
			if len(aa) <= 0:
				break
		else:
			break
if len(dd) > 0:
	while dd[0] == '0':
		if len(cc) > 0:
			dd = cc[-1] + dd
			cc = cc[:-1]
			if len(cc) <= 0:
				break
		else:
			break
if len(aa) > 0 and len(bb) > 0 and (bb[0] != '0'):
	saa = int(aa) + int(bb)
	if fl == False:
		ans = saa
		fl = True
	else:
		ans = min(ans, saa)
if len(cc) > 0 and len(dd) > 0 and (dd[0] != '0'):
	scc = int(cc) + int(dd)
	if fl == False:
		ans = scc
		fl = True
	else:
		ans = min(ans, scc)
print(ans)


n = int(input())
a = input()
i = n // 2
j = i
if a[i] == '0':
	while i < n and a[i] == '0':
		i += 1
	if i == n:
		i = 1
	while a[j] == '0':
		j -= 1
	if j == 0:
		j = i
	a1 = int(a[:j])
	a2 = int(a[j:])
	ans1 = a1 + a2
	a3 = int(a[:i])
	a4 = int(a[i:])
	ans2 = a3 + a4
	print(min(ans1, ans2))
else:
	a1 = int(a[:i])
	a2 = int(a[i:])
	ans1 = a1 + a2
	a3 = int(a[:i + 1])
	a4 = int(a[i + 1:])
	ans2 = a3 + a4
	print(min(ans1, ans2))


n = int(input())
s = input()
min_val = n
for i in range(1, n):
	if s[i] == '0':
		continue
	min_val = min(min_val, max(i, n - i))
ans = int(s)
for i in range(1, n):
	if s[i] == '0':
		continue
	if max(i, n - i) < min_val - 1 or max(i, n - i) > min_val:
		continue
	candi = int(s[:i]) + int(s[i:])
	ans = min(ans, candi)
print(ans)


import math
l = int(input())
s = input()
j = l // 2 + 1
i = j - 1
while i > 1 and s[i] == '0':
	i -= 1
while j < l and s[j] == '0':
	j += 1

def kek(k):
	s1 = s[:k]
	s2 = s[k:]
	if len(s1) == 0 or len(s2) == 0:
		return -1
	if len(s2) > 1 and s2[0] == '0':
		return -1
	aa = int(s1)
	bb = int(s2)
	ss = aa + bb
	return ss
ans = kek(i)
if ans == -1:
	ans = kek(j)
else:
	t = kek(j)
	if t != -1:
		ans = min(ans, t)
print(ans)


l = int(input())
a = input()
ind = l // 2
prev = []
minn = 10 ** 100
start = ''
for i in range(0, l // 2):
	if a[i + 1] != '0':
		if len(prev) == 0:
			prev.append(i + 1)
		elif abs(prev[-1] - l // 2) > abs(i + 1 - l // 2):
			prev.pop()
			prev.append(i + 1)
prev1 = []
for i in range(l // 2, l - 1):
	if a[i + 1] != '0':
		if len(prev1) == 0:
			prev1.append(i + 1)
		elif abs(prev1[-1] - l // 2) > abs(i + 1 - l // 2):
			prev1.pop()
			prev1.append(i + 1)
if len(prev) + len(prev1) == 2:
	print(min(int(a[:prev[-1]]) + int(a[prev[-1]:]), int(a[:prev1[-1]]) + int(a[prev1[-1]:])))
elif len(prev):
	print(int(a[:prev[-1]]) + int(a[prev[-1]:]))
else:
	print(int(a[:prev1[-1]]) + int(a[prev1[-1]:]))


a = int(input())
b = str(input())
mn = int(b)
for i in range(a // 2 + a % 2, a):
	if b[i] == '0':
		continue
	mn = int(b[:i]) + int(b[i:])
	break
for i in range(a // 2, 0, -1):
	if b[i] == '0':
		continue
	mn = min(mn, int(b[:i]) + int(b[i:]))
	break
print(mn)


q = int(input())
w = input()
r = []
k = int(w)
if q % 2 == 0:
	e = q // 2
	i = 1
	j = 1
	l = 1
	if w[e] == '0':
		while l:
			if w[e + j] != '0':
				k = int(w[:e + j]) + int(w[e + j:])
				l = 0
			j += 1
			if w[e - i] != '0':
				k = min(k, int(w[:e - i]) + int(w[e - i:]))
				l = 0
			i += 1
		print(k)
	else:
		print(int(w[:e]) + int(w[e:]))
else:
	e = q // 2
	i = 0
	j = 1
	l = 1
	while l:
		if w[e + j] != '0':
			k = int(w[:e + j]) + int(w[e + j:])
			l = 0
		j += 1
		if w[e - i] != '0':
			k = min(k, int(w[:e - i]) + int(w[e - i:]))
			l = 0
		i += 1
	print(k)


l = int(input())
n = str(input())
a1 = 0
a2 = 0
for i in range(l // 2 + 1, l):
	n1 = n[i:]
	n2 = n[:i]
	if n1[0] == '0':
		continue
	else:
		a1 = int(n1) + int(n2)
		break
for i in range(l // 2, 0, -1):
	n1 = n[i:]
	n2 = n[:i]
	if n1[0] == '0':
		continue
	else:
		a2 = int(n1) + int(n2)
		break
if a1 == 0:
	print(a2)
elif a2 == 0:
	print(a1)
else:
	print(min(a1, a2))


def kotogula_zero(n):
	ln = len(n)
	if ln % 2 == 0:
		s = n[ln // 2:ln]
		s1 = str(int(s))
		rt1 = ln // 2 - len(s1)
		if s1 == '0':
			rt1 += 1
		ss = n[0:ln // 2][::-1]
		ss1 = str(int(ss))
		rt2 = ln // 2 - len(ss1)
		if ss1 == '0':
			rt2 += 1
		return (rt1, rt2)
n = int(input())
s = input()
if n == 2:
	print(int(s[0]) + int(s[1]))
	exit(0)
if n % 2 == 0:
	if s[n // 2] != '0':
		print(int(s[0:n // 2]) + int(s[n // 2:n]))
		exit(0)
	else:
		(nex, prev) = (kotogula_zero(s)[0], kotogula_zero(s)[1])
		kot = nex + prev
		if n // 2 - prev == 1:
			print(int(s[0] + '0' * kot) + int(s[-1]))
			exit(0)
		if n // 2 - nex == 0:
			print(int(s[0:n // 2 - prev - 1]) + int(s[n // 2 - prev - 1:n]))
			exit(0)
		ab = int(s[0:n // 2 + nex]) + int(s[n // 2 + nex:n])
		ba = int(s[0:n // 2 - prev - 1]) + int(s[n // 2 - prev - 1:n])
		if ab == int(s):
			print(ba)
		elif ba == int(s):
			print(ab)
		else:
			print(min(ab, ba))
		exit(0)
elif s[n // 2] != '0':
	print(min(int(s[0:n // 2 + 1]) + int(s[n // 2 + 1:n]), int(s[0:n // 2]) + int(s[n // 2:n])))
	exit(0)
else:
	(ne, pr) = kotogula_zero(s[0:n // 2] + s[n // 2 + 1:n])
	kot = ne + pr + 1
	if n // 2 - pr == 1:
		print(int(s[0] + '0' * kot) + int(s[-1]))
		exit(0)
	if n // 2 - ne == 0:
		y = int(s[0:n // 2 - (pr + 1)]) + int(s[n // 2 - (pr + 1):n])
		print(y)
		exit(0)
	ne1 = 1 + ne
	pr1 = 1 + pr
	x = int(s[0:n // 2 + ne1]) + int(s[n // 2 + ne1:n])
	y = int(s[0:n // 2 - pr1]) + int(s[n // 2 - pr1:n])
	print(min(x, y))
	exit(0)


a1 = int(input())
s = input()
min1 = pow(10, 1000000)
l1 = a1 // 2
l2 = (a1 - 1) // 2
for i in range(l1, len(s)):
	if s[i] == '0':
		continue
	else:
		s1 = s[0:i]
		s2 = s[i:len(s)]
		if len(s1) > 0 and len(s2) > 0:
			if s1[0] != '0' and s2[0] != '0':
				c = int(s1) + int(s2)
				if c < min1:
					min1 = c
				break
for i in range(l2, -1, -1):
	if s[i + 1] == '0':
		continue
	else:
		s1 = s[0:i + 1]
		s2 = s[i + 1:len(s)]
		if len(s1) > 0 and len(s2) > 0:
			if s1[0] != '0' and s2[0] != '0':
				c = int(s1) + int(s2)
				if c < min1:
					min1 = c
				break
print(min1)


l = int(input())
n = input()
c = int(n)
i = l // 2
while i > 0 and n[i] == '0':
	i -= 1
	if i <= 0:
		break
if i > 0:
	t = int(n[0:i]) + int(n[i:])
	c = min(c, t)
i = (l + 1) // 2
while i < l and n[i] == '0':
	i += 1
if i < l:
	t = int(n[0:i]) + int(n[i:l])
	c = min(c, t)
print(c)


n = int(input())
s = input()
first = [None] * (n - 1)
for i in range(n - 1):
	if s[i + 1] == '0':
		first[i] = -1
		continue
	if n % 2 == 1:
		if i < n // 2:
			first[i] = int(s[i + 1])
		else:
			first[i] = int(s[i])
	elif i == n // 2:
		first[i] = max(int(s[i]), int(s[i + 1]))
	elif i < n // 2:
		first[i] = int(s[i + 1])
	else:
		first[i] = int(s[i])
midl = midr = 0
if n % 2 == 1:
	midl = (n - 1) // 2 - 1
	midr = midl + 1
else:
	midl = midr = n // 2 - 1
point1 = point2 = flag = 0
while True:
	if first[midl] == -1 and first[midr] == -1:
		if midl != 0:
			midl -= 1
		if midr < n - 1:
			midr += 1
		continue
	if first[midl] == -1:
		point1 = midr
		break
	elif first[midr] == -1:
		point1 = midl
		break
	flag = 1
	point1 = midl
	point2 = midr
	break
ans = 0
if flag == 0:
	ans = int(s[:point1 + 1]) + int(s[point1 + 1:])
else:
	ans1 = int(s[:point1 + 1]) + int(s[point1 + 1:])
	ans2 = int(s[:point2 + 1]) + int(s[point2 + 1:])
	ans = min(ans1, ans2)
print(ans)


import math
num = int(input().strip())
digits = input().strip()
output = math.inf
mi = 100000
for i in range(1, num):
	if digits[i] != '0':
		mi = min(mi, max(i, num - i))
for i in range(1, num):
	if digits[i] != '0' and max(i, num - i) <= mi:
		T = int(digits[0:i]) + int(digits[i:])
		output = min(output, T)
print(output)


l = int(input())
s = input()
mid = l // 2
endfrom0 = mid + 1
beginforend = mid - 1

def so(i):
	if i == 0 or i == l:
		return int(s)
	return int(s[0:i]) + int(s[i:l])
while endfrom0 < l and s[endfrom0] == '0':
	endfrom0 += 1
while beginforend > -1 and s[beginforend] == '0':
	beginforend -= 1
if s[mid] != '0':
	print(min(so(mid), so(endfrom0), so(beginforend)))
else:
	print(min(so(endfrom0), so(beginforend)))


n = int(input())
s = input()
t1 = (n + 1) // 2
t2 = t1 - 1
while t2 > 0 and s[t2] == '0':
	t2 -= 1
while t1 < n and s[t1] == '0':
	t1 += 1
r = int(s)
if t2 > 0:
	r = min(r, int(s[0:t2]) + int(s[t2:]))
if t1 < n:
	r = min(r, int(s[0:t1]) + int(s[t1:]))
print(r)


l = int(input())
number = input()
checks = []
counter = 0
i = l // 2
while counter < 2 and i < l:
	if number[i] != '0':
		checks.append(i)
		counter += 1
	i += 1
i = l // 2 - 1
counter = 0
while counter < 1 and i > 0:
	if number[i] != '0':
		checks.append(i)
		counter += 1
	i -= 1
ans = -1
for check in checks:
	new_sum = int(number[check:]) + int(number[:check])
	if ans == -1 or new_sum < ans:
		ans = new_sum
print(ans)


l = int(input())
n = str(input())
best_len = l
best = int(n)
to_try = []
for i in range(l - 1):
	if n[i + 1] != '0':
		candidate = max(i + 1, l - i - 1) + 1
		if candidate < best_len:
			to_try.clear()
			to_try.append(i + 1)
			best_len = candidate
		elif candidate == best_len:
			to_try.append(i + 1)
for i in to_try:
	best = min(best, int(n[:i]) + int(n[i:]))
print(best)


import sys
import math
input = sys.stdin.readline
l = int(input())
n = input()
minn = l
cur2 = 1
cur = 1
for i in range(1, l):
	if n[i] != '0':
		if max(i, l - i) < minn:
			minn = max(i, l - i)
			cur = i
			cur2 = i
		elif max(i, l - i) == minn:
			cur2 = i
print(min(int(n[:cur]) + int(n[cur:]), int(n[:cur2]) + int(n[cur2:])))


n = int(input())
a = int(input())
b = str(a)
t = [0] * n
counter = 0
x = 1
y = n - 1
z = 0
for i in range(n - 1, 0, -1):
	if b[i] != '0':
		t[z] = [max(x, y) + 1, x]
		z += 1
	x += 1
	y -= 1
temp = [0] * z
for i in range(z):
	temp[i] = t[i]
if z == 1:
	x1 = pow(10, temp[0][1])
	a1 = a // x1 + a % x1
	print(a1)
else:
	temp.sort()
	x1 = pow(10, temp[0][1])
	x2 = pow(10, temp[1][1])
	a1 = a // x1 + a % x1
	a2 = a // x2 + a % x2
	if a1 < a2:
		print(a1)
	else:
		print(a2)


n = int(input())
A = input()
answer = float('inf')
check = True
m = int(n / 2)
j = int(n / 2)
if n % 2 != 0:
	m = m + 1
while check:
	a = A[:m]
	b = A[m:]
	c = A[:j]
	d = A[j:]
	if (a[0] == '0' or b[0] == '0') and (c[0] == '0' or d[0] == '0'):
		m += 1
		j -= 1
		continue
	if a[0] == '0' or b[0] == '0':
		c = int(c)
		d = int(d)
		answer = min(answer, c + d)
		check = False
	elif c[0] == '0' or d[0] == '0':
		a = int(a)
		b = int(b)
		answer = min(answer, a + b)
		check = False
	else:
		a = int(a)
		b = int(b)
		c = int(c)
		d = int(d)
		answer = min(answer, min(a + b, c + d))
		check = False
print(answer)


n = int(input())
s = input()
ans = int(s)
for i in range(n // 2 + 1, n):
	if s[i] == '0':
		continue
	a = s[:i]
	b = s[i:]
	ans = min(ans, int(a) + int(b))
	break
for i in range(n // 2, 0, -1):
	if s[i] == '0':
		continue
	a = s[:i]
	b = s[i:]
	ans = min(ans, int(a) + int(b))
	break
print(ans)


l = int(input())
n = input()
(x1, x2) = (l // 2, (l + 1) // 2)
min_val = 10 ** 1000000
while True:
	flag = False
	if n[x1] != '0':
		a = int(n[:x1])
		b = int(n[x1:])
		min_val = min(min_val, a + b)
		flag = True
	if n[x2] != '0':
		a = int(n[:x2])
		b = int(n[x2:])
		min_val = min(min_val, a + b)
		flag = True
	if flag == True:
		print(min_val)
		break
	else:
		x1 -= 1
		x2 += 1


l = int(input())
s = input()
lis = [i for i in range(1, l) if s[i] != '0']
lis.sort(key=lambda i: abs(i - l / 2))
ans = 10 ** int(100000.0)
for i in lis[:2]:
	ans = min(ans, int(s[i:]) + int(s[:i]))
print(ans)


from math import floor

def work(l):
	global len
	global n
	if l == 0:
		return int(n)
	a = ''
	b = ''
	a = n[0:l]
	b = n[l:len]
	lena = l
	lenb = len - l
	lb = 0
	while lb < lenb - 1 and b[lb] == '0':
		lb += 1
	if b[lb] == '0':
		ans = int(n)
	else:
		ans = int(a + b[0:lb]) + int(b[lb:lenb])
	la = lena - 1
	while lena and a[la] == '0':
		la -= 1
	if la:
		ans = min(ans, int(a[0:la]) + int(a[la:lena] + b))
	return ans
len = int(input())
n = input()
print(min(min(work(floor(len / 2)), work(floor((len + 1) / 2))), work(floor((len - 1) / 2))))


n = int(input())
s = input()
p1 = 0
p2 = None
for i in range(1, n):
	if s[i] != '0':
		if max(i, n - i) < max(p1, n - p1):
			p1 = i
			p2 = None
		elif max(i, n - i) == max(p1, n - p1):
			p2 = i
ans = int(s[p1:]) + int(s[:p1])
if p2 is None:
	print(ans)
else:
	x = int(s[p2:]) + int(s[:p2])
	print(min(ans, x))


length = int(input())
number = input().strip()
lStart = length // 2
if length % 2 == 0:
	rStart = length // 2
else:
	rStart = length // 2 + 1
lCut = 0
for i in reversed(range(1, lStart + 1)):
	rSubstring = number[i:length]
	if not rSubstring.startswith('0'):
		lCut = i
		break
rCut = -1
for i in range(rStart, length):
	rSubstring = number[i:length]
	if not rSubstring.startswith('0'):
		rCut = i
		break
if lCut == 0:
	caseOne = int(number)
else:
	caseOneLeft = int(number[0:lCut])
	caseOneRight = int(number[lCut:length])
	caseOne = caseOneLeft + caseOneRight
if rCut == -1:
	print(caseOne)
else:
	caseTwoLeft = int(number[0:rCut])
	caseTwoRight = int(number[rCut:length])
	caseTwo = caseTwoLeft + caseTwoRight
	print(min(caseOne, caseTwo))


from math import *
l = int(input())
ns = input()
splits = []
for i in range(1, l):
	if ns[-i] != '0':
		splits.append((abs(l - i - i), i))
splits.sort(key=lambda x: x[0])
s = min((int(ns[:-x[1]]) + int(ns[-x[1]:]) for x in splits if x[0] - splits[0][0] <= 1))
print(s)


import math
n = int(input())
a = input()
n = len(a)
mid = n // 2
(f, s) = (0, 0)
for i in range(mid, 0, -1):
	if a[i] != '0':
		f = i
		break
for i in range(mid + 1, n):
	if a[i] != '0':
		s = i
		break
ans = -1
if f != 0:
	fi = int(a[f:])
	se = int(a[0:f])
	if ans == -1:
		ans = fi + se
	else:
		ans = min(ans, fi + se)
if s != 0:
	fi = int(a[s:])
	se = int(a[0:s])
	if ans == -1:
		ans = fi + se
	else:
		ans = min(ans, fi + se)
print(ans)


l = int(input())
string = input()

def right(i):
	choice = -1
	while i < l and string[i] == '0':
		i += 1
	if i < l:
		choice = int(string[:i]) + int(string[i:])
	return choice

def left(i):
	choice = -1
	while i > 0 and string[i] == '0':
		i -= 1
	if i > 0:
		choice = int(string[:i]) + int(string[i:])
	return choice

def minimum(c1, c2):
	if c1 == -1:
		return c2
	elif c2 == -1:
		return c1
	return min(c1, c2)
if l & 1:
	c1 = right(l // 2)
	c2 = left(l // 2)
	t1 = minimum(c1, c2)
	c3 = right(l // 2 + 1)
	c4 = left(l // 2 + 1)
	t2 = minimum(c3, c4)
	print(min(t1, t2))
else:
	c1 = right(l // 2)
	c2 = left(l // 2)
	print(minimum(c1, c2))


n = int(input())
str = input()
ans = int(str)
flg = 0
for i in range(n // 2, 0, -1):
	tmp1 = str[:i]
	tmp2 = str[i:]
	if tmp2[0] != '0':
		ans = min(ans, int(tmp1) + int(tmp2))
	tmp1 = str[:n - i]
	tmp2 = str[n - i:]
	if tmp2[0] != '0':
		flg = 1
		ans = min(ans, int(tmp1) + int(tmp2))
	if flg == 1:
		break
print(ans)


num = input()
num = input()
n = len(num)

def split_value(s, ind):
	ans = int(s)
	if s[ind + 1] == '0':
		tmp = ind + 1
		while ind >= 0:
			if s[ind] == '0':
				ind -= 1
			else:
				s1 = s[:ind]
				s2 = s[ind:]
				if s1 == '':
					pass
				else:
					ans = min(ans, int(s1) + int(s2))
				break
		ind = tmp
		while ind < len(s):
			if s[ind] == '0':
				ind += 1
			else:
				s1 = s[:ind]
				s2 = s[ind:]
				ans = min(ans, int(s1) + int(s2))
				break
	else:
		s1 = s[:ind + 1]
		s2 = s[ind + 1:]
		if s2 == '':
			pass
		else:
			ans = min(ans, int(s1) + int(s2))
	return ans
print(min(split_value(num, n // 2), split_value(num, n // 2 - 1)))


from math import ceil

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return input()
l = ii()
s = si()
m = 1e309
p = ceil(l / 2) - 1
for i in range(p, 0, -1):
	if s[i] == '0':
		continue
	m = min(m, int(s[:i]) + int(s[i:]))
	break
for i in range(p + 1, l):
	if s[i] == '0':
		continue
	m = min(m, int(s[:i]) + int(s[i:]))
	break
print(m)


def ii():
	return int(input())
n = ii()
s = input()
l = len(s)
max_sum = float('inf')

def min_sum(i):
	global max_sum
	max_sum1 = int(s[:i + 1])
	max_sum2 = int(s[i + 1:])
	sum0 = max_sum1 + max_sum2
	if sum0 < max_sum:
		max_sum = sum0
cnt = 0
for i in range(l // 2, -1, -1):
	if s[i + 1] == '0':
		continue
	min_sum(i)
	cnt += 1
	if cnt == 3:
		break
cnt = 0
for i in range(l // 2 + 1, l - 1):
	if s[i + 1] == '0':
		continue
	min_sum(i)
	cnt += 1
	if cnt == 3:
		break
print(int(max_sum))


l = int(input())
n = str(input())
mn = -1
midpoint = l // 2
i = midpoint
numright = 0
while numright < 5 and i < l - 1:
	if n[i + 1] != '0':
		first = int(n[:i + 1])
		second = int(n[i + 1:])
		if mn == -1:
			mn = first + second
		else:
			mn = min(mn, first + second)
		numright += 1
	i += 1
i = midpoint
numleft = 0
while numleft < 5 and i >= 0:
	if n[i + 1] != '0':
		first = int(n[:i + 1])
		second = int(n[i + 1:])
		if mn == -1:
			mn = first + second
		else:
			mn = min(mn, first + second)
		numleft += 1
	i -= 1
print(mn)


n = int(input())
x = input()
r = n // 2 - 2
d = r + 4
ans = int(x)
while r <= d:
	if r < 1:
		r += 1
		continue
	if r >= n:
		r += 1
		continue
	w = r
	if x[w] == '0':
		while w < n and x[w] == '0':
			w += 1
		if w < n:
			ans = min(ans, int(x[0:w]) + int(x[w:n]))
		w = r
		while w > 0 and x[w] == '0':
			w -= 1
		if w > 0:
			ans = min(ans, int(x[0:w]) + int(x[w:n]))
	else:
		ans = min(ans, int(x[0:w]) + int(x[w:n]))
	r += 1
print(ans)


import math
l = int(input())
n = input()
if n.count('0') == l - 1:
	print(n)
else:
	if l % 2 == 0:
		a = l // 2
		b = l // 2
	else:
		a = int(math.floor(l / 2))
		b = int(math.ceil(l / 2))
	while a != -1 and n[a] == '0':
		a -= 1
	while b != l and n[b] == '0':
		b += 1
	st1 = (l + 1) * '0' + n[:a]
	st2 = (l + 1) * '0' + n[a:]
	st3 = (l + 1) * '0' + n[:b]
	st4 = (l + 1) * '0' + n[b:]
	mlab = max(len(st1), len(st2)) - 1
	mlba = max(len(st3), len(st4)) - 1
	d = ['0'] * (l + 1)
	c = 0
	i = -1
	while i >= -(l + 1):
		u = str(int(st1[i]) + int(st2[i]) + c)
		if len(u) > 1:
			c = int(u[0])
			k = u[1]
			d[i] = str(u[1])
		else:
			d[i] = str(u)
			c = 0
		i -= 1
	d1 = [0] * (l + 1)
	i = -1
	c = 0
	while i >= -l:
		u = str(int(st3[i]) + int(st4[i]) + c)
		if len(u) > 1:
			c = int(u[0])
			k = u[1]
			d1[i] = str(u[1])
		else:
			d1[i] = str(u)
			c = 0
		i -= 1
	while d[0] == 0 or d[0] == '0':
		d.pop(0)
	while d1[0] == 0 or d1[0] == '0':
		d1.pop(0)
	if len(d) > len(d1):
		print(''.join(d1))
	elif len(d1) > len(d):
		print(''.join(d))
	else:
		res = 0
		for i in range(len(d)):
			if d[i] < d1[i]:
				res = 0
				break
			elif d1[i] < d[i]:
				res = 1
				break
		if res == 1:
			print(''.join(d1))
		else:
			print(''.join(d))


n = int(input())
s = input()
mid = len(s) // 2
l = mid
r = mid + 1
while l >= 0 and s[l] == '0':
	l -= 1
while r < len(s) and s[r] == '0':
	r += 1
if r == len(s):
	s1 = int(s[0:l])
	s2 = int(s[l:])
	print(s1 + s2)
elif l == 0:
	s1 = int(s[0:r])
	s2 = int(s[r:])
	print(s1 + s2)
else:
	s1 = int(s[0:l])
	s2 = int(s[l:])
	s3 = int(s[0:r])
	s4 = int(s[r:])
	print(min(s1 + s2, s3 + s4))


n = int(input())
num = input()

def mn(a, b):
	x = int(num[:a]) + int(num[a:])
	y = int(num[:b]) + int(num[b:])
	if x < y:
		return a
	else:
		return b
if n & 1 > 0:
	idx = mn(n // 2, n // 2 + 1)
else:
	idx = n // 2
lead_a = 0
lead_b = 0
i = idx
while i < n:
	if num[i] == '0':
		lead_a += 1
		if i == n - 1:
			lead_a = n
	else:
		break
	i += 1
i = idx - 1
while i >= 0:
	if num[i] == '0':
		lead_b += 1
	else:
		break
	i -= 1
if lead_a == n:
	idx -= lead_b + 1
elif idx - lead_b - 1 == 0:
	idx += lead_a
else:
	idx = mn(idx + lead_a, idx - lead_b - 1)
ans = int(num[:idx]) + int(num[idx:])
print(ans)


n = int(input())
s = input()
ar = list(sorted(range(1, n), key=lambda x: max(x, n - x)))
t = int(s)
rem = 4
for x in ar:
	if s[x] != '0':
		if rem == 0:
			break
		rem -= 1
		t = min(t, int(s[:x]) + int(s[x:]))
print(t)


l = int(input())
n_str = input()
foundr = 0
foundl = 0
ans = int(n_str)
for i in range(l // 2, l):
	if n_str[i] == '0':
		continue
	elif foundr == 0:
		foundr = 1
		ans = int(n_str[0:i]) + int(n_str[i:l])
	else:
		ans = min(ans, int(n_str[0:i]) + int(n_str[i:l]))
		foundr = foundr + 1
		if foundr > 1:
			break
for i in range(l // 2 - 1, 0, -1):
	if n_str[i] == '0':
		continue
	else:
		foundl += 1
		ans = min(ans, int(n_str[0:i]) + int(n_str[i:l]))
		if foundl > 1:
			break
print(ans)


import math

def spec(n, l):
	pos = neg = int(l / 2)
	try:
		while n[pos] == '0':
			pos += 1
	except IndexError:
		pos = l
	try:
		while n[neg] == '0':
			neg -= 1
	except IndexError:
		neg = 0
	np1 = n[:neg]
	np2 = n[neg:]
	pp1 = n[:pos]
	pp2 = n[pos:]
	if np1 == '':
		np1 = '0'
	if np2 == '':
		np2 = '0'
	if pp1 == '':
		pp1 = '0'
	if pp2 == '':
		pp2 = '0'
	sum1 = int(np1) + int(np2)
	sum2 = int(pp1) + int(pp2)
	if sum1 <= sum2:
		return sum1
	else:
		return sum2

def even(num):
	if num % 2 == 0:
		return False
	else:
		return True
l = int(input())
n = input()
if even(l):
	p11 = n[:int(l / 2)]
	p12 = n[int(l / 2):]
	p21 = n[:int(l / 2) + 1]
	p22 = n[int(l / 2) + 1:]
	if p12[0] != '0' and p22[0] != '0':
		sum1 = int(p11) + int(p12)
		sum2 = int(p21) + int(p22)
		if sum1 <= sum2:
			print(sum1)
		else:
			print(sum2)
	else:
		print(spec(n, l))
else:
	p1 = n[:int(l / 2)]
	p2 = n[int(l / 2):]
	if p2[0] != '0':
		print(int(p1) + int(p2))
	else:
		print(spec(n, l))


n = int(input())
a = input()
mid = n // 2
while mid < n - 1 and a[mid + 1] == '0':
	mid += 1
first = a[:mid + 1]
if first == '':
	first = 0
else:
	first = int(first)
second = a[mid + 1:]
if second == '':
	second = 0
else:
	second = int(second)
ans1 = first + second
mid = n // 2
while a[mid] == '0':
	mid -= 1
first = a[:mid]
if first == '':
	first = 0
else:
	first = int(first)
second = a[mid:]
if second == '':
	second = 0
else:
	second = int(second)
ans2 = first + second
print(min(ans1, ans2))


def cal(s, inx, len):
	l = int(s[0:inx])
	r = int(s[inx:len])
	return l + r
n = int(input())
s = input()
res = -1
i = n // 2
flag = 1
while flag != 0:
	i += 1
	if i > n - 1:
		break
	if s[i] == '0':
		continue
	flag -= 1
	if res == -1:
		res = cal(s, i, n)
	else:
		res = min(res, cal(s, i, n))
flag = 1
i = n // 2 + 1
while flag != 0:
	i -= 1
	if i <= 0:
		break
	if s[i] == '0':
		continue
	flag -= 1
	if res == -1:
		res = cal(s, i, n)
	else:
		res = min(res, cal(s, i, n))
print(res)


import sys
l = int(input())
s = input()
n = l // 2
ans = 0
(c1, c2) = (int(s), int(s))
f = 0
while n > 0:
	k = l - n
	if s[n] != '0':
		c1 = int(s[0:n:1]) + int(s[n:l:1])
		f = 1
	if s[k] != '0':
		c2 = int(s[0:k:1]) + int(s[k:l:1])
		f = 1
	if f == 1:
		ans = min(c1, c2)
		break
	n -= 1
print(ans)


l = int(input())
s = input()
x = (l + 1) // 2
y = x - 1
while x < l and s[x] == '0':
	x += 1
while y > 0 and s[y] == '0':
	y -= 1
ans = int(s)
if y > 0:
	ans = min(ans, int(s[:y]) + int(s[y:]))
if x < l:
	ans = min(ans, int(s[:x]) + int(s[x:]))
print(ans)


n = int(input())
a = input()
ans = int(a)
k = n // 2
i = k
while i < n and a[i] == '0':
	i += 1
if i < n - 1:
	ans = min(ans, int(a[:i]) + int(a[i:]))
i = k
while i >= 0 and a[i] == '0':
	i -= 1
if i > 0:
	ans = min(ans, int(a[:i]) + int(a[i:]))
k = (n + 1) // 2
i = k
while i < n and a[i] == '0':
	i += 1
if i < n - 1:
	ans = min(ans, int(a[:i]) + int(a[i:]))
i = k
while i >= 0 and a[i] == '0':
	i -= 1
if i > 0:
	ans = min(ans, int(a[:i]) + int(a[i:]))
k = (n + 1) // 2
print(ans)


import sys
inp = sys.stdin.readlines()
a = int(inp[0].strip())
numb = str(inp[1].strip())
mind = len(numb)
n = len(numb)
lst = []
for i in range(1, n):
	if not numb[i] == '0':
		mind = min(mind, max(i, n - i))
mind += 1
for i in range(1, n):
	if max(i, n - i) <= mind:
		if not numb[i] == '0':
			lst.append(int(numb[:i]) + int(numb[i:]))
print(min(lst))


n = int(input().strip())
str = input()
ans = 1e309
pos = int(n / 2 - 1)
while pos >= 0 and str[pos + 1] == '0':
	pos = pos - 1
if pos >= 0 and str[pos + 1] != '0':
	suma = int(str[0:pos + 1])
	sumb = int(str[pos + 1:n + 1])
	sum = suma + sumb
	if sum < ans:
		ans = sum
pos = int(n / 2 - 1)
while pos < n - 1 and str[pos + 1] == '0':
	pos = pos + 1
if pos < n - 1 and str[pos + 1] != '0':
	suma = int(str[0:pos + 1])
	sumb = int(str[pos + 1:n + 1])
	sum = suma + sumb
	if sum < ans:
		ans = sum
pos = int(n / 2)
while pos >= 0 and str[pos + 1] == '0':
	pos = pos - 1
if pos >= 0 and str[pos + 1] != '0':
	suma = int(str[0:pos + 1])
	sumb = int(str[pos + 1:n + 1])
	sum = suma + sumb
	if sum < ans:
		ans = sum
pos = int(n / 2)
while pos < n - 1 and str[pos + 1] == '0':
	pos = pos + 1
if pos < n - 1 and str[pos + 1] != '0':
	suma = int(str[0:pos + 1])
	sumb = int(str[pos + 1:n + 1])
	sum = suma + sumb
	if sum < ans:
		ans = sum
print(ans)


def get(s):
	if s is None or s == '':
		return 0
	return int(s)
n = int(input())
s = input()
l = len(s)
m = l >> 1
(pl, pr) = (m, m + 1)
while pl >= 0 and s[pl] == '0':
	pl -= 1
while pr < l and s[pr] == '0':
	pr += 1
x = min(get(s[:pl]) + get(s[pl:]), get(s[:pr]) + get(s[pr:]))
print(x)


def ab(n, p, q):
	ans = -1
	x = min(len(p), len(q))
	if q[0] != '0':
		ans = int(p) + int(q)
		return ans
	for i in range(x - 1):
		if p[len(p) - i - 1] != '0' and q[i + 1] != '0':
			return min(int(p[:len(p) - 1 - i]) + int(p[len(p) - 1 - i:] + q), int(p + q[:i + 1]) + int(q[i + 1:]))
		if p[len(p) - 1 - i] != '0':
			return int(p[:len(p) - 1 - i]) + int(p[len(p) - 1 - i:] + q)
		if q[i + 1] != '0':
			return int(p + q[:i + 1]) + int(q[i + 1:])
	return int('9' * n)
t = 1
while t:
	t -= 1
	n = int(input())
	s = input()
	if n % 2 == 0:
		p = s[:n // 2]
		q = s[n // 2:]
		print(ab(n, p, q))
	else:
		p = s[:n // 2 + 1]
		q = s[n // 2 + 1:]
		p1 = s[:n // 2]
		q1 = s[n // 2:]
		print(min(ab(n, p, q), ab(n, p1, q1)))


import math
l = input()
x = input()
(div, div1, div2) = (int(int(l) / 2), int(int(l) / 2) - 1, int(int(l) / 2) + 1)
(ans1, ans2, ans3) = (math.inf, math.inf, math.inf)
if x[div] != '0':
	ans1 = int(x[:div]) + int(x[div:])
for i in range(div1, 0, -1):
	if x[i] != '0' and i:
		ans2 = int(x[:i]) + int(x[i:])
		break
for i in range(div2, len(x)):
	if x[i] != '0':
		ans3 = int(x[:i]) + int(x[i:])
		break
print(min(ans1, ans2, ans3))


l = int(input())
s = input()
for i in range(l // 2, 0, -1):
	if s[i] != '0' and s[l - i] != '0':
		print(min(int(s[:i]) + int(s[i:]), int(s[:l - i]) + int(s[l - i:])))
		break
	elif s[i] != '0':
		print(int(s[:i]) + int(s[i:]))
		break
	elif s[l - i] != '0':
		print(int(s[:l - i]) + int(s[l - i:]))
		break


def prov(a, b):
	if b[0] == '0':
		return (False, 0)
	else:
		return (True, int(a) + int(b))
x = int(input())
n = input()
l = x // 2
r = l
if x % 2 == 1:
	r += 1
y = 0
while y == 0:
	(q, w) = prov(n[:l], n[l:])
	(q1, w1) = prov(n[:r], n[r:])
	l -= 1
	r += 1
	p = float('inf')
	if q:
		p = w
	if q1:
		p = min(p, w1)
	if p != float('inf'):
		y = 1
		print(p)


l = int(input())
s = input()
split = [1] * l
for i in range(l):
	if s[i] == '0':
		split[i] = 0
if l % 2:
	c1 = l // 2
	c2 = 1 + l // 2
else:
	c1 = l // 2
	c2 = l // 2
i = 0
while 1:
	if c1 - i >= 0 and split[c1 - i]:
		m1 = int(s[:c1 - i]) + int(s[c1 - i:])
	else:
		m1 = -1
	if c2 + i < l and split[c2 + i]:
		m2 = int(s[:c2 + i]) + int(s[c2 + i:])
	else:
		m2 = -1
	if m1 == -1 and m2 == -1:
		pass
	elif m1 == -1:
		ans = m2
		break
	elif m2 == -1:
		ans = m1
		break
	else:
		ans = min(m1, m2)
		break
	i += 1
print(ans)


n = int(input())
s = input()
c1 = n // 2
c2 = n // 2 + 1
while c1 > 0 and s[c1] == '0':
	c1 -= 1
while c2 < n and s[c2] == '0':
	c2 += 1
if c1 > 0:
	(x1, x2) = (int(s[:c1]), int(s[c1:]))
	s1 = x1 + x2
else:
	(y1, y2) = (int(s[:c2]), int(s[c2:]))
	s2 = y1 + y2
	print(s2)
	exit(0)
if c2 < n:
	(y1, y2) = (int(s[:c2]), int(s[c2:]))
	s2 = y1 + y2
else:
	(x1, x2) = (int(s[:c1]), int(s[c1:]))
	s1 = x1 + x2
	print(s1)
	exit(0)
print(min(s1, s2))


n = input()
str = input()
i = int(len(str) // 2)
Len = len(str)
ans = '1'
for ii in range(1, 100220):
	ans += '0'
ans = int(ans)
iii = i
while iii < Len:
	if str[iii] != '0':
		break
	iii += 1
jjj = i
while jjj >= 0:
	if str[jjj] != '0':
		break
	jjj -= 1
if iii == jjj:
	for j in range(jjj - 1, iii + 2):
		id = j
		if id <= 0 or Len - id <= 0:
			continue
		str1 = str[0:id]
		str2 = str[id:Len]
		if str1[0] == '0' or str2[0] == '0':
			continue
		num1 = int(str1)
		num2 = int(str2)
		ans = min(ans, num1 + num2)
else:
	la = {iii + 1, jjj - 1, iii, jjj}
	for j in la:
		id = j
		if id <= 0 or Len - id <= 0:
			continue
		str1 = str[0:id]
		str2 = str[id:Len]
		if str1[0] == '0' or str2[0] == '0':
			continue
		num1 = int(str1)
		num2 = int(str2)
		ans = min(ans, num1 + num2)
print(ans)


import io, os
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
l = ii()
n = input().strip()
ans = int(n)
mid = (l - 1) // 2
for i in range(mid, -1, -1):
	if n[i + 1] == '0':
		continue
	ans = min(ans, int(n[0:i + 1]) + int(n[i + 1:]))
	break
mid = l // 2
for i in range(mid, l, 1):
	if n[i] == '0':
		continue
	ans = min(ans, int(n[0:i]) + int(n[i:]))
	break
print(ans)


import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
L = [[] for _ in range(N)]
for n in range(N - 1):
	if S[n + 1] != '0':
		L[max(n + 1, N - n - 1)].append(n)

def make_sum(s1, s2):
	if len(s1) < len(s2):
		tmp = s2
		s2 = s1
		s1 = tmp
	(l1, l2) = (len(s1), len(s2))
	s2 = '0' * (l1 - l2) + s2
	S = [0] * (l1 + 1)
	for i in range(l1):
		a = int(s2[-i - 1]) + int(s1[-i - 1]) + S[i]
		S[i] = a % 10
		S[i + 1] += a // 10
	go = False
	a = ''
	for n in range(l1, -1, -1):
		if S[n] == 0 and (not go):
			continue
		else:
			go = True
			a += str(S[n])
	return a

def smaller(s1, s2):
	if len(s1) > len(s2):
		return s2
	elif len(s1) < len(s2):
		return s1
	else:
		l = len(s1)
		for i in range(l):
			if s1[i] > s2[i]:
				return s2
			elif s1[i] < s2[i]:
				return s1
	return s1
ans = '9' * N
c = 0
for l in range(N):
	update = False
	for n in L[l]:
		(s1, s2) = (S[:n + 1], S[n + 1:])
		a = make_sum(s1, s2)
		ans = smaller(ans, a)
		update = True
	if update:
		c += 1
	if c > 3:
		break
print(ans)


def findSum(str1, str2):
	if len(str1) > len(str2):
		t = str1
		str1 = str2
		str2 = t
	str = ''
	n1 = len(str1)
	n2 = len(str2)
	str1 = str1[::-1]
	str2 = str2[::-1]
	carry = 0
	for i in range(n1):
		sum = ord(str1[i]) - 48 + (ord(str2[i]) - 48 + carry)
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	for i in range(n1, n2):
		sum = ord(str2[i]) - 48 + carry
		str += chr(sum % 10 + 48)
		carry = int(sum / 10)
	if carry:
		str += chr(carry + 48)
	str = str[::-1]
	return str
q = 1
for _ in range(q):
	n = int(input())
	s = input()
	if n % 2 == 0:
		j = n // 2
		i = n // 2 - 1
		if s[i] != '0' and s[j] != '0':
			p1 = s[0:i + 1]
			p2 = s[j:]
			x = findSum(p1, p2)
			print(x)
		else:
			ans = int(s)
			while s[i] == '0':
				i -= 1
			p1 = ''
			if i > 0:
				p1 = s[0:i]
			p2 = s[i:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			while j < n and s[j] == '0':
				j += 1
			p1 = s[0:j]
			p2 = ''
			if j < n:
				p2 = s[j:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			print(ans)
	else:
		j = n // 2
		ans = int(s)
		if s[j] != '0':
			p1 = s[0:j]
			p2 = s[j:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			p1 = s[0:j + 1]
			p2 = s[j + 1:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			print(ans)
		else:
			ans = int(s)
			i = n // 2
			while s[i] == '0':
				i -= 1
			p1 = ''
			if i > 0:
				p1 = s[0:i]
			p2 = s[i:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			while j < n and s[j] == '0':
				j += 1
			p1 = s[0:j]
			p2 = ''
			if j < n:
				p2 = s[j:]
			x = findSum(p1, p2)
			ans = min(ans, int(x))
			print(ans)


def minsplit(n, m):
	if n[m] == '0':
		i = m
		while i >= 1 and n[i] == '0':
			i -= 1
		if i == 0:
			k1 = -1
		else:
			k1 = int(n[:i]) + int(n[i:])
		i = m
		while i < len(n) and n[i] == '0':
			i += 1
		if i == len(n):
			k2 = -1
		else:
			k2 = int(n[:i]) + int(n[i:])
		if k1 == -1:
			return k2
		elif k2 == -1:
			return k1
		else:
			return min(k1, k2)
	else:
		return int(n[:m]) + int(n[m:])
l = int(input())
n = input()
if l % 2 == 0:
	print(minsplit(n, l // 2))
else:
	print(min(minsplit(n, l // 2), minsplit(n, l // 2 + 1)))


l = int(input())
m = input()
index = 0
index_right = -1
if m[len(m) // 2] == '0':
	for i in range(len(m) // 2, -1, -1):
		if m[i] != '0':
			index = i
			break
	for i in range(len(m) // 2, len(m)):
		if m[i] != '0':
			index_right = i
			break
	if index_right == -1:
		right = m[index:]
		left = m[:index]
		print(int(left) + int(right))
	elif index == 0:
		left1 = m[:index_right]
		right1 = m[index_right:]
		print(int(left1) + int(right1))
	else:
		left1 = m[:index_right]
		right1 = m[index_right:]
		left2 = m[:index]
		right2 = m[index:]
		print(min(int(left1) + int(right1), int(right2) + int(left2)))
else:
	print(min(int(m[0:len(m) // 2 + 1]) + int(m[len(m) // 2 + 1:]), int(m[0:len(m) // 2]) + int(m[len(m) // 2:]), int(m[0:len(m) // 2 - 1]) + int(m[len(m) // 2 - 1:])))


l = int(input())
n = input()
ind = []
for i in range(1, l):
	if n[i] == '0':
		continue
	ind.append((abs(i - l / 2), i))
ind.sort()
sol = -1
for i in range(min(4, len(ind))):
	(x, y) = ind[i]
	curr = int(n[:y]) + int(n[y:])
	if sol == -1 or curr < sol:
		sol = curr
print(sol)


l = int(input())
n = input().strip()
k = l // 2
ans = int(n)

def getLeft(i):
	while i >= 0:
		if n[i] is not '0':
			break
		else:
			i = i - 1
	return i

def getRight(i, l):
	while i < l:
		if n[i] is not '0':
			break
		else:
			i = i + 1
	return i
if l % 2 is 0:
	if n[k] is not '0':
		ans = int(n[:k]) + int(n[k:])
	else:
		i = getLeft(k)
		ans = int(n[:i]) + int(n[i:])
		i = getRight(k, l)
		if i is l:
			ans = min(ans, int(n))
		else:
			ans = min(ans, int(n[:i]) + int(n[i:]))
else:
	k1 = l // 2
	if n[k1] is not '0':
		ans1 = int(n[:k1]) + int(n[k1:])
	else:
		i = getLeft(k1)
		if i is 0 or i is l:
			ans1 = int(n)
		else:
			ans1 = int(n[:i]) + int(n[i:])
		i = getRight(k1, l)
		if i is 0 or i is l:
			ans1 = min(ans1, int(n))
		else:
			ans1 = min(ans1, int(n[:i]) + int(n[i:]))
	k2 = k1 + 1
	if n[k2] is not '0':
		if k2 is l:
			ans2 = int(n)
		else:
			ans2 = int(n[:k2]) + int(n[k2:])
	else:
		i = getLeft(k2)
		if i is 0 or i is l:
			ans2 = int(n)
		else:
			ans2 = int(n[:i]) + int(n[i:])
		i = getRight(k2, l)
		if i is 0 or i is l:
			ans2 = min(ans2, int(n))
		else:
			ans2 = min(ans2, int(n[:i]) + int(n[i:]))
	ans = min(ans1, ans2)
print(ans)


n = int(input())
s = input()
(x, y) = (n // 2, n // 2 + 1)
while x > 0 and s[x] == '0':
	x -= 1
while y < n and s[y] == '0':
	y += 1
if x == 0:
	print(int(s[:y]) + int(s[y:]))
elif y == n:
	print(int(s[:x]) + int(s[x:]))
else:
	print(min(int(s[:y]) + int(s[y:]), int(s[:x]) + int(s[x:])))


from sys import stdin, stdout
from math import cos, sin, sqrt, acos, atan2, pi

def sqr(a):
	return a * a

def dist(a, b=(0, 0)):
	return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]))

def s_dist(a, b=(0, 0)):
	return sqr(a[0] - b[0]) + sqr(a[1] - b[1])

def dist3(a, b=(0, 0, 0)):
	return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2]))

def s_dist3(a, b=(0, 0, 0)):
	return sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2])

def trans(p, al):
	return (p[0] * cos(al) + p[1] * sin(al), -p[0] * sin(al) + p[1] * cos(al))

def get_angle(a, b, c):
	cos_al = (sqr(a) + sqr(b) - sqr(c)) / (2 * a * b)
	return acos(cos_al)

def write_float(ans):
	stdout.write(str('%.3f' % ans) + '\n')

def get_hight(pt1, pt2, pt3):
	a = (pt2[0] - pt1[0], pt2[1] - pt1[1])
	b = (pt3[0] - pt1[0], pt3[1] - pt1[1])
	return abs(a[0] * b[1] - a[1] * b[0]) / dist(pt1, pt2)

def get_square(pt1, pt2, pt3):
	a = (pt2[0] - pt1[0], pt2[1] - pt1[1])
	b = (pt3[0] - pt2[0], pt3[1] - pt2[1])
	return (a[0] * b[-1] - a[1] * b[0]) / 2

def sign(v):
	if v > 0:
		return 1
	elif v < 0:
		return -1
	else:
		return 0

def inn(pt, triangle):
	signs = set()
	signs.add(sign(get_square(triangle[0], triangle[1], pt)))
	signs.add(sign(get_square(triangle[1], triangle[2], pt)))
	signs.add(sign(get_square(triangle[2], triangle[0], pt)))
	return len(signs) == 1

def inter_in(a, b):
	return dist((a[0], a[1]), (b[0], b[1])) < a[-1] + b[-1]

def inter_in3(a, b):
	return dist3(a[:-1], b[:-1]) < a[-1] + b[-1]

def shift(what, wth):
	return (what[0] - wth[0], what[1] - wth[1])

def check(lel):
	if lel[-1] != lel.count(0):
		return 0
	for i in range(1, len(lel)):
		if lel[i - 1] != lel.count(i):
			return 0
	return 1

def stupid(b):
	for i in range(b ** b - 1):
		v = i
		lel = []
		d = b ** (b - 1)
		while d:
			lel.append(v // d)
			v %= d
			d //= b
		if check(lel):
			return lel
	return []
n = int(stdin.readline())
s = stdin.readline().strip()
ans = float('inf')
if len(s) <= 100:
	for i in range(1, len(s)):
		if s[i] != '0':
			ans = min(ans, int(s[:i]) + int(s[i:]))
else:
	(l, r) = (5, 5)
	ind = len(s) // 2
	while ind and l:
		if s[ind] != '0':
			l -= 1
			(a, b) = (s[:ind], s[ind:])
			ans = min(ans, int(a) + int(b))
		ind -= 1
	ind = len(s) // 2
	while ind < len(s) and r:
		if s[ind] != '0':
			r -= 1
			(a, b) = (s[:ind], s[ind:])
			ans = min(ans, int(a) + int(b))
		ind += 1
stdout.write(str(ans))


n = int(input())
s = str(input())
z = n // 2
l = z
p = '9' * 113110
p = int(p)
res = p
cnt = 0
for i in range(l, n):
	if s[i] == '0':
		continue
	cnt += 1
	s1 = s[:i]
	s2 = s[i:]
	s1 = int(s1)
	s2 = int(s2)
	p = min(p, s1 + s2)
	if cnt >= 3:
		break
cnt = 0
for i in range(l, 0, -1):
	if s[i] == '0':
		continue
	cnt += 1
	s1 = s[:i]
	s2 = s[i:]
	s1 = int(s1)
	s2 = int(s2)
	p = min(p, s1 + s2)
	if cnt >= 3:
		break
print(p)


l = int(input())
s = input()
ans = -1
mid = l // 2
for i in range(mid + 1, l):
	s1 = s[:i]
	s2 = s[i:]
	if s1[0] == '0':
		continue
	if s2[0] == '0':
		continue
	if ans == -1:
		ans = int(s1) + int(s2)
	else:
		ans = min(ans, int(s1) + int(s2))
	break
for i in range(mid, 0, -1):
	s1 = s[:i]
	s2 = s[i:]
	if s1[0] == '0':
		continue
	if s2[0] == '0':
		continue
	if ans == -1:
		ans = int(s1) + int(s2)
	else:
		ans = min(ans, int(s1) + int(s2))
	break
for i in range(mid - 1, 0, -1):
	s1 = s[:i]
	s2 = s[i:]
	if s1[0] == '0':
		continue
	if s2[0] == '0':
		continue
	if ans == -1:
		ans = int(s1) + int(s2)
	else:
		ans = min(ans, int(s1) + int(s2))
	break
print(ans)


n = int(input())
s = input()
ans = 10 ** (n + 3)
a = []
for i in range(1, n):
	if s[i] != '0':
		a.append(i)
i = 0
while i < len(a) and a[i] <= n // 2:
	i += 1
for j in range(max(i - 3, 0), min(i + 3, len(a))):
	ans = min(int(s[:a[j]]) + int(s[a[j]:]), ans)
print(ans)


l = int(input())
a = input()
a = str(a)
fuck = int(a)
count = 0
bb = []
if a[l - 1] != '0':
	fuck = int(a[:l - 1]) + int(a[l - 1:])
for i in range(l - 1):
	if a[i] == '0' and a[i + 1] != '0':
		count += 1
		bb.append(i)
	elif a[i] != '0' and a[i + 1] != '0':
		count += 1
		bb.append(i)
code = []
for i in range(6):
	tdygdh = 3
mid = l // 2
for i in range(4):
	iloveamit = 1
for i in range(count):
	temp = []
	temp.append(abs(mid - bb[i]))
	temp.append(bb[i])
	for i in range(1):
		gigi = 1
	code.append(temp)
code.sort(key=lambda x: x[0])
for i in range(min(10, len(code))):
	if int(a[:code[i][1] + 1]) + int(a[code[i][1] + 1:]) < int(fuck):
		fuck = int(a[:code[i][1] + 1]) + int(a[code[i][1] + 1:])
print(fuck)


size = int(input())
number = list(input())
if size < 5:
	min_num = 99999999
	for start2 in range(1, size):
		if number[start2] == '0':
			continue
		num = int(''.join(number[:start2])) + int(''.join(number[start2:]))
		if num < min_num:
			min_num = num
	print(min_num)
	exit(0)
start1 = size // 2
while start1 >= 0:
	if number[start1] == '0':
		start1 -= 1
	else:
		break
start2 = size // 2 + 1
while start2 < size:
	if number[start2] == '0':
		start2 += 1
	else:
		break
if start1 == 0:
	print(int(''.join(number[:start2])) + int(''.join(number[start2:])))
	exit(0)
if start2 == size:
	print(int(''.join(number[:start1])) + int(''.join(number[start1:])))
	exit(0)
sub_num1 = int(''.join(number[:start1])) + int(''.join(number[start1:]))
sub_num2 = int(''.join(number[:start2])) + int(''.join(number[start2:]))
print(min(sub_num1, sub_num2))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
ind1 = 0
ind2 = n + 1
s = si()
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		ind2 = i
		break
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		ind1 = i
		break
mn = int('0' + s[:ind1]) + int('0' + s[ind1:])
mn = min(mn, int('0' + s[:ind2]) + int('0' + s[ind2:]))
print(mn)


from math import ceil, floor
l = int(input())
s = input()
(mid_l, mid_r) = (l // 2 - 1, l // 2) if l % 2 == 0 else (l // 2 - 1, l // 2 + 1)
left = -1
for i in range(mid_l, 0, -1):
	if s[i] != '0':
		left = i
		break
right = -1
for i in range(mid_r, l, 1):
	if s[i] != '0':
		right = i
		break
n = float('inf')
if left != -1:
	n = int(s[:left]) + int(s[left:])
if right != -1:
	n_r = int(s[:right]) + int(s[right:])
	if n > n_r:
		n = n_r
if l % 2 == 1 and s[l // 2] != '0':
	n_m = int(s[:l // 2]) + int(s[l // 2:])
	if n > n_m:
		n = n_m
print(n)


L = int(input())
N = str(input())
ans = 10 ** 100000
l = L // 2
r = L // 2 + 1
while l > 0 and N[l] == '0':
	l -= 1
while r < L and N[r] == '0':
	r += 1
if l != 0:
	ans = min(ans, int(N[:l]) + int(N[l:]))
if r != L:
	ans = min(ans, int(N[:r]) + int(N[r:]))
print(ans)


import sys
l = int(input())
S = input()
if l % 2 == 0:
	m2 = l // 2
	m1 = m2 - 1
	if S[m2] != '0':
		print(int(S[:m2]) + int(S[m2:]))
		sys.exit()
	m2 += 1
else:
	m1 = l // 2
	m2 = m1 + 1
while S[m1] == '0' and S[m2] == '0':
	m1 -= 1
	m2 += 1
if S[m1] != '0' and S[m2] != '0':
	print(min(int(S[:m1]) + int(S[m1:]), int(S[:m2]) + int(S[m2:])))
elif S[m1] != '0':
	print(int(S[:m1]) + int(S[m1:]))
else:
	print(int(S[:m2]) + int(S[m2:]))


l = int(input())
n = input()
mid = l // 2 + 1
ans = int(n)
for x in range(mid, 0, -1):
	if n[x] == '0':
		continue
	ans = min(ans, int(n[:x]) + int(n[x:]))
	break
mid = l // 2
for x in range(mid, l - 1):
	if n[x] == '0':
		continue
	ans = min(ans, int(n[:x]) + int(n[x:]))
	break
print(ans)


n = int(input())
a = input()
s = str(a)
ans = 1e309
cnt = 0
for i in range(n // 2, -1, -1):
	if s[int(i + 1)] == '0':
		continue
	ans = min(ans, int(s[0:i + 1]) + int(s[i + 1:n]))
	cnt = cnt + 1
	if cnt >= 2:
		break
cnt = 0
for i in range(n // 2, n - 1, 1):
	if s[int(i + 1)] == '0':
		continue
	ans = min(ans, int(s[0:i + 1]) + int(s[i + 1:n]))
	cnt = cnt + 1
	if cnt >= 2:
		break
print(ans)


n = int(input())
s = input()
if n % 2 == 0:
	if s[n // 2] != '0':
		print(int(s[:n // 2]) + int(s[n // 2:]))
	else:
		ok = 0
		for i in range(1, n // 2 + 1):
			if ok == 1:
				break
			if s[n // 2 - i] != '0' and s[n // 2 + i] != '0':
				ok = 1
				print(min(int(s[:n // 2 - i]) + int(s[n // 2 - i:]), int(s[:n // 2 + i]) + int(s[n // 2 + i:])))
			elif s[n // 2 - i] != '0':
				ok = 1
				print(int(s[:n // 2 - i]) + int(s[n // 2 - i:]))
			elif s[n // 2 + i] != '0':
				ok = 1
				print(int(s[:n // 2 + i]) + int(s[n // 2 + i:]))
else:
	ok = 0
	for i in range(1, n // 2 + 1):
		if ok == 1:
			break
		if s[n // 2 - i + 1] != '0' and s[n // 2 + i] != '0':
			ok = 1
			print(min(int(s[:n // 2 - i + 1]) + int(s[n // 2 - i + 1:]), int(s[:n // 2 + i]) + int(s[n // 2 + i:])))
		elif s[n // 2 - i + 1] != '0':
			ok = 1
			print(int(s[:n // 2 - i + 1]) + int(s[n // 2 - i + 1:]))
		elif s[n // 2 + i] != '0':
			ok = 1
			print(int(s[:n // 2 + i]) + int(s[n // 2 + i:]))


from sys import stdin
from sys import stdout
l = int(stdin.readline())
s = stdin.readline()
mn = int(-1)
sum = int()
i = l // 2
while 0 < i and i < l:
	if s[i] == '0':
		i += 1
		continue
	a = int(s[:i])
	b = int(s[i:])
	sum = a + b
	if mn == -1 or mn > sum:
		mn = sum
	else:
		break
	i += 1
i = l // 2
while 0 < i and i < l:
	if s[i] == '0':
		i -= 1
		continue
	a = int(s[:i])
	b = int(s[i:])
	sum = a + b
	if mn == -1 or mn > sum:
		mn = sum
	else:
		break
	i -= 1
stdout.write(str(mn))
stdout.write('\n')


totlen = []

def mykey(ele):
	return max(ele + 1, totlen[0] - ele)

def mykey2(ele):
	return max(ele, totlen[0] - ele - 1)
k = int(input())
num = list(input())
possible = []
totlen.append(len(num))
for i in range(1, totlen[0]):
	if num[i] == '0':
		continue
	possible.append(i)
possible.sort(key=mykey)
final = -1
flag = mykey(possible[0]) + 2
for i in range(0, len(possible)):
	if mykey2(possible[i]) > flag:
		break
	p = possible[i]
	num1 = int(''.join(num[0:p]))
	num2 = int(''.join(num[p:]))
	res = num1 + num2
	if final == -1 or res < final:
		final = res
print(final)


n = int(input())
s = input()
ans = 0
cnt = 0
for i in range(n // 2 + 1, n):
	if s[i] >= '1' and s[i] <= '9':
		if ans == 0:
			ans = int(s[:i]) + int(s[i:])
		else:
			ans = min(int(s[:i]) + int(s[i:]), ans)
		break
cnt = 0
for i in range(n // 2, 0, -1):
	if s[i] >= '1' and s[i] <= '9':
		if ans == 0:
			ans = int(s[:i]) + int(s[i:])
		else:
			ans = min(int(s[:i]) + int(s[i:]), ans)
		break
print(ans)


a = int(input())
n = input()
INF = 1e309
res = INF
wei = INF
for i in range(1, a):
	if n[i] != '0':
		wei = min(wei, max(i, a - i))
for i in range(1, a):
	if n[i] != '0' and max(i, a - i) <= wei:
		res = min(int(n[:i]) + int(n[i:]), res)
		wei = max(i, a - i)
print(res)


l = int(input())
n = int(input())
s = str(n)
x = l // 2
if s[x] != '0' and s[x + 1] != '0':
	a = int(s[:x])
	b = int(s[x:])
	c = int(s[:x + 1])
	d = int(s[x + 1:])
	if a + b < c + d:
		print(a + b)
	else:
		print(c + d)
elif s[x] != '0':
	a = int(s[:x])
	b = int(s[x:])
	print(a + b)
elif s[x + 1] != '0':
	c = int(s[:x + 1])
	d = int(s[x + 1:])
	print(c + d)
else:
	left = -1
	right = -1
	for i in range(x, -1, -1):
		if s[i] != '0':
			left = i
			break
	for i in range(x + 1, l):
		if s[i] != '0':
			right = i
			break
	(lefta, leftb, righta, rightb, ans) = (0, 0, 0, 0, 0)
	if right != -1:
		righta = int(s[:right])
		rightb = int(s[right:])
		ans = righta + rightb
	if left > 0:
		lefta = int(s[:left])
		leftb = int(s[left:])
		ans = min(lefta + leftb, righta + rightb)
		if righta + rightb == 0:
			ans = lefta + leftb
	print(ans)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
s = input()
(x, y) = (None, None)
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		x = int(s[:i]) + int(s[i:])
		break
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		y = int(s[:i]) + int(s[i:])
		break
if x is None:
	print(y)
elif y is None:
	print(x)
else:
	print(min(x, y))


n = int(input())
s = input()
L = n // 2
R = (n + 1) // 2
while L >= 0 and s[L] == '0':
	L -= 1
while R < n and s[R] == '0':
	R += 1
ans = int(s)
if L > 0:
	ans = min(ans, int(s[0:L]) + int(s[L:n]))
if R < n:
	ans = min(ans, int(s[0:R]) + int(s[R:n]))
print(ans)


import io
import os
import sys
from atexit import register
import math
from random import randint
DEBUG = False
STRESSTEST = False
if not DEBUG:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
sys.stdout = io.BytesIO()
register(lambda : os.write(1, sys.stdout.getvalue()))
tokens = []
tokens_next = 0

def nextStr():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	if type(tokens[tokens_next - 1]) == str:
		return tokens[tokens_next - 1]
	return tokens[tokens_next - 1].decode()

def nextInt():
	return int(nextStr())

def nextIntArr(n):
	return [nextInt() for i in range(n)]

def print(*argv, end='\n'):
	for arg in argv:
		sys.stdout.write((str(arg) + ' ').encode())
	sys.stdout.write(end.encode())

def genTestCase():
	n = randint(2, 100)
	s = [randint(0, 9) for i in range(n)]
	s = ''.join(map(str, s))
	return s

def bruteforce(s):
	res = math.inf
	for i in range(len(s)):
		if i == 0:
			continue
		if s[i] == '0':
			continue
		if int(s[:i]) + int(s[i:]) < res:
			print('# cur best ind:', i)
			res = int(s[:i]) + int(s[i:])
	return res

def doStressTest():
	while True:
		curTest = '591330927712582125010644981263148958'
		mySoln = solve(curTest)
		bruteforceSoln = bruteforce(curTest)
		if mySoln != bruteforceSoln:
			print('### Found case ###')
			print(curTest)
			print(f'{mySoln} should have been: {bruteforceSoln}')
			return

def solve(s: str):
	mid = len(s) // 2
	nonZeroIndices = filter(lambda x: s[x] != '0', range(1, len(s)))
	nonZeroIndices = list(nonZeroIndices)
	nonZeroIndices = sorted(nonZeroIndices, key=lambda x: abs(x - mid))[:6]
	res = math.inf
	for i in nonZeroIndices:
		res = min(res, int(s[:i]) + int(s[i:]))
	return res
if not DEBUG and STRESSTEST:
	raise Exception('Wrong flags!')
if STRESSTEST:
	doStressTest()
else:
	l = nextInt()
	s = nextStr()[:l]
	res = solve(s)
	print(res)
sys.stdout.flush()


l = int(input())
n = int(input())
s = str(n)
ans = n
R = l // 2 + 1
L = l // 2
while R < l and s[R] == '0':
	R += 1
if R < l and R > 0:
	tem = 10 ** (l - R)
	res = n // tem + n % tem
	if ans > res:
		ans = res
while L >= 0 and s[L] == '0':
	L -= 1
if L >= 0:
	tem = 10 ** (l - L)
	res = n // tem + n % tem
	if ans > res:
		ans = res
print(ans)


n = int(input())
s = input()
if n % 2:
	if s[n // 2] != '0':
		print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])))
	else:
		s1 = s[:n // 2]
		s2 = s[n // 2:]
		mn = int(s)
		mn1 = int(s)
		for i in range(len(s2)):
			if s2[i] != '0':
				mn = int(s1) + int(s2[i:])
				break
			s1 += s2[i]
		s1 = s[:n // 2]
		s2 = s[n // 2:][::-1]
		for i in range(len(s1) - 1, -1, -1):
			if s1[i] != '0':
				if i == 0:
					mn1 = mn
				else:
					s2 += s1[i]
					s2 = s2[::-1]
					s1 = s1[:i]
					mn1 = int(s1) + int(s2)
				break
			else:
				s2 += s1[i]
		print(min(mn, mn1))
elif s[n // 2] != '0':
	s1 = s[:n // 2]
	s2 = s[n // 2:]
	print(int(s1) + int(s2))
else:
	mn = int(s)
	mn1 = int(s)
	for i in range(n // 2, n):
		if s[i] != '0':
			s1 = s[:i]
			s2 = s[i:]
			mn = int(s1) + int(s2)
			break
	for i in range(n // 2, -1, -1):
		if s[i] != '0':
			if i != 0:
				s1 = s[:i]
				s2 = s[i:]
				mn1 = int(s1) + int(s2)
			else:
				mn1 = mn
			break
	print(min(mn, mn1))


n = int(input())
s = str(input())
ans = 10 ** (10 ** 5 + 1)
i = n // 2 + 1
while i < n and s[i] == '0':
	i += 1
if i < n:
	ans = min(ans, int(s[:i]) + int(s[i:]))
i = n // 2
while s[i] == '0':
	i -= 1
if i > 0:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


import math
import sys
import bisect

def hs(s, p):
	return int(s[:p]) + int(s[p:])
n = int(input())
s = input()
p = n // 2
if s[p] != '0':
	ans = min(hs(s, p), hs(s, p + 1))
else:
	i = j = p
	while i > 0 and s[i] == '0':
		i -= 1
	while j < n and s[j] == '0':
		j += 1
	if i == 0:
		ans = hs(s, j)
	elif j == n:
		ans = hs(s, i)
	else:
		ans = min(hs(s, i), hs(s, j))
print(ans)


import math
ant = int(input())
N = str(input())
num = int(N)
mid = int(ant / 2)
pos = int(ant / 2)
minst = num
for i in range(mid + 1, ant):
	if N[i] != '0' and N[0] != '0':
		a = int(N[:i])
		b = int(N[-ant + i:])
		sa = str(a)
		sb = str(b)
		if sa[0] != '0' and sb[0] != '0':
			if a + b < minst:
				minst = a + b
		break
for i in range(mid, 0, -1):
	if N[i] != '0' and N[i] != '0':
		a = int(N[:i])
		b = int(N[-ant + i:])
		sa = str(a)
		sb = str(b)
		if sa[0] != '0' and sb[0] != '0':
			if a + b < minst:
				minst = a + b
		break
if minst == num:
	minst = int(N[:ant - 1]) + int(N[ant - 1])
print(minst)


from sys import stdin, stdout
n = int(stdin.readline())
num = stdin.readline()
lst = []
may = n
for i in range(1, n):
	if num[i] != '0':
		may = min(may, max(i, n - i))
for i in range(1, n):
	if max(i, n - i) <= may:
		if num[i] != '0':
			lst.append(int(num[:i]) + int(num[i:]))
print(min(lst))


def IO():
	import sys
	sys.stdout = open('output.txt', 'w')
	sys.stdin = open('input.txt', 'r')

def main():
	l = int(input())
	n = str(input())
	i = l // 2 - 1
	lidx = -1
	while i >= 0:
		if n[i + 1] != '0':
			lidx = i
			break
		i -= 1
	ridx = l
	i = l // 2 + 1
	while i < l:
		if n[i] != '0':
			ridx = i
			break
		i += 1
	option1 = int()
	if lidx != -1:
		option1 = int(n[0:lidx + 1]) + int(n[lidx + 1:])
	option2 = int()
	if ridx < l:
		option2 = int(n[0:ridx]) + int(n[ridx:])
	if l == 2:
		print(int(n[0]) + int(n[1]))
	elif lidx == -1:
		print(option2)
	elif ridx == l:
		print(option1)
	else:
		print(min(option1, option2))
main()


def f(R):
	if R == 0:
		return 0
	F = 0
	S = 0
	cur = 1
	for i in range(150):
		t = min(cur, R - F - S)
		if i % 2 == 0:
			F = F + t
		else:
			S = S + t
		cur = cur * 2
		if R == F + S:
			break
	ans = F * F + S * S + S
	return ans
import math
n = int(input())
s = input()
ans = int(s)
for i in range(n // 2, n):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = min(ans, a + b)
		break
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = min(ans, a + b)
		break
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = min(ans, a + b)
		break
for i in range(n // 2 + 1, 0, -1):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		ans = min(ans, a + b)
		break
print(ans)


l = int(input())
n = input()
if l % 2 == 1:
	m = l // 2
	for i in range(0, l - m):
		variants = []
		if n[m - i] != '0':
			variants.append(int(n[:m - i]) + int(n[m - i:]))
		if n[m + i + 1] != '0':
			variants.append(int(n[:m + i + 1]) + int(n[m + i + 1:]))
		if variants:
			print(min(variants))
			exit(0)
else:
	m = l // 2
	for i in range(0, l - m):
		variants = []
		if n[m - i] != '0':
			variants.append(int(n[:m - i]) + int(n[m - i:]))
		if n[m + i] != '0':
			variants.append(int(n[:m + i]) + int(n[m + i:]))
		if variants:
			print(min(variants))
			exit(0)


def main():
	n = int(input())
	num = input()
	bsum = None
	begin = n // 2
	i = -1
	while True:
		i += 1
		if begin + i + 1 >= n:
			break
		if num[begin + i + 1] == '0':
			continue
		csum = int(num[:begin + i + 1]) + int(num[begin + i + 1:])
		if not bsum:
			bsum = csum
		else:
			bsum = min([bsum, csum])
		if i > 2:
			break
	begin = n // 2
	i = 1
	while True:
		i -= 1
		if begin + i <= 0:
			break
		if num[begin + i] == '0':
			continue
		csum = int(num[:begin + i]) + int(num[begin + i:])
		if not bsum:
			bsum = csum
		else:
			bsum = min([bsum, csum])
		if i < -2:
			break
	print(bsum)
main()


def add(num1, num2):
	num1 = num1[::-1]
	num2 = num2[::-1]
	result = ''
	i = 0
	j = 0
	a_len = len(num1)
	b_len = len(num2)
	carry = 0
	while i < a_len or j < b_len:
		A = 0
		B = 0
		if i < a_len:
			A = num1[i]
		if j < b_len:
			B = num2[j]
		s = int(A) + int(B) + carry
		result = result + str(s % 10)
		carry = s // 10
		i = i + 1
		j = j + 1
	if carry > 0:
		result = result + str(carry)
	return result[::-1]
N = int(input())
number = input()
minimum = 9999999
for i in range(1, N):
	if number[i] != '0':
		if max(N - i, i) < minimum:
			minimum = max(N - i, i)
mini_len = 99999999
ans = []
for i in range(1, N):
	if number[i] != '0':
		if max(N - i, i) == minimum:
			res = add(number[:i], number[i:])
			if len(res) < mini_len:
				mini_len = len(res)
			ans.append(res)
answer = []
for num in ans:
	if len(num) == mini_len:
		answer.append(num)
print(sorted(answer)[0])


import collections, heapq, math, sys
n = int(sys.stdin.readline().rstrip())
nums = sys.stdin.readline().rstrip()
mid = n / 2
for i in range(int(mid) + 1):
	left = int(mid - i)
	right = int(math.ceil(mid + i))
	candidate = float('inf')
	if left >= 0 and nums[left] != '0':
		candidate = int(nums[:left]) + int(nums[left:])
	if right < n and nums[right] != '0':
		if candidate > int(nums[:right]) + int(nums[right:]):
			candidate = int(nums[:right]) + int(nums[right:])
	if candidate < float('inf'):
		print(candidate)
		sys.exit()


l = int(input())
n = input()

def goleft(s):
	mid = l // 2
	while s[mid] == '0':
		mid -= 1
	if mid == 0:
		return int(n) * 10
	return sumof2(s[:mid], s[mid:])

def goright(s):
	mid = l // 2 + 1
	while s[mid] == '0':
		if mid == len(s) - 1:
			return int(n) * 10
		mid += 1
	return sumof2(s[:mid], s[mid:])

def sumof2(s1, s2):
	s1 = int(s1)
	s2 = int(s2)
	return s1 + s2
if l == 2:
	print(sumof2(n[0], n[1]))
else:
	print(min(goleft(n), goright(n)))


n = int(input())
st = input()
kq = -1
mid = int(n / 2)
l = mid
r = mid
for i in range(mid, 0, -1):
	if st[i] != '0':
		l = i
		break
for i in range(mid, n, 1):
	if st[i] != '0':
		r = i
		break
l = max(l - 5, 1)
r = min(r + 5, n)
for i in range(l, r, 1):
	if st[i] != '0':
		if kq == -1:
			kq = int(st[i:]) + int(st[0:i])
		else:
			kq = min(kq, int(st[i:]) + int(st[0:i]))
print(kq)


n = int(input())
string = input()
if n % 2 == 0:
	right = n // 2
else:
	right = n // 2 + 1
left = right - 1
while left > 0 and string[left] == '0':
	left -= 1
while right < n and string[right] == '0':
	right += 1
if left != 0 and right < n:
	ans1 = int(string[:right]) + int(string[right:])
	ans2 = int(string[:left]) + int(string[left:])
	ans = min(ans1, ans2)
elif left == 0:
	ans = int(string[:right]) + int(string[right:])
else:
	ans = int(string[:left]) + int(string[left:])
print(ans)


l = int(input())
n = input()
if l == 2:
	print(int(n[0]) + int(n[1]))
	exit()
m = l // 2
i = 1
while not int(n[m]) + int(n[m - i]) + int(n[m + i]):
	i += 1
potentials = []
if n[:m - i] and n[m - i:] and (not n[m - i:].startswith('0')):
	potentials.append(int(n[:m - i]) + int(n[m - i:]))
if n[:m] and n[m:] and (not n[m:].startswith('0')):
	potentials.append(int(n[:m]) + int(n[m:]))
if n[:m + i] and n[m + i:] and (not n[m + i:].startswith('0')):
	potentials.append(int(n[:m + i]) + int(n[m + i:]))
print(min(potentials))


n = int(input())
s = input()
ans = int(s)
mid = n // 2
while s[mid] == '0' and mid > 0:
	mid -= 1
if mid != 0:
	ans = min(ans, int(s[:mid]) + int(s[mid:]))
elif s[1] != '0':
	ans = min(ans, int(s[0]) + int(s[1:]))
mid = n // 2 + 1
while s[mid] == '0' and mid < n - 1:
	mid += 1
if s[mid] != '0':
	ans = min(ans, int(s[:mid]) + int(s[mid:]))
print(ans)


l = int(input())
num = input()
smallest = 1000000
points = []
for (i, c) in enumerate(num):
	if i == 0:
		continue
	if c != '0':
		if max(i, l - i) < smallest:
			smallest = max(i, l - i)
			points.clear()
		if max(i, l - i) == smallest:
			points.append(i)
ans = int('9' * 100000)
for val in points:
	ans = min(ans, int(num[:val]) + int(num[val:]))
print(ans)


n = int(input())
x = input()
vpos = []
mpos = n + 1
for i in range(1, n):
	if x[i] != '0':
		if mpos > max(i, n - i):
			mpos = max(i, n - i)
			vpos = []
		if mpos == max(i, n - i):
			vpos.append(i)

def f(a, i):
	return int(a[i:]) + int(a[:i])
if len(vpos) == 1:
	print(f(x, vpos[0]))
else:
	print(min(f(x, vpos[0]), f(x, vpos[1])))


def ssum(s, spl):
	l = s[:spl]
	r = s[spl:]
	p = 0
	ret = ''
	carry = 0
	while p < len(l) or p < len(r):
		dl = int(l[-p - 1]) if p < len(l) else 0
		dr = int(r[-p - 1]) if p < len(r) else 0
		tmp = carry + int(dl) + int(dr)
		if tmp > 9:
			tmp -= 10
			carry = 1
		else:
			carry = 0
		ret = str(tmp) + ret
		p += 1
	if carry == 1:
		ret = str(carry) + ret
	return ret

def smin(s1, s2):
	if len(s1) < len(s2):
		return s1
	if len(s2) < len(s1):
		return s2
	for i in range(len(s1)):
		if s1[i] < s2[i]:
			return s1
		if s2[i] < s1[i]:
			return s2
	return s1

def sol(s):
	if len(s) % 2 == 0:
		(l, r) = (len(s) // 2, len(s) // 2)
	else:
		(l, r) = (len(s) // 2, len(s) // 2 + 1)
	while True:
		if s[l] == '0' and s[r] == '0':
			l -= 1
			r += 1
			continue
		if s[l] == '0':
			return ssum(s, r)
		if s[r] == '0':
			return ssum(s, l)
		return smin(ssum(s, l), ssum(s, r))
_ = input()
s = input()
print(sol(s))


l = int(input())
n = input()
mid = l // 2
if l % 2 == 0 and n[mid] != '0':
	print(int(n[:mid]) + int(n[mid:]))
else:
	ans = -1
	pos = mid
	while pos > 0 and n[pos] == '0':
		pos -= 1
	if pos != 0:
		ans = int(n[:pos]) + int(n[pos:])
	pos = mid + 1
	while pos < l and n[pos] == '0':
		pos += 1
	if pos < l:
		if ans == -1:
			ans = int(n[:pos]) + int(n[pos:])
		else:
			ans = min(ans, int(n[:pos]) + int(n[pos:]))
	print(ans)


def suu(a, b):
	a = int(a)
	b = int(b)
	return a + b

def go():
	l = int(input())
	s = str(input())
	mid = l // 2
	pos = l - 1
	while 1:
		if s[pos] == '0':
			pos -= 1
		else:
			break
	if pos < mid:
		print(suu(s[:pos], s[pos:]))
		return
	if s[mid] == '0':
		pos = mid
		while s[pos] == '0':
			pos += 1
		pos2 = mid
		while s[pos2] == '0':
			pos2 -= 1
		if pos2 == 0:
			print(suu(s[:pos], s[pos:]))
		elif pos >= l:
			print(suu(s[:pos2], s[pos2:]))
		else:
			print(min(suu(s[:pos], s[pos:]), suu(s[:pos2], s[pos2:])))
		return
	if mid < l - 1 and s[mid + 1] != '0' and (suu(s[:mid], s[mid:]) > suu(s[:mid + 1], s[mid + 1:])):
		mid += 1
	print(suu(s[:mid], s[mid:]))
go()


n = int(input())
l = input()
m = n // 2
flag = True
s = int(l)
for i in [-1, 0, 1]:
	m1 = m
	m1 += i
	if len(l[m1:]) and len(l[:m1]):
		if l[m1:][0] != '0':
			s = min(s, int(l[:m1]) + int(l[m1:]))
for i in range(m, len(l)):
	if l[i] != '0':
		if len(l[i:]) and len(l[:i]):
			s = min(s, int(l[:i]) + int(l[i:]))
			flag = False
			break
for i in range(m, -1, -1):
	if l[i] != '0':
		if len(l[i:]) and len(l[:i]):
			s = min(s, int(l[:i]) + int(l[i:]))
			flag = False
			break
print(s)


l = int(input())
n = list(input())
ans = int(''.join(n))
if l == 1:
	print(ans)
	exit(0)
f = 0
for i in range(l // 2, 0, -1):
	if n[i] != '0':
		ans = min(ans, int(''.join(n[:i])) + int(''.join(n[i:])))
		f = 1
	if n[l - i] != '0':
		ans = min(ans, int(''.join(n[:l - i])) + int(''.join(n[l - i:])))
		f = 1
	if f == 1:
		print(ans)
		exit(0)
print(ans)


n = int(input())
a = input()
m = int(a)
P = 10 ** (n // 2 + 1)
p = P
A = int(a[:n // 2])
B = int(a[n // 2:])
kek = a[n // 2:]
if kek[0] != '0':
	m = min(m, A + B)
C = A
D = B
if n % 2 == 0:
	P //= 10
k = 0
for i in range(n // 2, n):
	if a[i] != '0':
		m = min(int(a[:i]) + int(a[i:]), m)
		break
for i in range(n // 2 - 1, 0, -1):
	if a[i] != '0':
		m = min(int(a[:i]) + int(a[i:]), m)
		break
for i in range(n // 2, n - 1):
	if k > 5:
		break
	A *= 10
	A += int(a[i])
	P //= 10
	B %= P
	k += 1
	if A + B >= m:
		break
	if a[i + 1] == '0':
		continue
	m = A + B
A = C
B = D
P = p // 10
if n % 2 == 0:
	P //= 10
for i in range(n // 2 - 1, 0, -1):
	if k > 10:
		break
	P *= 10
	B += int(a[i]) * P
	A //= 10
	k += 1
	if A + B >= m:
		break
	if a[i] == '0':
		continue
	m = A + B
print(m)


n = int(input())
s = input()
ans = int(s)
p1 = n // 2
p2 = p1 + 1
while p1 >= 0 and s[p1] == '0':
	p1 -= 1
while p2 < n and s[p2] == '0':
	p2 += 1
ans = int(s)
if p1 > 0 and s[p1] != '0':
	ans = min(ans, int(s[0:p1]) + int(s[p1:n]))
if p2 < n and s[p2] != '0':
	ans = min(ans, int(s[0:p2]) + int(s[p2:n]))
print(ans)


n = int(input())
s = input()
a = int(s)
s = list(s)
tt = 10 ** max(0, n // 2 - 2)
ans = a
for i in range(max(0, n // 2 - 2), min(n, n // 2 + 3)):
	a1 = a // tt
	a2 = a % tt
	if a2 * 10 // tt > 0:
		ans = min(ans, a1 + a2)
	tt *= 10
s.reverse()
if ans == a:
	i = n // 2
	while i <= len(s) and s[i - 1] == '0':
		i += 1
	tt = 10 ** i
	a1 = a // tt
	a2 = a % tt
	if a2 * 10 // tt > 0:
		ans = min(ans, a1 + a2)
	i = n // 2
	while i > 0 and s[i - 1] == '0':
		i -= 1
	tt = 10 ** i
	a1 = a // tt
	a2 = a % tt
	if a2 * 10 // tt > 0:
		ans = min(ans, a1 + a2)
print(int(ans))


import sys
input = sys.stdin.readline
n = int(input())
s = input().strip()
p = 0
for i in range(n):
	if s[i] == 0:
		p += 1
	else:
		break
s = s[p:]
n = len(s)
m = n // 2
while m < n - 1 and s[m] == '0':
	m += 1
if m == n // 2:
	if n & 1:
		a = int(s[m:]) + int(s[:m])
		b = int(s[m + 1:]) + int(s[:m + 1])
		print(min(a, b))
	elif m == 1:
		print(int(s[0]) + int(s[1]))
	else:
		a = int(s[:m]) + int(s[m:])
		b = int(s[:m + 1]) + int(s[m + 1:])
		c = int(s[:m - 1]) + int(s[m - 1:])
		print(min(a, b, c))
else:
	if m == n - 1 and s[m] == '0':
		a = int(s)
	else:
		a = int(s[:m]) + int(s[m:])
	m = n // 2
	while m > 0 and s[m] == '0':
		m -= 1
	if m == 0:
		b = int(s)
	else:
		b = int(s[:m]) + int(s[m:])
	print(min(a, b))


l = int(input())
s = input()
v = int(s)
i = len(s) // 2
if len(s) % 2 == 0 and s[i] != '0':
	v = int(s[0:i]) + int(s[i:])
elif len(s) % 2 == 1 and s[i] != '0' and (s[i - 1] != '0') and (s[i + 1] != '0'):
	v = int(s[0:i]) + int(s[i:])
	v = min(v, int(s[0:i + 1]) + int(s[i + 1:]))
else:
	while i > 0:
		if s[i] != '0':
			v = min(v, int(s[0:i]) + int(s[i:]))
		if s[i] != '0' and s[i + 1] == '0':
			break
		i -= 1
	i = len(s) // 2
	while i < len(s):
		if s[i] != '0':
			v = min(v, int(s[0:i]) + int(s[i:]))
		if s[i] != '0' and s[i - 1] == '0':
			break
		i += 1
print(v)


L = int(input())
n = str(input())

def breakleft(n, split):
	for i in range(split):
		if n[split - i] != '0':
			return int(n[:split - i]) + int(n[split - i:])
	return int(n)

def breakright(n, split):
	global L
	for i in range(L - split):
		if n[split + i] != '0':
			return int(n[:split + i]) + int(n[split + i:])
	return int(n)
half = L // 2
r = L % 2
if r == 0:
	print(min(breakleft(n, half), breakright(n, half)))
else:
	print(min(breakleft(n, half + 1), breakright(n, half)))


from math import *

def print_(x):
	for i in x:
		print(i, end='')
	print()
n = int(input())
a = input()

def check(x):
	left = a[:x]
	right = a[x:]
	left = left[::-1]
	right = right[::-1]
	s = []
	i = 0
	j = 0
	ts = 0
	tc = 0
	while i < len(left) and j < len(right):
		ts = int(left[i]) + int(right[j]) + tc
		tc = 0
		if ts >= 10:
			tc = ts // 10
			ts = ts % 10
		s.append(str(ts))
		i += 1
		j += 1
	while i < len(left):
		ts = int(left[i]) + tc
		tc = 0
		if ts >= 10:
			tc = ts // 10
			ts = ts % 10
		s.append(str(ts))
		i += 1
	while j < len(right):
		ts = int(right[j]) + tc
		tc = 0
		if ts >= 10:
			tc = ts // 10
			ts = ts % 10
		s.append(str(ts))
		j += 1
	if tc > 0:
		s.append(str(tc))
	return s[::-1]
if n & 1:
	j = n // 2
	i = j + 1
	while i < n and a[i] == '0':
		i += 1
	while j >= 0 and a[j] == '0':
		j -= 1
	ans2 = check(j)
	ans = check(i)
	if len(ans) < len(ans2):
		print_(ans)
	elif len(ans) > len(ans2):
		print_(ans2)
	else:
		print_(min(ans2, ans))
else:
	i = n // 2
	j = i
	while i < n and a[i] == '0':
		i += 1
	while j >= 0 and a[j] == '0':
		j -= 1
	ans2 = check(j)
	ans = check(i)
	if len(ans) < len(ans2):
		print_(ans)
	elif len(ans) > len(ans2):
		print_(ans2)
	else:
		print_(min(ans2, ans))


import string
l = int(input())
s = input()
n = int(len(s))
ans = int(s)
p = (l - 1) // 2
for i in range(p, -1, -1):
	if s[i + 1] == '0':
		continue
	t1 = int(s[0:i + 1])
	t2 = int(s[i + 1:])
	ans = min(ans, t1 + t2)
	break
p = l // 2
for i in range(p, l):
	if s[i] == '0':
		continue
	t1 = int(s[0:i])
	t2 = int(s[i:])
	ans = min(ans, t1 + t2)
	break
print(ans)


def spt(s, lLen):
	a = int(n[0:lLen])
	b = int(n[lLen:])
	return a + b
l = int(input())
n = input()
half = l // 2
for lLen in range(half, l):
	temp1 = -1
	temp2 = -1
	if n[lLen] != '0':
		temp1 = spt(n, lLen)
	if n[l - lLen] != '0':
		temp2 = spt(n, l - lLen)
	if temp1 != -1 and temp2 != -1:
		ans = min(temp1, temp2)
		print(ans)
		exit(0)
	if temp1 != -1:
		ans = temp1
		print(ans)
		exit(0)
	if temp2 != -1:
		ans = temp2
		print(ans)
		exit(0)


l = int(input())
n = input()
ans = float('inf')
if l < 20:
	for i in range(1, l):
		x = int(n[:i])
		y = n[i:]
		if y[0] != '0':
			ans = min(ans, x + int(y))
else:
	s = list(n)
	ind = []
	cur = l
	for i in range(1, l):
		if s[i] != '0':
			num = float('inf')
			if abs(l - i - i) <= 1:
				num = max(l - i, i) + 1
			else:
				num = max(l - i, i)
			if num < cur:
				cur = num
	for i in range(1, l):
		if s[i] != '0':
			num = float('inf')
			if abs(l - i - i) <= 1:
				num = max(l - i, i) + 1
			else:
				num = max(l - i, i)
			if num == cur:
				ind.append(i)
	for i in ind:
		(x, y) = (int(n[:i]), int(n[i:]))
		ans = min(ans, x + y)
print(ans)


n = int(input())
a = input()
l = (n - 1) // 2
r = n // 2
while a[l] == '0' and a[r] == '0':
	l -= 1
	r += 1
ans = -1
if a[l] != '0' and l > 0:
	x = int(a[0:l])
	y = int(a[l:len(a)])
	if ans == -1 or ans > x + y:
		ans = x + y
if a[r] != '0':
	x = int(a[0:r])
	y = int(a[r:len(a)])
	if ans == -1 or ans > x + y:
		ans = x + y
l -= 1
r += 1
if l > 0 and a[l] != '0':
	x = int(a[0:l])
	y = int(a[l:len(a)])
	if ans == -1 or ans > x + y:
		ans = x + y
if r < len(a) and a[r] != '0':
	x = int(a[0:r])
	y = int(a[r:len(a)])
	if ans == -1 or ans > x + y:
		ans = x + y
print(ans)


import cmath
l = int(input())
n = input()
result = cmath.inf
arr = []
for i in range(1, l):
	if n[i] == '0':
		continue
	else:
		arr.append(i)
arr.sort(key=lambda x: abs(l // 2 - x))
for i in arr[:10]:
	result = min(result, int(''.join(n[:i])) + int(''.join(n[i:])))
print(result)


n = int(input())
s = input()
l = n // 2
r = (n + 1) // 2
while s[l] == '0':
	l -= 1
while r < n and s[r] == '0':
	r += 1
mx = int(s)
if l > 0:
	mx = min(mx, int(s[:l]) + int(s[l:]))
if r < n:
	mx = min(mx, int(s[:r]) + int(s[r:]))
print(mx)


n = int(input())
a = input()
ans = int(a)
middle = n // 2
for i in range(middle + 1, n):
	if a[i] != '0':
		ans = min(ans, int(a[:i]) + int(a[i:]))
		break
for i in range(middle, 0, -1):
	if a[i] != '0':
		ans = min(ans, int(a[:i]) + int(a[i:]))
		break
print(ans)


n = int(input())
s = input()
mini = 1000000000
for i in range(1, n):
	if s[i] != '0':
		mini = min(mini, max(i, n - i) + 1)
res = 0
for i in range(1, n):
	if s[i] != '0' and max(i, n - i) + 1 == mini:
		d = int(s[0:i]) + int(s[i:n])
		if res == 0 or res > d:
			res = d
print(res)


import sys

class BSplitANumber:

	def __init__(self):
		self.t = 0

	def solve(self):
		l = int(input())
		n = input()
		s = (l - 1) // 2
		lo = s
		hi = s + 1
		while lo >= 0 and n[lo] == '0':
			lo -= 1
		while hi < l and n[hi] == '0':
			hi += 1
		(a, b) = (float('inf'), float('inf'))
		if lo != 0:
			a = eval(n[:lo] + '+' + n[lo:])
		if hi != l:
			b = eval(n[:hi] + '+' + n[hi:])
		print(min(a, b))
solver = BSplitANumber()
input = sys.stdin.readline
solver.solve()


l = input()
n = input()
l = int(l)
k = int(n)
if l == 1:
	print(n)
elif l == 2 and k % 10 == 0:
	print(int(n[0]) + int(n[1]))
else:
	mid = int(l / 2)
	p = mid
	x = mid
	while p < l:
		if n[p] == '0':
			p = p + 1
		else:
			break
	while x >= 0:
		if n[x] == '0':
			x = x - 1
		else:
			break
	if l % 2 == 0:
		if p < l:
			s1 = n[:p]
			s2 = n[p:]
			if x != 0:
				s3 = n[:x]
				s4 = n[x:]
				if int(s1) + int(s2) > int(s3) + int(s4):
					print(int(s3) + int(s4))
				else:
					print(int(s1) + int(s2))
			else:
				print(int(s1) + int(s2))
		else:
			s3 = n[:x]
			s4 = n[x:]
			print(int(s3) + int(s4))
	elif n[mid] == '0':
		if p < l:
			s1 = n[:p]
			s2 = n[p:]
			if x != 0:
				s3 = n[:x]
				s4 = n[x:]
				if int(s1) + int(s2) > int(s3) + int(s4):
					print(int(s3) + int(s4))
				else:
					print(int(s1) + int(s2))
			else:
				print(int(s1) + int(s2))
		else:
			s3 = n[:x]
			s4 = n[x:]
			print(int(s3) + int(s4))
	else:
		s1 = n[:p]
		s2 = n[p:]
		s3 = n[:p + 1]
		s4 = n[p + 1:]
		if int(s1) + int(s2) > int(s3) + int(s4):
			print(int(s3) + int(s4))
		else:
			print(int(s1) + int(s2))


n = int(input())
str = input()
ans = ''
for i in range(len(str)):
	ans += '9'
ans = int(ans)

def check(str, pos):
	global ans
	if pos <= 0:
		return
	if str[pos] == '0':
		while str[pos] == '0':
			pos -= 1
		if pos > 0:
			ans = min(ans, int(str[:pos]) + int(str[pos:]))
		pos += 1
		while pos != len(str) and str[pos] == '0':
			pos += 1
		if pos > 0 and pos != len(str):
			ans = min(ans, int(str[:pos]) + int(str[pos:]))
	else:
		ans = min(ans, int(str[:pos]) + int(str[pos:]))
check(str, (n + 1) // 2)
check(str, (n - 1) // 2)
print(ans)


l = int(input())
inp = input()
inp1 = list(inp)
mid = l // 2
toLeft = 0
toRight = l
if l % 2 != 0:
	if inp[mid] != '0':
		opt1 = int(inp[:mid + 1])
		opt2 = int(inp[mid:])
		if opt1 < opt2:
			ans = opt1 + int(inp[mid + 1:])
		else:
			ans = opt2 + int(inp[:mid])
	else:
		i = mid - 1
		while i >= 0:
			if inp[i] != '0':
				toLeft = i
				break
			i -= 1
		i = mid + 1
		while i < l:
			if inp[i] != '0':
				toRight = i
				break
			i += 1
		if toLeft == 0 and toRight == l:
			ans = int(inp)
		elif toRight == l:
			ans = int(inp[:toLeft]) + int(inp[toLeft:])
		elif toLeft == 0:
			ans = int(inp[:toRight]) + int(inp[toRight:])
		else:
			opt1 = int(inp[:toLeft]) + int(inp[toLeft:])
			opt2 = int(inp[:toRight]) + int(inp[toRight:])
			if opt1 < opt2:
				ans = opt1
			else:
				ans = opt2
elif inp[mid] != '0':
	ans = int(inp[:mid]) + int(inp[mid:])
else:
	i = mid - 1
	while i >= 0:
		if inp[i] != '0':
			toLeft = i
			break
		i -= 1
	i = mid + 1
	while i < l:
		if inp[i] != '0':
			toRight = i
			break
		i += 1
	if toLeft == 0 and toRight == l:
		ans = int(inp)
	elif toRight == l:
		ans = int(inp[:toLeft]) + int(inp[toLeft:])
	elif toLeft == 0:
		ans = int(inp[:toRight]) + int(inp[toRight:])
	else:
		opt1 = int(inp[:toLeft]) + int(inp[toLeft:])
		opt2 = int(inp[:toRight]) + int(inp[toRight:])
		if opt1 < opt2:
			ans = opt1
		else:
			ans = opt2
print(ans)


n = int(input())
s = input()
a = ''
b = ''
ans = 0
l = r = n // 2
while r < len(s) and s[r] == '0':
	r = r + 1
while l >= 0 and s[l] == '0':
	l = l - 1
if l > 0:
	a = s[:l]
	b = s[l:]
	if ans == 0:
		ans = int(a) + int(b)
	else:
		ans = min(ans, int(a) + int(b))
if r < len(s):
	a = s[:r]
	b = s[r:]
	if ans == 0:
		ans = int(a) + int(b)
	else:
		ans = min(ans, int(a) + int(b))
if l == r and l + 1 != len(s):
	a = s[:l + 1]
	b = s[l + 1:]
	ans = min(ans, int(a) + int(b))
print(ans)


ln = int(input())
n = input()
nmb = int(n)
s = '0'
l1 = 0
l2 = 0
i = int(ln / 2)
while i >= 0:
	if n[i] != s:
		l1 = i
		break
	i = i - 1
i = int(ln / 2)
while i < ln:
	if n[i] != s:
		l2 = i
		break
	i = i + 1
if l2 == 0:
	l2 = ln
if l1 == l2:
	l2 = ln - l1
nmbl1a = n[:l1]
nmbl1b = n[l1:]
nmbl2a = n[:l2]
nmbl2b = n[l2:]
if l1 == 0:
	nmbl1a = '0'
if l2 == ln:
	nmbl2b = '0'
nmb1 = int(nmbl1a) + int(nmbl1b)
nmb2 = int(nmbl2a) + int(nmbl2b)
if nmb1 > nmb2:
	print(nmb2)
else:
	print(nmb1)


l = int(input())
n = input()
ans = int(n)
x = l // 2 + 1
while x < l and n[x] == '0':
	x += 1
if x < l and n[x] != '0':
	ans = min(int(n[x:]) + int(n[:x]), ans)
x = l // 2
while x and n[x] == '0':
	x -= 1
if x and n[x] != '0':
	ans = min(int(n[x:]) + int(n[:x]), ans)
print(ans)


def solve():
	l = int(input())
	num = input()
	h = l // 2
	if num[h] == '0':
		j = h
		while j < l and num[j] == '0':
			j += 1
		if j == l:
			ans = int(num)
		else:
			ans = int(num[:j]) + int(num[j:])
		j = h
		while j > 0 and num[j] == '0':
			j -= 1
		if j == 0:
			cur = int(num)
		else:
			cur = int(num[:j]) + int(num[j:])
		if cur < ans:
			ans = cur
	else:
		ans = int(num[:h]) + int(num[h:])
		if h - 1 > 0 and num[h - 1] != '0':
			ans2 = int(num[:h - 1]) + int(num[h - 1:])
			if ans2 < ans:
				ans = ans2
		if h + 1 < l and num[h + 1] != '0':
			ans2 = int(num[:h + 1]) + int(num[h + 1:])
			if ans2 < ans:
				ans = ans2
	print(ans)
solve()


n = int(input())
s = input()
poz = []
if n < 100:
	for i in range(1, n):
		if s[i] != '0':
			poz.append(i)
else:
	pol = n // 2
	(a, b) = (pol - 1, pol)
	while a > 0 and s[a] == '0':
		a -= 1
	if a > 0 and s[a] != '0':
		poz.append(a)
		while a > 0 and s[a] == '0':
			a -= 1
		if a > 0 and s[a] != '0':
			poz.append(a)
	while b < n and s[b] == '0':
		b += 1
	if b < n and s[b] != '0':
		poz.append(b)
		while b < n and s[b] == '0':
			b += 1
		if b < n and s[b] != '0':
			poz.append(b)
res = -1
for i in poz:
	l = int(s[:i])
	p = int(s[i:])
	sum = l + p
	if res == -1 or sum < res:
		res = sum
print(res)


n = int(input())
s = input().strip()
k1 = n // 2 + 1
k2 = n // 2
while k1 < n - 1 and s[k1] == '0':
	k1 += 1
while k2 > 0 and s[k2] == '0':
	k2 -= 1
if k1 == n or s[k1:n] == '0':
	print(int(s[0:k2]) + int(s[k2:n]))
elif k2 == 0 or s[0:k2] == '0':
	print(int(s[0:k1]) + int(s[k1:n]))
else:
	print(min(int(s[0:k1]) + int(s[k1:n]), int(s[0:k2]) + int(s[k2:n])))


l = int(input())
n = input()
r = float('inf')
half = l // 2
if n[half] != '0':
	(a, b) = (n[:half], n[half:])
	r = min(r, int(a) + int(b))
for i in range(half + 1, l):
	if n[i] != '0':
		(a, b) = (n[:i], n[i:])
		r = min(r, int(a) + int(b))
		break
for i in range(half - 1, 0, -1):
	if n[i] != '0':
		(a, b) = (n[:i], n[i:])
		r = min(r, int(a) + int(b))
		break
print(r)


l = int(input())
l1 = input()
j = (l + 1) // 2
i = j - 1
while i > 0 and l1[i] == '0':
	i = i - 1
while j < l and l1[j] == '0':
	j = j + 1
ans = int(l1)
if i > 0:
	ans = min(ans, int(l1[0:i]) + int(l1[i:]))
if j < l:
	ans = min(ans, int(l1[0:j]) + int(l1[j:]))
print(ans)


m = int(input())
n = input()
l = m // 2
while l > 0 and n[l] == '0':
	l -= 1
r = m // 2 + 1
while r < m and n[r] == '0':
	r += 1
a = None
if r < m:
	a = int(n[:r]) + int(n[r:])
b = None
if l > 0:
	b = int(n[:l]) + int(n[l:])
if a and b:
	print(min(a, b))
else:
	print(a or b)


l = int(input())
n = input()
if l % 2 == 0:
	left = l // 2
	right = l // 2
	while left >= 1 and n[left] == '0':
		left -= 1
	while right < l and n[right] == '0':
		right += 1
	if left == 0:
		print(int(n[:right]) + int(n[right:]))
	elif right == l:
		print(int(n[:left]) + int(n[left:]))
	else:
		print(min([int(n[:right]) + int(n[right:]), int(n[:left]) + int(n[left:])]))
else:
	left = l // 2
	right = l // 2
	res1 = 0
	res2 = 0
	while left >= 1 and n[left] == '0':
		left -= 1
	while right < l and n[right] == '0':
		right += 1
	if left == 0:
		res1 = int(n[:right]) + int(n[right:])
	elif right == l:
		res1 = int(n[:left]) + int(n[left:])
	else:
		res1 = min([int(n[:right]) + int(n[right:]), int(n[:left]) + int(n[left:])])
	left = l // 2 + 1
	right = l // 2 + 1
	res2 = 0
	while left >= 1 and n[left] == '0':
		left -= 1
	while right < l and n[right] == '0':
		right += 1
	if left == 0:
		res2 = int(n[:right]) + int(n[right:])
	elif right == l:
		res2 = int(n[:left]) + int(n[left:])
	else:
		res2 = min([int(n[:right]) + int(n[right:]), int(n[:left]) + int(n[left:])])
	print(min([res1, res2]))


n = int(input())
s = input()
if n % 2:
	mid = n // 2
	if s[mid] != '0':
		if int(s[:mid + 1]) < int(s[mid:]):
			print(int(s[:mid + 1]) + int(s[mid + 1:]))
		else:
			print(int(s[:mid]) + int(s[mid:]))
		exit(0)
else:
	mid = n // 2
	if s[mid] != '0':
		print(int(s[:mid]) + int(s[mid:]))
		exit(0)
candidates = []
i = mid
while i < n and s[i] == '0':
	i += 1
if i < n:
	candidates.append(int(s[:i]) + int(s[i:]))
i = mid
while i >= 0 and s[i] == '0':
	i -= 1
if i > 0:
	candidates.append(int(s[:i]) + int(s[i:]))
print(min(candidates))


d = int(input())
num = input()
mid = d // 2
s1 = 0
s2 = 0
left = mid
right = mid
if num[mid] == '0':
	if int(num[mid:]) != 0:
		while num[left] == '0':
			left -= 1
		while num[right] == '0' and right != d - 1:
			right += 1
		try:
			s1 = int(num[:left]) + int(num[left:])
		except ValueError:
			s1 = int(num)
		s2 = int(num[:right]) + int(num[right:])
		if s1 < s2:
			print(s1)
		else:
			print(s2)
	else:
		while num[left] == '0':
			left -= 1
		print(int(num[:left]) + int(num[left:]))
if num[mid] != '0':
	if d % 2 == 0:
		print(int(num[:mid]) + int(num[mid:]))
	else:
		s1 = int(num[:mid]) + int(num[mid:])
		if num[mid + 1] != '0':
			s2 = int(num[:mid + 1]) + int(num[mid + 1:])
		else:
			s2 = s1 + 1
		if s1 < s2:
			print(s1)
		else:
			print(s2)


import sys
input = sys.stdin.readline
n = int(input())
x = input()
xx = int(x)
if n == 2:
	print(int(x[0]) + int(x[1]))
	exit(0)
li = n // 2
ri = n // 2 + 1
if n % 2 == 0 and x[n // 2] != '0':
	print(int(x[:n // 2]) + int(x[n // 2:]))
	exit(0)
if n % 2 == 0:
	li = n // 2 - 1
while True:
	ans1 = ans2 = xx
	if x[li] != '0':
		ans1 = int(x[:li]) + int(x[li:])
	if x[ri] != '0':
		ans2 = int(x[:ri]) + int(x[ri:])
	if ans1 < xx or ans2 < xx:
		print(min(ans1, ans2))
		exit(0)
	else:
		li = max(1, li - 1)
		ri = min(n - 1, ri + 1)


n = int(input())
t = n // 2
s = input()
while s[t] == '0':
	t -= 1
k = n // 2 + 1
while k < len(s) and s[k] == '0':
	k += 1
ans1 = -1
ans2 = -1
if t > 0:
	ans1 = int(s[:t]) + int(s[t:])
if k < len(s):
	ans2 = int(s[:k]) + int(s[k:])
if ans1 == -1:
	print(ans2)
elif ans2 == -1:
	print(ans1)
else:
	print(min(ans1, ans2))


n = int(input())
a = input()
left = []
right = []
t = ''
c = 0
idex = n // 2
if n % 2 == 0:
	if a[idex] == '0':
		while idex < n and a[idex] == '0':
			idex += 1
		if idex == n:
			left = int(a)
		else:
			left = int(a[:idex]) + int(a[idex:])
		idex = n // 2
		while idex < n and a[idex] == '0':
			idex -= 1
		right = int(a[:idex]) + int(a[idex:])
		print(min(left, right))
	else:
		print(int(a[:idex]) + int(a[idex:]))
elif a[idex] != '0' and a[idex + 1] != '0':
	print(min(int(a[:idex]) + int(a[idex:]), int(a[:idex + 1]) + int(a[idex + 1:])))
else:
	while idex < n and a[idex] == '0':
		idex += 1
	if idex == n:
		left = int(a)
	else:
		left = int(a[:idex]) + int(a[idex:])
	idex = n // 2
	while a[idex] == '0':
		idex -= 1
	if idex == 0:
		right = int(a)
	else:
		right = int(a[:idex]) + int(a[idex:])
	s1 = min(left, right)
	idex = n // 2 + 1
	while idex < n and a[idex] == '0':
		idex += 1
	if idex == n:
		left = int(a)
	else:
		left = int(a[:idex]) + int(a[idex:])
	idex = n // 2
	while idex < n and a[idex] == '0':
		idex -= 1
	if idex == 0:
		right = int(a)
	else:
		right = int(a[:idex]) + int(a[idex:])
	s2 = min(left, right)
	print(min(s1, s2))


l = int(input())
n = input()
result = int(n)
for (k, i) in ((1, len(n) // 2), (-1, (len(n) + 1) // 2)):
	while 0 < i < len(n) and n[i] == '0':
		i += k
	if 0 < i < len(n):
		result = min(result, int(n[:i]) + int(n[i:]))
print(result)


n = int(input())
s = input()
k = n / 2
r = int(k)
while r < n and s[r] == '0':
	r = r + 1
l = int(k - 1)
while l >= 0 and s[l] == '0':
	l = l - 1
mn = -1
if l != 0:
	mn = int(s[:l]) + int(s[l:])
else:
	mn = int(s)
if r != n and mn > int(s[:r]) + int(s[r:]):
	mn = int(s[:r]) + int(s[r:])
elif mn > int(s):
	mn = int(s)
if n % 2 == 0:
	print(mn)
else:
	k = (n + 1) / 2
	r = int(k)
	while r < n and s[r] == '0':
		r = r + 1
	l = int(k - 1)
	while l >= 0 and s[l] == '0':
		l = l - 1
	mn1 = -1
	if l != 0:
		mn1 = int(s[:l]) + int(s[l:])
	else:
		mn1 = int(s)
	if r != n and mn1 > int(s[:r]) + int(s[r:]):
		mn1 = int(s[:r]) + int(s[r:])
	elif mn1 > int(s):
		mn1 = int(s)
	if mn1 > mn:
		print(mn)
	else:
		print(mn1)


l = int(input())
a = input()
i = l // 2
if l % 2 == 0:
	if a[i] != '0':
		s1 = ''
		s2 = ''
		for x in range(0, i):
			s1 += a[x]
		for x in range(i, l):
			s2 += a[x]
		num1 = int(s1)
		num2 = int(s2)
		print(num1 + num2)
	else:
		x = i
		y = i
		while a[x - 1] == '0':
			x = x - 1
		while y < l - 1 and a[y + 1] == '0':
			y = y + 1
		s1 = ''
		s2 = ''
		if x > 1:
			for j in range(x - 1):
				s1 += a[j]
			for j in range(x - 1, l):
				s2 += a[j]
			num1 = int(s1)
			num2 = int(s2)
			n1 = num1 + num2
		s1 = ''
		s2 = ''
		if y < l - 1:
			for j in range(y + 1):
				s1 += a[j]
			for j in range(y + 1, l):
				s2 += a[j]
			num1 = int(s1)
			num2 = int(s2)
			n2 = num1 + num2
		if y == l - 1:
			print(n1)
		elif x == 1:
			print(n2)
		elif n1 < n2:
			print(n1)
		else:
			print(n2)
elif a[i] != '0':
	s1 = ''
	s2 = ''
	for x in range(i):
		s1 += a[x]
	for x in range(i, l):
		s2 += a[x]
	num1 = int(s1)
	num2 = int(s2)
	n1 = num1 + num2
	if a[i + 1] == '0':
		print(n1)
	else:
		s1 = ''
		s2 = ''
		for x in range(i + 1):
			s1 += a[x]
		for x in range(i + 1, l):
			s2 += a[x]
		num1 = int(s1)
		num2 = int(s2)
		n2 = num1 + num2
		s1 = ''
		s2 = ''
		if n1 < n2:
			print(n1)
		else:
			print(n2)
else:
	x = i
	y = i
	while a[x - 1] == '0':
		x = x - 1
	while y < l - 1 and a[y + 1] == '0':
		y = y + 1
	s1 = ''
	s2 = ''
	if x > 1:
		for j in range(x - 1):
			s1 += a[j]
		for j in range(x - 1, l):
			s2 += a[j]
		num1 = int(s1)
		num2 = int(s2)
		n1 = num1 + num2
	s1 = ''
	s2 = ''
	if y < l - 1:
		for j in range(y + 1):
			s1 += a[j]
		for j in range(y + 1, l):
			s2 += a[j]
		num1 = int(s1)
		num2 = int(s2)
		n2 = num1 + num2
	if y == l - 1:
		print(n1)
	elif x == 1:
		print(n2)
	elif n1 < n2:
		print(n1)
	else:
		print(n2)


import math
n = int(input())
s = input()
mini = math.inf
digits = 10 ** 5 + 10
for i in range(n // 2, n):
	if s[i] != '0':
		a = i
		b = n - i
		if max(a, b) > digits + 2:
			continue
		else:
			mini = min(mini, int(s[:i]) + int(s[i:]))
			digits = math.log10(mini) + 1
for i in range(n // 2 - 1, 0, -1):
	if s[i] != '0':
		a = i
		b = n - i
		if max(a, b) > digits + 2:
			continue
		else:
			mini = min(mini, int(s[:i]) + int(s[i:]))
			digits = math.log10(mini) + 1
print(mini)


n = int(input())
s = input()
ans = pow(10, 100000)
a = sorted([i for i in range(1, n) if s[i] != '0'], key=lambda x: abs(n / 2 - x))
for i in a[:6]:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


n = int(input())
s = input()
inn = -1
ind = -1
for i in range(n // 2, -1, -1):
	if s[i] != '0':
		inn = i
		break
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		ind = i
		break
if inn > 0 and ind < n and (inn != -1) and (ind != -1):
	ans = min(int(s[:inn]) + int(s[inn:]), int(s[:ind]) + int(s[ind:]))
elif inn == 0 or inn == -1:
	ans = int(s[:ind]) + int(s[ind:])
elif ind == 0 or ind == -1:
	ans = int(s[:inn]) + int(s[inn:])
print(ans)


n = int(input())
s = input()
ans = 10 ** n
x = (n + 1) // 2
for _ in range(x, n):
	if s[_] == '0':
		continue
	ans = min(ans, int(s[_:]) + int(s[:_]))
	break
for _ in range(x - 1, 0, -1):
	if s[_] == '0':
		continue
	ans = min(ans, int(s[_:]) + int(s[:_]))
	break
print(ans)


l = int(input())
n = input()
ans = int(n)
mid = l // 2
L = mid
while L > 0 and n[L] == '0':
	L -= 1
R = mid + 1
while R < l and n[R] == '0':
	R += 1
if L != 0 and R != l:
	num1 = n[0:R]
	num2 = n[R:l]
	ans = min(ans, int(num1) + int(num2))
	num1 = n[0:L]
	num2 = n[L:l]
	ans = min(ans, int(num1) + int(num2))
if L == 0 and R != l:
	num1 = n[0:R]
	num2 = n[R:l]
	ans = min(ans, int(num1) + int(num2))
if L != 0 and R == l:
	num1 = n[0:L]
	num2 = n[L:l]
	ans = min(ans, int(num1) + int(num2))
print(ans)


n = int(input())
num = input()
upperInd = n // 2
while num[upperInd:upperInd + 1] == '0':
	upperInd -= 1
if upperInd == 0:
	moveUp = int(num)
else:
	moveUp = int(num[0:upperInd]) + int(num[upperInd:n])
lowerInd = n - n // 2
while lowerInd < n and num[lowerInd:lowerInd + 1] == '0':
	lowerInd += 1
if lowerInd == n:
	moveDown = int(num)
else:
	moveDown = int(num[0:lowerInd]) + int(num[lowerInd:n])
print(int(min(moveUp, moveDown)))


t = int(input())
s = input()
mn = 999999
for i in range(t // 2, 0, -1):
	if s[i] != '0':
		mn = int(s[:i]) + int(s[i:])
		break
for i in range(t // 2 + 1, t):
	if s[i] != '0':
		mn = min(mn, int(s[:i]) + int(s[i:]))
		break
print(mn)


n = int(input())
k = input()
mi = float('inf')
inda = n // 2
indb = n // 2
while inda < n and k[inda] == '0':
	inda += 1
while indb >= 0 and k[indb] == '0':
	indb -= 1
a = float('inf')
b = float('inf')
if inda < n:
	a = int(k[:inda]) + int(k[inda:])
if inda + n % 2 < n and k[inda + n % 2] != '0':
	a = min(a, int(k[:inda + n % 2]) + int(k[inda + n % 2:]))
if indb > 0:
	b = int(k[:indb]) + int(k[indb:])
if indb + n % 2 < n and indb + n % 2 > 0 and (k[indb + n % 2] != '0'):
	b = min(b, int(k[:indb + n % 2]) + int(k[indb + n % 2:]))
if inda >= n and indb < 0:
	print(0)
else:
	print(min(a, b))


from collections import Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
s = input()
mid = n // 2
ans = int(s)
x = n // 2 + 1
while x < n and s[x] == '0':
	x += 1
if x < n and s[x] != '0':
	ans = min(ans, int(s[:x]) + int(s[x:]))
x = mid
while x > 0 and s[x] == '0':
	x -= 1
if x > 0 and s[x] != '0':
	ans = min(ans, int(s[:x]) + int(s[x:]))
print(ans)


l = int(input())
n = input()
i = l // 2
ans = int(n)
while i > 0:
	if n[i] == '0':
		i -= 1
	else:
		ans = min(ans, int(n[:i]) + int(n[i:]))
		break
i = l // 2 + 1
while i < l:
	if n[i] == '0':
		i += 1
	else:
		ans = min(ans, int(n[:i]) + int(n[i:]))
		break
print(ans)


sz = int(input())
n = input()
if sz % 2 == 0:
	ptr = sz // 2
	if n[ptr] != '0':
		print(int(n[0:ptr]) + int(n[ptr:sz]))
		exit(0)
	while ptr >= 0 and n[ptr] == '0':
		ptr -= 1
	if ptr == 0:
		ans = int(n)
	else:
		ans = int(n[0:ptr]) + int(n[ptr:sz])
	ptr = sz // 2
	while ptr < sz and n[ptr] == '0':
		ptr += 1
	if ptr == sz:
		ans = min(ans, int(n))
	else:
		ans = min(ans, int(n[0:ptr]) + int(n[ptr:sz]))
	print(ans)
else:
	ptr = sz // 2
	if n[ptr] != '0' and n[ptr + 1] != '0':
		ans = min(int(n[0:ptr]) + int(n[ptr:sz]), int(n[0:ptr + 1]) + int(n[ptr + 1:sz]))
		print(ans)
		exit(0)
	elif n[ptr] != '0':
		ans = int(n[0:ptr]) + int(n[ptr:sz])
		print(ans)
		exit(0)
	while ptr >= 0 and n[ptr] == '0':
		ptr -= 1
	if ptr == 0:
		ans = int(n)
	else:
		ans = int(n[0:ptr]) + int(n[ptr:sz])
	ptr = sz // 2
	while ptr < sz and n[ptr] == '0':
		ptr += 1
	if ptr == sz:
		ans = min(ans, int(n))
	else:
		ans = min(ans, int(n[0:ptr]) + int(n[ptr:sz]))
	print(ans)


def IO():
	import sys
	sys.stdout = open('output.txt', 'w')
	sys.stdin = open('input.txt', 'r')

def main():
	l = int(input())
	n = input()
	pos = [i for i in range(1, l) if n[i] != '0']
	pos = sorted(pos, key=lambda i: abs(i - l // 2))
	ans = float('inf')
	for i in range(min(6, len(pos))):
		ans = min(ans, int(n[0:pos[i]]) + int(n[pos[i]:]))
	print(ans)
main()


l = int(input())
s = input()
possible = []
for i in range(1, l):
	if s[i] is not '0':
		possible.append(i)
good = [possible[0]]
digits1 = good[0]
digits2 = l - digits1
maxdigits = max(digits1, digits2) + 1
for p in possible:
	digits1 = p
	digits2 = l - digits1
	localmax = max(digits1, digits2) + 1
	if localmax < maxdigits:
		maxdigits = localmax
		good = [p]
	elif localmax == maxdigits:
		good.append(p)
best = 10 * int(s)
for g in good:
	part1 = int(s[:g])
	part2 = int(s[g:])
	best = min(best, part1 + part2)
print(best)


L = int(input())
S = input()
(x1, x2) = (int(L / 2), int((L + 1) / 2))
ans = 10 ** 100005
while True:
	flag = False
	if S[x1] != '0':
		flag = True
		s1 = int(S[:x1])
		s2 = int(S[x1:])
		ans = min(ans, s1 + s2)
	if S[x2] != '0':
		flag = True
		s1 = int(S[:x2])
		s2 = int(S[x2:])
		ans = min(ans, s1 + s2)
	if flag:
		print(ans)
		break
	x1 = x1 - 1
	x2 = x2 + 1


def solve(S):
	n = len(S)
	cands = []
	i = n // 2
	while i > 0 and S[i] == '0':
		i -= 1
	cands.append(i)
	j = n // 2 + 1
	while j < n and S[j] == '0':
		j += 1
	cands.append(j)
	sums = []
	for i in set(cands):
		if i == 0:
			sums.append([S, '0'])
		elif i == n:
			sums.append([S, '0'])
		else:
			sums.append([S[:i], S[i:]])
	return min((int(a) + int(b) for (a, b) in sums))
input()
print(solve(input()))


l = int(input())
x = input()
p = l // 2
ans = -1
for i in range(p + 1, l):
	if x[i] != '0':
		s = int(x[:i]) + int(x[i:])
		if ans == -1 or s < ans:
			ans = s
		break
for i in range(p, 0, -1):
	if x[i] != '0':
		s = int(x[:i]) + int(x[i:])
		if ans == -1 or s < ans:
			ans = s
		break
print(ans)


l = int(input())
s = input()
s = str(s)
if l % 2 == 0:
	i = l // 2
	i1 = i - 1
	while i1 >= 0:
		if s[i1] != '0':
			break
		i1 = i1 - 1
	i2 = i
	while i2 < l:
		if s[i2] != '0':
			break
		i2 = i2 + 1
	s1 = 0
	s1 = str(s1)
	i3 = 0
	while i3 < i1:
		s1 = s1 + s[i3]
		i3 = i3 + 1
	s2 = 0
	s2 = str(s2)
	i3 = i1
	while i3 < l:
		s2 = s2 + s[i3]
		i3 = i3 + 1
	i3 = 0
	s3 = 0
	s3 = str(s3)
	while i3 < i2:
		s3 = s3 + s[i3]
		i3 = i3 + 1
	s4 = 0
	s4 = str(s4)
	i3 = i2
	while i3 < l:
		s4 = s4 + s[i3]
		i3 = i3 + 1
	s11 = int(s1) + int(s2)
	s22 = int(s3) + int(s4)
	if s11 < s22:
		print(s11)
	else:
		print(s22)
else:
	i = l // 2
	if s[i] == '0':
		i1 = i - 1
		while i1 >= 0:
			if s[i1] != '0':
				break
			i1 = i1 - 1
		i2 = i + 1
		while i2 < l:
			if s[i2] != '0':
				break
			i2 = i2 + 1
		s1 = 0
		s1 = str(s1)
		i3 = 0
		while i3 < i1:
			s1 = s1 + s[i3]
			i3 = i3 + 1
		s2 = 0
		s2 = str(s2)
		i3 = i1
		while i3 < l:
			s2 = s2 + s[i3]
			i3 = i3 + 1
		i3 = 0
		s3 = 0
		s3 = str(s3)
		while i3 < i2:
			s3 = s3 + s[i3]
			i3 = i3 + 1
		s4 = 0
		s4 = str(s4)
		i3 = i2
		while i3 < l:
			s4 = s4 + s[i3]
			i3 = i3 + 1
		s11 = int(s1) + int(s2)
		s22 = int(s3) + int(s4)
		if s11 < s22:
			print(s11)
		else:
			print(s22)
	else:
		i = l // 2
		s11 = 0
		s22 = 0
		if s[i + 1] != '0':
			i1 = 0
			s1 = 0
			s1 = str(s1)
			while i1 <= i:
				s1 = s1 + s[i1]
				i1 = i1 + 1
			i1 = i + 1
			s2 = 0
			s2 = str(s2)
			while i1 < l:
				s2 = s2 + s[i1]
				i1 = i1 + 1
			s11 = int(s2) + int(s1)
		i1 = 0
		s1 = 0
		s1 = str(s1)
		while i1 < i:
			s1 = s1 + s[i1]
			i1 = i1 + 1
		i1 = i
		s2 = 0
		s2 = str(s2)
		while i1 < l:
			s2 = s2 + s[i1]
			i1 = i1 + 1
		s22 = int(s1) + int(s2)
		if s[i + 1] != 0:
			print(min(s11, s22))
		else:
			print(s22)


l = int(input())
n = str(input())
ret = int(n)
mod_l = l // 2
if l % 2:
	for i in range(mod_l):
		if int(n[mod_l + i + 1]):
			temp = int(n[:mod_l + i + 1]) + int(n[mod_l + i + 1:])
		else:
			temp = ret
		if int(n[mod_l - i]):
			temp = min(temp, int(n[:mod_l - i]) + int(n[mod_l - i:]))
		if ret > temp:
			ret = temp
			break
else:
	for i in range(mod_l):
		if int(n[mod_l + i]):
			temp = int(n[:mod_l + i]) + int(n[mod_l + i:])
		else:
			temp = ret
		if int(n[mod_l - i]):
			temp = min(temp, int(n[:mod_l - i]) + int(n[mod_l - i:]))
		if ret > temp:
			ret = temp
			break
print(ret)


l = int(input())
s = input()
ret = int(s)
testing = 2

def debug(s):
	if testing == 1:
		print(s)

def check(middle, dir):
	global s
	while middle > 0 and middle < l - 1 and (s[middle] == '0'):
		debug(middle)
		middle += dir
	s1 = s[:middle]
	s2 = s[middle:]
	if s1 == '' or s2 == '':
		return middle
	elif s1[0] == '0' or s2[0] == '0':
		return middle
	else:
		debug('middle : %d, %s' % (middle, s[middle]))
		debug('s1:' + s1)
		debug('s2:' + s2)
		ret1 = int(s1) + int(s2)
		global ret
		if ret1 < ret:
			ret = ret1
		return middle
middle = l // 2 - 1
debug(middle)
for i in range(3):
	middle = check(middle, 1)
	middle += 1
middle = l // 2 + 1
for i in range(3):
	middle = check(middle, -1)
	middle += 1
print(ret)


n = int(input())
s = input()
j = (n + 1) // 2
i = j - 1
r = int(s)
while i > 0 and s[i] == '0':
	i -= 1
while j < n and s[j] == '0':
	j += 1
if i > 0:
	w = int(s[0:i]) + int(s[i:])
	r = min(r, w)
if j < n:
	k = int(s[0:j]) + int(s[j:])
	r = min(r, k)
print(r)


l = int(input())
s = input()
ans = None
ml = None
for i in range(1, l):
	if s[i] == '0':
		continue
	la = i
	lb = l - i
	ll = max(la, lb)
	if ml is None or ml > ll:
		ml = ll
for i in range(1, l):
	if s[i] == '0':
		continue
	la = i
	lb = l - i
	ll = max(la, lb)
	if ll > ml + 2:
		continue
	a = int(s[:i])
	b = int(s[i:])
	sum = a + b
	if ans is None or ans > sum:
		ans = sum
print(ans)


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def read_string():
	return sys.stdin.readline().strip()

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l):
	print(' '.join(map(str, l)))
l = read_int()
n = read_string()
if l == 2:
	if n.find('0') == -1:
		print(int(n[0]) + int(n[1]))
	else:
		print(n)
	sys.exit()
if '0' not in [n[l // 2], n[l // 2 - 1], n[l // 2 + 1]]:
	if l % 2 == 0:
		print(int(n[:l // 2]) + int(n[l // 2:]))
	else:
		left_sum = int(n[:l // 2]) + int(n[l // 2:])
		right_sum = int(n[:l // 2 + 1]) + int(n[l // 2 + 1:])
		print(min(left_sum, right_sum))
else:
	start = l // 2 - 1
	while n[start] == '0' and start > 0:
		start -= 1
	if start != 0:
		left_sum = int(n[:start]) + int(n[start:])
	else:
		left_sum = int(n[start:])
	start = l // 2 + 1
	while start < l and n[start] == '0':
		start += 1
	if start != l:
		right_sum = int(n[:start]) + int(n[start:])
	else:
		right_sum = int(n[:start])
	print(min(left_sum, right_sum))


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def cal_sum(s):
	return int(n[:s]) + int(n[s:])

def is_valid_left(sl):
	return sl > 0 and n[sl] != '0'

def is_valid_right(sr):
	return sr < l and n[sr] != '0'
l = int(input())
n = input()
sl_ori = l // 2
sr_ori = l // 2 + l % 2
for i in range(0, l + 1):
	sl = sl_ori - i
	sr = sr_ori + i
	sl2 = sl - 1
	sr2 = sr + 1
	if not is_valid_right(sr) and (not is_valid_left(sl)):
		continue
	sum_sl = 10 ** 100002
	sum_sr = 10 ** 100002
	sum_sl2 = 10 ** 100002
	sum_sr2 = 10 ** 100002
	if is_valid_left(sl):
		sum_sl = cal_sum(sl)
	if is_valid_right(sr):
		sum_sr = cal_sum(sr)
	if is_valid_left(sl2):
		sum_sl2 = cal_sum(sl2)
	if is_valid_right(sr2):
		sum_sr2 = cal_sum(sr2)
	print(min(sum_sl, sum_sr, sum_sl2, sum_sr2))
	break


l = int(input())
n = input()
ans = int(n)
mid = l // 2
if n[mid] != '0':
	ans = int(n[:mid]) + int(n[mid:])
i = l // 2
out = False
for j in range(1, mid + 1):
	if i + j < l:
		if n[i + j] != '0':
			temp = int(n[:i + j]) + int(n[i + j:])
			ans = min(ans, temp)
			out = True
	if i - j > 0:
		if n[i - j] != '0':
			temp = int(n[:i - j]) + int(n[i - j:])
			ans = min(ans, temp)
			break
	if out:
		break
print(ans)


n = int(input())
s = input()
result = int(s)
mid = int(n / 2)
count = 0
i = 0
while count < 4:
	index = mid + i
	if index > n - 1:
		break
	if s[index] != '0':
		result = min(int(s[:index]) + int(s[index:]), result)
		count += 1
	index2 = mid - i
	if index2 > 0 and s[index2] != '0':
		result = min(int(s[:index2]) + int(s[index2:]), result)
		count += 1
	i += 1
print(result)


T = int(input())
s = input()
mid = len(s) // 2
MIN = -1
if len(s) < 3:
	print(int(s[0]) + int(s[1]))
	return
for i in range(mid, -1, -1):
	if s[i + 1] != '0':
		MIN = int(s[:i + 1]) + int(s[i + 1:])
		break
for i in range(mid, len(s)):
	if s[i] != '0':
		tmp = int(s[:i]) + int(s[i:])
		if MIN > tmp:
			MIN = tmp
		break
if MIN == -1:
	MIN = int(s[:len(s) - 1]) + int(s[len(s) - 1:])
print(MIN)


l = int(input())
s = input()
i = l // 2
if s[i] == '0':
	j = i
	while s[i] == '0':
		i += 1
		if i == l:
			break
	while s[j] == '0':
		j -= 1
	if j == 0:
		if i == l:
			print(s)
		else:
			print(int(s[:i]) + int(s[i:]))
	elif i == l:
		print(int(s[:j]) + int(s[j:]))
	else:
		print(min(int(s[:i]) + int(s[i:]), int(s[:j]) + int(s[j:])))
elif l & 1:
	print(min(int(s[:i]) + int(s[i:]), int(s[:i + 1]) + int(s[i + 1:])))
else:
	print(int(s[:i]) + int(s[i:]))


def get_sum(arr1, arr2):
	res = []
	n = len(arr1)
	m = len(arr2)
	if n > m:
		(n, m) = (m, n)
		(arr1, arr2) = (arr2, arr1)
	carry = 0
	i = 0
	while i < n:
		if arr1[n - 1 - i] + arr2[m - 1 - i] + carry >= 10:
			res.append(arr1[n - 1 - i] + arr2[m - 1 - i] + carry - 10)
			carry = 1
		else:
			res.append(arr1[n - 1 - i] + arr2[m - 1 - i] + carry)
			carry = 0
		i += 1
	while i < m:
		if arr2[m - 1 - i] + carry >= 10:
			res.append(arr2[m - 1 - i] + carry - 10)
			carry = 1
		else:
			res.append(arr2[m - 1 - i] + carry)
			carry = 0
		i += 1
	if carry:
		res.append(carry)
	return res[::-1]

def comp(arr1, arr2):
	if len(arr1) > len(arr2):
		return 1
	elif len(arr1) < len(arr2):
		return -1
	else:
		i = 0
		while i < len(arr1) and arr1[i] == arr2[i]:
			i += 1
		if arr1[i] > arr2[i]:
			return 1
		elif arr1[i] < arr2[i]:
			return -1
		else:
			return 0
	return 0
l = int(input())
arr = list(map(int, input()))
mid = l // 2
i = mid
while i >= 0 and arr[i] == 0:
	i -= 1
arr1 = arr[:i]
arr2 = arr[i:]
res1 = get_sum(arr1, arr2)
i = mid + 1
while i < l and arr[i] == 0:
	i += 1
arr1 = arr[:i]
arr2 = arr[i:]
res2 = get_sum(arr1, arr2)
if res1 and res2:
	if comp(res1, res2) == -1:
		print('{}'.format(''.join(map(str, res1))))
	elif comp(res1, res2) == 1:
		print('{}'.format(''.join(map(str, res2))))
else:
	print('{}'.format(''.join(map(str, res1))))


import sys

def f(s, k):
	return int(s[:k]) + int(s[k:])

def solve(s, k):
	if s[k] != '0':
		return f(s, k)
	ans = []
	i = k
	while s[i] == '0':
		i -= 1
	if i != 0:
		ans.append(f(s, i))
	j = k
	while j < len(s) and s[j] == '0':
		j += 1
	if j != len(s):
		ans.append(f(s, j))
	assert ans
	return min(ans)
n = sys.stdin.readline()
s = sys.stdin.readline().rstrip()
n = len(s)
print(min(solve(s, n // 2), solve(s, (n + 1) // 2)))


input()
a = input()
lena = len(a)
x = lena // 2
y = x + 1
while a[x] == '0':
	x -= 1
while y < lena - 1 and a[y] == '0':
	y += 1
s = []
inf = int('9' * 100001)

def sum(x):
	try:
		b = int(a[:x])
		c = int(a[x:])
		1 / int(a[x:][0])
		res = b + c
	except Exception:
		res = inf
	return res
s.append(sum(x))
s.append(sum(x - 1))
s.append(sum(x + 1))
s.append(sum(y))
s.append(sum(y - 1))
s.append(sum(y + 1))
print(min(s))


l = int(input())
s = input()
n = int(s)
mitad = l // 2
base = mitad + 1
while base < l and s[base] == '0':
	base += 1
base = 10 ** (l - base)
a = n // base
b = n % base
sol = a + b
base = mitad
while base > 0 and s[base] == '0':
	base -= 1
base = 10 ** (l - base)
a = n // base
b = n % base
sol = min(sol, a + b)
print(sol)


l = int(input())
n = input()
mn = int(n)
mid1 = l // 2
mid2 = l // 2
while n[mid1] == '0':
	mid1 -= 1
while mid2 < l and n[mid2] == '0':
	mid2 += 1
if mid2 == l:
	mid2 = l // 2
	while n[mid2] == '0':
		mid2 -= 1
for i in range(mid2 - 1, min(l - 1, mid2 + 1)):
	if n[i + 1] == '0':
		continue
	a1 = int(n[:i + 1])
	a2 = int(n[i + 1:])
	mn = min(mn, a1 + a2)
for i in range(max(0, mid1 - 1), min(l - 1, mid1 + 1)):
	if n[i + 1] == '0':
		continue
	a1 = int(n[:i + 1])
	a2 = int(n[i + 1:])
	mn = min(mn, a1 + a2)
print(mn)


l = int(input())
n = input()
cands = []
for i in range(0, l - 1):
	if n[i + 1] != '0':
		cands.append((max(i + 1, l - i - 1), i))
cands.sort()
ans = -1
for i in range(0, min(4, len(cands))):
	(mx, idx) = cands[i]
	tmp = int(n[0:idx + 1]) + int(n[idx + 1:l])
	if ans == -1 or tmp < ans:
		ans = tmp
print(ans)


n = int(input())
string = input()
if n % 2 == 0:
	index = n // 2
	for i in range(index, n):
		if string[i] != '0':
			index = i
			break
	ans = int(10 ** 100000)
	if string[index] != '0':
		ans = int(string[:index]) + int(string[index:])
	index = n // 2 - 1
	for i in range(index, -1, -1):
		if string[i] != '0':
			index = i
			break
	if index != 0 and string[index] != '0':
		ans = min(ans, int(string[:index]) + int(string[index:]))
	print(ans)
else:
	index = n // 2 + 1
	for i in range(index, n):
		if string[i] != '0':
			index = i
			break
	ans = int(10 ** 100000)
	if string[index] != '0':
		ans = int(string[:index]) + int(string[index:])
	index = n // 2
	for i in range(index, -1, -1):
		if string[i] != '0':
			index = i
			break
	if index != 0 and string[index] != '0':
		ans = min(ans, int(string[:index]) + int(string[index:]))
	print(ans)


n = int(input())
a = int(input())
s = str(a)
l = []
for i in range(int(n / 2), n):
	if s[i] != '0':
		l.append(int(s[i:]) + int(s[:i]))
		break
if n > 2:
	for i in range(int(n / 2) + 1, 0, -1):
		if s[i] != '0':
			l.append(int(s[i:]) + int(s[:i]))
			break
print(min(l))


import math
import os
import random
import re
import sys
ans = 0
ans1 = 0
fans = 0
fans1 = 0
ffans = 0
n = int(input())
s = input()
if n == 2:
	fans = int(s[0]) + int(s[1])
elif n == 1:
	fans = int(s)
else:
	mid = len(s) // 2
	mid1 = len(s) // 2
	if s[mid + 1] == '0':
		while mid + 1 != len(s) and s[mid + 1] == '0':
			mid += 1
	if s[mid1 + 1] == '0':
		while mid1 - 1 != len(s) and s[mid1 - 1] == '0':
			mid1 -= 1
	l = len(s) // 2
	if l == mid:
		if s[mid] == '0':
			fans = int(s[:mid + 1]) + int(s[mid + 1:])
		else:
			ans = int(s[:mid + 1]) + int(s[mid + 1:])
			ans1 = int(s[:mid]) + int(s[mid:])
			fans = min(ans, ans1)
	else:
		if mid == len(s) - 1:
			ffans = int(s)
			fans1 = int(s[:mid1 - 1]) + int(s[mid1 - 1:])
		else:
			ffans = int(s[:mid + 1]) + int(s[mid + 1:])
			fans1 = int(s[:mid1 - 1]) + int(s[mid1 - 1:])
		fans = min(ffans, fans1)
print(fans)


n = int(input())
b = input()
aaa = n // 2
if n & 1 == 0:
	for i in range(0, aaa):
		num1 = aaa + i
		num = n - num1
		if b[num] == '0' and b[num1] == '0':
			continue
		elif b[num] == '0':
			ans1 = int(b[:num1]) + int(b[num1:n])
			print(ans1)
			break
		elif b[num1] == '0':
			ans2 = int(b[:num]) + int(b[num:n])
			print(ans2)
			break
		else:
			ans1 = int(b[:num]) + int(b[num:n])
			ans2 = int(b[:num1]) + int(b[num1:n])
			if ans1 > ans2:
				print(ans2)
			else:
				print(ans1)
			break
else:
	for i in range(0, aaa + 1):
		num = aaa - i + 1
		num1 = aaa + i
		if b[num] == '0' and b[num1] == '0':
			continue
		elif b[num] == '0':
			ans1 = int(b[:num1]) + int(b[num1:n])
			print(ans1)
			break
		elif b[num1] == '0':
			ans2 = int(b[:num]) + int(b[num:n])
			print(ans2)
			break
		else:
			ans1 = int(b[:num]) + int(b[num:n])
			ans2 = int(b[:num1]) + int(b[num1:n])
			if ans1 > ans2:
				print(ans2)
			else:
				print(ans1)
			break


n = int(input())
num = input()
ans = 10 ** 100005
k = n // 2
for i in range(k, n):
	if num[i] != '0':
		ans = int(num[i:]) + int(num[:i])
		break
for i in range(k + 1, 0, -1):
	if k + 1 < n and num[i] != '0':
		ans = min(ans, int(num[i:]) + int(num[:i]))
		break
print(ans)


def main():
	n = int(input())
	a = input()
	b = []
	for i in range(1, n):
		if a[i] != '0':
			b.append(max(i, n - i))
	b.sort()
	ans = float('inf')
	for i in b[0:min(len(b), 5)]:
		if a[i] != '0':
			ans = min(ans, int(a[0:i]) + int(a[i:n]))
		if a[n - i] != '0':
			ans = min(ans, int(a[0:n - i]) + int(a[n - i:n]))
	print(ans)
main()


l = int(input())
number = str(input())

def sum(a, b):
	result = [0] * (max(len(a), len(b)) + 1)
	memory = 0
	for i in range(1, max(len(a), len(b)) + 1):
		current = memory
		memory = 0
		if i <= len(a):
			current += int(a[-i])
		if i <= len(b):
			current += int(b[-i])
		if current >= 10:
			current = current % 10
			memory = 1
		result[-i] = current
	result[0] = memory
	return result if result[0] != 0 else result[1:]

def a_less_then_b(a, b):
	if len(a) < len(b):
		return True
	if len(a) > len(b):
		return False
	for i in range(0, len(a)):
		if a[i] < b[i]:
			return True
		if a[i] > b[i]:
			return False
	return False
minimum = [9] * l

def update_minimum(middle_left, middle_right):
	global minimum
	while number[middle_left] == '0':
		middle_left -= 1
	while middle_right < l and number[middle_right] == '0':
		middle_right += 1
	current = sum(number[:middle_left], number[middle_left:])
	if a_less_then_b(current, minimum):
		minimum = current
	if middle_right < l and number[middle_right] != '0':
		current = sum(number[:middle_right], number[middle_right:])
		if a_less_then_b(current, minimum):
			minimum = current
if l % 2 == 0:
	update_minimum(l // 2, l // 2)
else:
	update_minimum(l // 2, l // 2)
	update_minimum(l // 2 + 1, l // 2 + 1)
print(''.join(map(str, minimum)))


from math import inf
(l, n) = (int(input()), input())
m = l // 2
c = 0
v = 0
t = inf
while m != 0 and m != l:
	m = m - c if c % 2 == 0 else m + c
	c += 1
	try:
		if n[m:][0] != '0' and m != l and (m != 0):
			v += 1
			t = min(t, int(n[:m]) + int(n[m:]))
			if v >= 2:
				break
	except IndexError:
		break
print(t)


n = int(input())
a = input()
flag = 0
i = 0
while flag == 0:
	if n // 2 + i < n:
		if a[n // 2 + i] != '0':
			break
	if n // 2 - i >= 0:
		if a[n // 2 - i] != '0':
			break
	i += 1
min = int(a)
if n // 2 + i + 1 < n:
	if a[n // 2 + i + 1] != '0':
		if int(a[n // 2 + i + 1:]) + int(a[:n // 2 + i + 1]) < min:
			min = int(a[n // 2 + i + 1:]) + int(a[:n // 2 + i + 1])
if n // 2 + i < n:
	if a[n // 2 + i] != '0':
		if int(a[n // 2 + i:]) + int(a[:n // 2 + i]) < min:
			min = int(a[n // 2 + i:]) + int(a[:n // 2 + i])
if n // 2 + i - 1 < n:
	if a[n // 2 + i - 1] != '0':
		if int(a[n // 2 + i - 1:]) + int(a[:n // 2 + i - 1]) < min:
			min = int(a[n // 2 + i - 1:]) + int(a[:n // 2 + i - 1])
if n // 2 - i + 1 > 0:
	if a[n // 2 - i + 1] != '0':
		if int(a[n // 2 - i + 1:]) + int(a[:n // 2 - i + 1]) < min:
			min = int(a[n // 2 - i + 1:]) + int(a[:n // 2 - i + 1])
if n // 2 - i > 0:
	if a[n // 2 - i] != '0':
		if int(a[n // 2 - i:]) + int(a[:n // 2 - i]) < min:
			min = int(a[n // 2 - i:]) + int(a[:n // 2 - i])
if n // 2 - i - 1 > 0:
	if a[n // 2 - i - 1] != '0':
		if int(a[n // 2 - i - 1:]) + int(a[:n // 2 - i - 1]) < min:
			min = int(a[n // 2 - i - 1:]) + int(a[:n // 2 - i - 1])
print(min)


n = int(input())
number = input()
mn = int(100000 * '9')
for i in range(n // 2, 0, -1):
	if number[i] != '0':
		p1 = int(number[:i])
		p2 = int(number[i:])
		mn = min(mn, p1 + p2)
		break
for i in range(n // 2 + n % 2, n):
	if number[i] != '0':
		p1 = int(number[:i])
		p2 = int(number[i:])
		mn = min(mn, p1 + p2)
		break
print(mn)


l = int(input().strip())
n = str(input().strip())
n1 = n[:l // 2]
n2 = n[l // 2:]
if n1[-1] != '0' and n2[0] != '0':
	if l % 2 == 0:
		print(int(n1) + int(n2))
	else:
		print(min(int(n[:l // 2]) + int(n[l // 2:]), int(n[:l // 2 + 1]) + int(n[l // 2 + 1:])))
	exit()
(a1, a2) = (l // 2 - 1, l // 2)
while n[a1] == '0' and a1 > 0:
	a1 -= 1
while n[a2] == '0' and a2 < l - 1:
	a2 += 1
if a1 == 0 and a2 == l - 1:
	if n[a2] == '0':
		print(n)
	else:
		print(n[:l - 2] + n[-1])
elif a1 != 0 and a2 != l - 1:
	print(min(int(n[:a1]) + int(n[a1:]), int(n[:a2]) + int(n[a2:])))
elif a1 == 0:
	print(int(n[:a2]) + int(n[a2:]))
else:
	print(int(n[:a1]) + int(n[a1:]))


def closest_nonzero(s, h, l):
	index1 = 0
	index = 0
	for i in range(h, l):
		if n[i] != '0':
			index = i
			break
	for i in range(h, -1, -1):
		if n[i] != '0':
			index1 = i
			break
	return (index, index1)
l = int(input())
n = input()
half = l // 2
if l % 2 == 0:
	even = True
else:
	even = False
if even:
	(index, index1) = closest_nonzero(n, half, l)
	if index == 0 and index1 == 0:
		ans = min(int(n[index:]), int(n[index1:]))
	elif index == 0:
		ans = min(int(n[index:]), int(n[:index1]) + int(n[index1:]))
	elif index1 == 0:
		ans = min(int(n[:index]) + int(n[index:]), int(n[index1:]))
	else:
		ans = min(int(n[:index]) + int(n[index:]), int(n[:index1]) + int(n[index1:]))
	print(ans)
else:
	(index, index1) = closest_nonzero(n, half, l)
	if index == 0 and index1 == 0:
		ans = min(int(n[index:]), int(n[index1:]))
	elif index == 0:
		ans = min(int(n[index:]), int(n[:index1]) + int(n[index1:]))
	elif index1 == 0:
		ans = min(int(n[:index]) + int(n[index:]), int(n[index1:]))
	else:
		ans = min(int(n[:index]) + int(n[index:]), int(n[:index1]) + int(n[index1:]))
	(index, index1) = closest_nonzero(n, half + 1, l)
	if index == 0 and index1 == 0:
		ans1 = min(int(n[index:]), int(n[index1:]))
	elif index == 0:
		ans1 = min(int(n[index:]), int(n[:index1]) + int(n[index1:]))
	elif index1 == 0:
		ans1 = min(int(n[:index]) + int(n[index:]), int(n[index1:]))
	else:
		ans1 = min(int(n[:index]) + int(n[index:]), int(n[:index1]) + int(n[index1:]))
	print(min(ans, ans1))


import math
l = int(input())
sn = input()
n = int(sn)
hl = l // 2
summ = summ2 = math.inf
a1 = hl
if l > 2:
	a2 = hl + 1
else:
	a2 = a1
while sn[a1] == '0' and a1 > 1:
	a1 -= 1
if sn[a1] != '0':
	summ = int(sn[:a1]) + int(sn[a1:])
while sn[a2] == '0' and a2 < l - 1:
	a2 += 1
if sn[a2] != '0':
	summ2 = int(sn[:a2]) + int(sn[a2:])
if summ > summ2:
	summ = summ2
print(summ)


l = int(input())
n = input()
st = l // 2
if l % 2 != 0 and int(n[:st + 1]) < int(n[st:]):
	st += 1
if n[st] != '0':
	sum = int(n[:st]) + int(n[st:])
else:
	ip = st
	while n[ip] == '0' and ip < l - 1:
		ip += 1
	il = st
	while n[il] == '0':
		il -= 1
	if il == 0:
		sum = int(n[:ip]) + int(n[ip:])
	elif ip == l - 1:
		sum = int(n[:il]) + int(n[il:])
	else:
		sum = min(int(n[:il]) + int(n[il:]), int(n[:ip]) + int(n[ip:]))
print(sum)


l = int(input())
num = str(input())
idx = l // 2
pos = True
while True:
	if num[idx] != '0':
		break
	idx -= 1
	if idx < 0:
		pos = False
		break
ls = num[:idx]
rs = num[idx:]
s1 = 0
s1found = False
if ls != '' and rs != '':
	s1 = int(ls) + int(rs)
	s1found = True
pos2 = True
idx = l // 2 + 1
while True:
	if num[idx] != '0':
		break
	idx += 1
	if idx == l:
		pos2 = False
		break
ls2 = num[:idx]
rs2 = num[idx:]
s2 = 0
s2found = False
if rs2 != '' and ls2 != '':
	s2 = int(ls2) + int(rs2)
	s2found = True
if s1found and s2found:
	print(min(s2, s1))
elif s1found:
	print(s1)
else:
	print(s2)


n = int(input())
s = input()
if n == 2:
	print(int(s[0]) + int(s[1]))
else:
	ans = float('inf')
	for k in {n // 2, n // 2 - 1, n // 2 + 1}:
		if k != 0 and k != n:
			(a, b) = (int(s[:k]), int(s[k:]))
			if s[k] != '0':
				ans = min(ans, a + b)
	for i in range(n // 2, n):
		if s[i] != '0':
			ans = min(ans, int(s[:i]) + int(s[i:]))
			break
	for i in range(n // 2 + 1, 0, -1):
		if s[i] != '0':
			ans = min(ans, int(s[:i]) + int(s[i:]))
			break
	print(ans)


l = int(input())
n = input()
pos = []
bestdiff = 100000000
for i in range(l - 1):
	if n[i + 1] != '0':
		pos.append(i)
		bestdiff = min(bestdiff, max(i + 1, l - i - 1))
ans = []
for i in pos:
	if max(i + 1, l - i - 1) == bestdiff:
		ans.append(int(n[:i + 1]) + int(n[i + 1:]))
print(min(ans))


n = int(input())
s = input()
l = max(1, n // 2)
r = min(n - 1, n // 2 + 1)
ans = -1
cnt = 0
while l >= 0 or r < n:
	if l > 0 and s[l] != '0':
		cnt += 1
		cur = int(s[:l]) + int(s[l:])
		if ans == -1 or cur < ans:
			ans = cur
	if r <= n - 1 and s[r] != '0':
		cur = int(s[:r]) + int(s[r:])
		cnt += 1
		if ans == -1 or cur < ans:
			ans = cur
	if ans != -1 and cnt > 5:
		break
	l -= 1
	r += 1
if ans == -1:
	print(int(s))
else:
	print(ans)


n = int(input())
b = input()
flag = 0
newRange = 5
oldRange = 0
ans = int(b)
if n < 20:
	for i in range(0, len(b) - 1):
		if b[i + 1] != '0':
			ans = min(ans, int(b[0:i + 1]) + int(b[i + 1:]))
while flag == 0 and newRange <= n:
	for i in range(n // 2 - newRange, n // 2 - oldRange):
		if i < 0 or i >= len(b) - 1:
			continue
		if b[i + 1] != '0':
			flag = 1
			ans = min(ans, int(b[0:i + 1]) + int(b[i + 1:]))
	for i in range(n // 2 + oldRange, n // 2 + newRange):
		if i < 0 or i >= len(b) - 1:
			continue
		if b[i + 1] != '0':
			flag = 1
			ans = min(ans, int(b[0:i + 1]) + int(b[i + 1:]))
	oldRange = newRange
	newRange += 5
print(ans)


def check(s1, s2):
	if len(s1) == 0 or len(s2) == 0 or s2[0] == '0':
		return -1
	else:
		return int(s1) + int(s2)
dummy = input()
str = input()
left = 0
right = 0
if len(str) % 2 == 0:
	left = len(str) // 2 - 1
	right = len(str) // 2
else:
	left = len(str) // 2
	right = len(str) // 2
answer = -1
while answer == -1:
	it1 = check(str[0:left], str[left:len(str)])
	if it1 != -1:
		if answer == -1 or answer > it1:
			answer = it1
	it2 = check(str[0:right], str[right:len(str)])
	if it2 != -1:
		if answer == -1 or answer > it2:
			answer = it2
	left -= 1
	right += 1
if left > 0:
	it1 = check(str[0:left], str[left:len(str)])
	if it1 != -1:
		if answer == -1 or answer > it1:
			answer = it1
if right < len(str):
	it2 = check(str[0:right], str[right:len(str)])
	if it2 != -1:
		if answer == -1 or answer > it2:
			answer = it2
print(answer)


l = int(input())
n = input()
first = l // 2 + 1
second = l // 2
while second < l and n[second] == '0':
	second += 1
while n[first] == '0':
	first -= 1
ans = -1
if second == l:
	ans = int(n[0:first]) + int(n[first:l])
elif first == 0:
	ans = int(n[0:second]) + int(n[second:l])
else:
	ans = min(int(n[0:second]) + int(n[second:l]), int(n[0:first]) + int(n[first:l]))
print(ans)


n = int(input())
s = input()
if n == 2:
	print(int(s[0]) + int(s[1]))
else:
	mid = len(s) // 2
	mid1 = mid - 1
	mid2 = mid + 1
	while mid1 > 0 and s[mid1] == '0':
		mid1 -= 1
	while mid2 < n and s[mid2] == '0':
		mid2 += 1
	r = []
	if s[mid] != '0':
		bst1 = int(s[:mid]) + int(s[mid:])
		r.append(bst1)
	if mid1 > 0:
		r.append(int(s[:mid1]) + int(s[mid1:]))
	if mid2 < n:
		r.append(int(s[:mid2]) + int(s[mid2:]))
	print(min(r))


l = int(input())
n = input()
pos = len(n) // 2
while pos < len(n) and n[pos] == '0':
	pos += 1
ans = -1
if pos < len(n):
	left = int(n[:pos])
	right = int(n[pos:])
	ans = left + right
	pos += 1
	if pos < len(n) and n[pos] != '0':
		left = int(n[:pos])
		right = int(n[pos:])
		if ans == -1:
			ans = left + right
		else:
			ans = min(ans, left + right)
pos = len(n) // 2 - 1
while 1 <= pos and n[pos] == '0':
	pos -= 1
if 1 <= pos:
	left = int(n[:pos])
	right = int(n[pos:])
	if ans == -1:
		ans = left + right
	else:
		ans = min(ans, left + right)
	pos -= 1
	if 1 <= pos and n[pos] != '0':
		left = int(n[:pos])
		right = int(n[pos:])
		if ans == -1:
			ans = left + right
		else:
			ans = min(ans, left + right)
print(ans)


def main():
	from math import ceil
	n = int(input())
	s = input()
	var1 = n // 2
	var2 = n // 2
	var3 = ceil(n / 2)
	var4 = ceil(n / 2)
	while s[var1] == '0' and var1 > 0:
		var1 -= 1
	while var2 < n and s[var2] == '0':
		var2 += 1
	while s[var3] == '0' and var3 > 0:
		var3 -= 1
	while var4 < n and s[var4] == '0':
		var4 += 1
	f1 = 10000000000.0
	f2 = 10000000000.0
	f3 = 10000000000.0
	f4 = 10000000000.0
	if n > var1 > 0:
		f1 = int(s[:var1]) + int(s[var1:])
	if n > var2 > 0:
		f2 = int(s[:var2]) + int(s[var2:])
	if n > var3 > 0:
		f3 = int(s[:var3]) + int(s[var3:])
	if n > var4 > 0:
		f4 = int(s[:var4]) + int(s[var4:])
	ans = min(f1, f2, f3, f4)
	print(ans)
main()


L = int(input())
s = input()
best = int(s)
for i in range((L + 1) // 2, 0, -1):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		best = min(best, a + b)
		break
for i in range(L // 2, L):
	if s[i] != '0':
		a = int(s[:i])
		b = int(s[i:])
		best = min(best, a + b)
		break
print(best)


l = int(input())
s = input()
ans = -1
cp = int((l - 1) / 2)
dist = 1
if l % 2 == 1:
	dist = 0
while ans == -1:
	if s[cp + 1] != '0':
		ans = int(s[:cp + 1]) + int(s[cp + 1:])
	if cp + dist < l and s[cp + dist] != '0':
		if ans == -1:
			ans = int(s[:cp + dist]) + int(s[cp + dist:])
		else:
			ans = min(ans, int(s[:cp + dist]) + int(s[cp + dist:]))
	cp -= 1
	dist += 2
	if ans != -1:
		if cp >= 0 and s[cp + 1] != '0':
			ans = min(ans, int(s[:cp + 1]) + int(s[cp + 1:]))
		if cp + dist < l and s[cp + dist] != '0':
			ans = min(ans, int(s[:cp + dist]) + int(s[cp + dist:]))
print(ans)


n = int(input())
s = input()
l = [i for i in range(1, n) if s[i] != '0']
l.sort(key=lambda x: abs(x - n / 2))
ans = float('inf')
for i in l[:10]:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


def asdf():
	l = int(input())
	s = input()
	n = int(s)
	mid = l // 2
	mini = n
	k = 0
	for i in range(0, l // 2 + 1):
		ind = mid + i
		if 0 < ind < l and s[ind] != '0':
			mini = min(mini, int(s[:ind]) + int(s[ind:]))
			k += 1
		ind = mid - i
		if 0 < ind < l and s[ind] != '0':
			mini = min(mini, int(s[:ind]) + int(s[ind:]))
			k += 1
		if k >= 5:
			break
	print(mini)
asdf()


x = int(input())
y = input()
mn = 999999
for i in range(x // 2, 0, -1):
	if y[i] != '0':
		mn = int(y[:i]) + int(y[i:])
		break
for i in range(x // 2 + 1, x):
	if y[i] != '0':
		mn = min(mn, int(y[:i]) + int(y[i:]))
		break
print(mn)


n = int(input())
s = input()
if n % 2 == 0:
	fir = n // 2 - 1
	sec = n // 2
	while fir >= 0 and s[fir] == '0':
		fir -= 1
	while sec < n and s[sec] == '0':
		sec += 1
	if sec == n:
		temp1 = int(s[fir:])
		temp2 = int(s[:fir])
		print(temp2 + temp1)
	elif fir == 0:
		temp1 = int(s[:sec])
		temp2 = int(s[sec:])
		print(temp1 + temp2)
	else:
		temp1 = int(s[:sec])
		temp2 = int(s[sec:])
		temp3 = int(s[fir:])
		temp4 = int(s[:fir])
		print(min(temp1 + temp2, temp3 + temp4))
else:
	mid = n // 2
	if s[mid] != '0':
		temp1 = int(s[:n // 2]) + int(s[n // 2:])
		temp2 = int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])
		print(min(temp1, temp2))
	else:
		fir = n // 2 - 1
		sec = n // 2 + 1
		while fir >= 0 and s[fir] == '0':
			fir -= 1
		while sec < n and s[sec] == '0':
			sec += 1
		if sec == n:
			temp1 = int(s[fir:])
			temp2 = int(s[:fir])
			print(temp2 + temp1)
		elif fir == 0:
			temp1 = int(s[:sec])
			temp2 = int(s[sec:])
			print(temp1 + temp2)
		else:
			temp1 = int(s[:sec])
			temp2 = int(s[sec:])
			temp3 = int(s[fir:])
			temp4 = int(s[:fir])
			print(min(temp1 + temp2, temp3 + temp4))


l = int(input())
a = input()
ans = -1
mid = l // 2
for i in range(mid, 0, -1):
	if a[i] != '0':
		if ans != -1:
			ans = min(ans, int(a[0:i]) + int(a[i:]))
		else:
			ans = int(a[0:i]) + int(a[i:])
		break
for i in range(mid + 1, l):
	if a[i] != '0':
		if ans != -1:
			ans = min(ans, int(a[0:i]) + int(a[i:]))
		else:
			ans = int(a[0:i]) + int(a[i:])
		break
print(ans)


l = int(input())
s = input()
b = 0
b1 = None
for i in range(1, l):
	if s[i] != '0':
		if max(i, l - i) < max(b, l - b):
			b = i
			b1 = None
		elif max(i, l - i) == max(b, l - b):
			b1 = i
if b1 == None:
	print(int(s[:b]) + int(s[b:]))
else:
	print(min(int(s[:b]) + int(s[b:]), int(s[:b1]) + int(s[b1:])))


input()
s = input()
n = len(s)
pos = n // 2
left = pos
right = pos + 1
while s[left] == '0':
	left -= 1
while right < n and s[right] == '0':
	right += 1
if left == 0:
	res = int(s[:right]) + int(s[right:])
elif right == n:
	res = int(s[:left]) + int(s[left:])
else:
	res = min(int(s[:left]) + int(s[left:]), int(s[:right]) + int(s[right:]))
print(res)


le = int(input())
num = input()
data = [-1] * 4
mid = le // 2
for i in range(mid + 1, le):
	if num[i] != '0':
		if data[2] == -1:
			data[2] = i
		else:
			data[3] = i
			break
for i in range(mid, -1, -1):
	if num[i] != '0':
		if data[1] == -1:
			data[1] = i
		else:
			data[0] = i
			break
mn = float('inf')
for i in [0, 1, 2, 3]:
	if data[i] != -1:
		a = data[i]
		if a == 0:
			mn = min(mn, int(num))
		else:
			mn = min(mn, int(num[:data[i]]) + int(num[data[i]:]))
print(mn)


import sys
import math
N = int(input())
S = input().strip()
C = 10 ** 121212
mi = 101010
for i in range(1, N):
	if S[i] != '0':
		mi = min(mi, max(i, N - i) + 2)
for i in range(1, N):
	if S[i] != '0' and max(i, N - i) <= mi:
		T = int(S[0:i]) + int(S[i:])
		C = min(C, T)
print(C)


import sys
input = sys.stdin.readline
n = int(input())
x = input()
res = int(x)
idx = n // 2
for i in range(idx, 0, -1):
	if x[i] == '0':
		continue
	res = min(res, int(x[i:]) + int(x[:i]))
	break
for i in range(idx + 1, n):
	if x[i] == '0':
		continue
	res = min(res, int(x[i:]) + int(x[:i]))
	break
print(res)


l = int(input())
n = input()
mn = float('Inf')
for i in range(l // 2, l):
	if n[i] == '0':
		continue
	temp = int(n[:i]) + int(n[i:])
	if temp > mn:
		break
	mn = temp
for i in range(l // 2 - 1, 0, -1):
	if n[i] == '0':
		continue
	temp = int(n[:i]) + int(n[i:])
	if temp > mn:
		break
	mn = temp
print(mn)


k = int(input())
a = input()
m = int(a)
sub = []
ii = (k - 1) // 2
jj = ii + 1
while ii > 0 or jj < k:
	if ii > 0:
		if a[ii] != '0':
			sub.append(ii)
		ii -= 1
	if jj < k:
		if a[jj] != '0':
			sub.append(jj)
		jj += 1
for i in sub[:2]:
	m = min(m, int(a[:i]) + int(a[i:]))
print(m)


def t(c):
	one = a // 2
	two = a // 2 + a % 2
	if sum((int(c[:two]), int(c[-one:]))) > sum((int(c[:one]), int(c[-two:]))):
		return (c[:one], c[-two:])
	return (c[:two], c[-one:])

def f1(a, b):
	while b[0] == '0':
		b = a[-1] + b
		a = a[:-1]
	if a == '':
		a = '0'
	if b == '':
		b = '0'
	return sum((int(a), int(b)))

def f2(a, b):
	while b != '' and b[0] == '0':
		a = a + b[0]
		b = b[1:]
	if a == '':
		a = '0'
	if b == '':
		b = '0'
	return sum((int(a), int(b)))
a = int(input())
b = str(input())
(c, u) = t(b)
if u[0] != '0':
	print(sum((int(c), int(u))))
else:
	print(min(f1(c, u), f2(c, u)))


from sys import stdin
[_, l] = stdin.readlines()
q = list()
l = l.strip()
for i in range(1, len(l)):
	if l[i] != '0':
		q.append((abs(2 * i - len(l)), i))
	if len(q) > 3:
		q.sort(key=lambda v: v[0])
		q = q[:4]
print(min([int(l[:i]) + int(l[i:]) for (_, i) in q]))


n = int(input())
s = input()
l = sorted(((abs(n / 2 - i), i) for i in range(1, n) if s[i] != '0'))
print(min((int(s[:i]) + int(s[i:]) for (v, i) in l[:2])))


import sys
from math import *
from fractions import gcd
readints = lambda : map(int, input().strip('\n').split())
n = int(input())
s = input()
l = n // 2
r = (n + 1) // 2
while s[l] == '0':
	l -= 1
while r < n and s[r] == '0':
	r += 1
ans = int(s)
if l > 0:
	ans = min(ans, int(s[:l]) + int(s[l:]))
if r < n:
	ans = min(ans, int(s[:r]) + int(s[r:]))
print(ans)


n = int(input())
x = input()
ans = -1
options = []
for i in range(len(x)):
	if x[i] != '0':
		options.append(i)
start = len(options) - 1
for i in range(len(options)):
	if options[i] >= n // 2:
		start = i
		break
for i in range(3):
	for ind in [start + i, start - i]:
		if ind < 0 or ind >= len(options):
			continue
		pos = options[ind]
		if pos <= 0 or pos >= n:
			continue
		option = int(x[:pos]) + int(x[pos:])
		if ans == -1 or option < ans:
			ans = option
print(ans)


l = int(input())
n = input()
x = l // 2
while n[x] == '0':
	x += 1
	if x == l:
		break
y = l // 2
while n[y] == '0':
	y -= 1
A = 10 ** 101
B = A
C = A
if y != 0:
	A = int(n[:y]) + int(n[y:])
if x != l:
	B = int(n[:x]) + int(n[x:])
if x < l - 1 and n[x + 1] != '0':
	C = int(n[:x + 1]) + int(n[x + 1:])
print(min(A, B, C))


l = int(input())
n = int(input())
min_sum = -1
n_str = str(n)
l = len(n_str) // 2
r = (len(n_str) + 1) // 2
while True:
	if n_str[l] == '0' and n_str[r] == '0':
		l -= 1
		r += 1
		continue
	elif n_str[l] != '0' and n_str[r] != '0':
		a = int(n_str[:l]) + int(n_str[l:])
		b = int(n_str[:r]) + int(n_str[r:])
		if a > b:
			min_sum = b
		else:
			min_sum = a
		break
	elif n_str[l] == '0':
		min_sum = int(n_str[:r]) + int(n_str[r:])
		break
	elif n_str[r] == '0':
		min_sum = int(n_str[:l]) + int(n_str[l:])
		break
print(min_sum)


l = int(input())
n = input()
s = 10 ** 100000 * 9 + 1
mid = l // 2
c = 0
while mid >= 1:
	if n[mid] == '0':
		mid -= 1
		continue
	x1 = int(n[0:mid])
	x2 = int(n[mid:])
	s2 = x1 + x2
	if s2 < s:
		s = s2
	c += 1
	mid -= 1
	if c == 3:
		break
mid = l // 2 + 1
c = 0
while mid < l:
	if n[mid] == '0':
		mid += 1
		continue
	x1 = int(n[0:mid])
	x2 = int(n[mid:])
	s2 = x1 + x2
	if s2 < s:
		s = s2
	c += 1
	mid += 1
	if c == 3:
		break
print(s)


def get(i):
	s1 = s[0:i]
	s2 = s[i:n]
	j = 0
	while j < len(s2) and s2[j] == '0':
		j += 1
	k = i - 1
	while k >= 0 and s1[k] == '0':
		k -= 1
	if j == len(s2):
		a = int(s)
	else:
		a = int(s1 + '0' * j) + int(s2[j:len(s2)])
	if k == 0:
		b = int(s1[k:len(s1)] + s2)
	else:
		b = int(s[0:k]) + int(s[k:len(s)])
	return min(a, b)
n = int(input())
s = input()
s1 = ''
s2 = ''
if n % 2 == 0:
	print(get(n // 2))
else:
	print(min(get(n // 2), get(n // 2 + 1)))


import string
n = int(input())
s = input()
ans = 0
d1 = int(n / 2) + 1
while d1 < n - 1 and s[d1] == '0':
	d1 = d1 + 1
d2 = int(n / 2)
while d2 > 0 and s[d2] == '0':
	d2 = d2 - 1
if d1 == n or int(s[d1:n]) == 0:
	print(int(s[0:d2]) + int(s[d2:n]))
elif d2 == 0 or int(s[0:d2]) == 0:
	print(int(s[0:d1]) + int(s[d1:n]))
else:
	print(min(int(s[0:d2]) + int(s[d2:n]), int(s[0:d1]) + int(s[d1:n])))


import sys, heapq as h
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input().strip()

def listStr():
	return list(input().strip())
import collections as col
import math

def solve():
	L = getInt()
	A = getStr()
	left_len = L // 2 - (L % 2 == 0)
	right_len = left_len + 1
	left_flag = True
	right_flag = True
	while A[left_len] == '0':
		left_len -= 1
	if left_len == 0:
		left_flag = False
	while right_len < L and A[right_len] == '0':
		right_len += 1
	if right_len == L:
		right_flag = False
	if not left_flag:
		return int(A[:right_len]) + int(A[right_len:])
	if not right_flag:
		return int(A[:left_len]) + int(A[left_len:])
	return min(int(A[:right_len]) + int(A[right_len:]), int(A[:left_len]) + int(A[left_len:]))
print(solve())


def gns():
	return list(map(int, input().split()))
n = int(input())
s = input()

def sm(x):
	ans = []
	l = 0
	(i, j) = (x, n - 1)
	while i >= 0 or j > x:
		if i >= 0:
			si = s[i]
		else:
			si = 0
		sj = s[j] if j > x else 0
		t = int(si) + int(sj) + l
		l = t // 10
		t = t % 10
		ans.append(t)
		i -= 1
		j -= 1
	if ans[-1] == 0:
		ans.pop()
	return ans

def cm(x, y):
	if len(x) > len(y):
		return True
	if len(y) > len(x):
		return False
	i = len(x) - 1
	while i >= 0:
		if x[i] > y[i]:
			return True
		elif x[i] == y[i]:
			i -= 1
			continue
		else:
			return False

def r(x):
	print(''.join(map(str, x[::-1])))
if n % 2 == 0:
	m = n // 2 - 1
	(x, y) = (m, m)
else:
	m = n // 2
	(x, y) = (m - 1, m)
if True:
	while x >= 0 and y < n and (s[x + 1] == '0') and (s[y + 1] == '0'):
		x -= 1
		y += 1
	if s[x + 1] != '0' and s[y + 1] != '0':
		smx = sm(x)
		smy = sm(y)
		if cm(smx, smy):
			r(smy)
			quit()
		else:
			r(smx)
			quit()
	elif s[x + 1] != '0':
		smx = sm(x)
		r(smx)
		quit()
	elif s[y + 1] != '0':
		smy = sm(y)
		r(smy)
		quit()


len = int(input())
s = input()
ans = int(s)
for i in range((len - 1) // 2, 0, -1):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
for i in range(len // 2 + 1, len):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
if len % 2 == 0 and s[len // 2] != '0':
	i = len // 2
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


l = int(input())
s = input()
mi = int(s)
mid = l // 2
while mid < l:
	if s[mid] == '0':
		mid += 1
	else:
		break
if mid < l:
	mi = min(mi, int(s[:mid]) + int(s[mid:]))
mid = l // 2 + 1
while mid < l:
	if s[mid] == '0':
		mid += 1
	else:
		break
if mid < l:
	mi = min(mi, int(s[:mid]) + int(s[mid:]))
mid = l // 2 - 1
while mid >= 0:
	if s[mid] == '0':
		mid -= 1
	else:
		break
if mid > 0:
	mi = min(mi, int(s[:mid]) + int(s[mid:]))
print(mi)


import math
a = int(input())
b = list(input())
mid = a // 2
if a % 2 == 0:
	mid -= 1
pre = a
back = 0
for i in range(mid, -1, -1):
	if b[i] != '0' and b[i + 1] != '0':
		pre = i
		break
for i in range(mid, a):
	if b[i] != '0':
		back = i
		break
x = 0
y = 0
ans = 1e309
if pre != a:
	for i in range(pre + 1):
		x = x * 10 + int(b[i])
	for i in range(pre + 1, a):
		y = y * 10 + int(b[i])
	ans = min(ans, x + y)
if back != 0:
	x = y = 0
	for i in range(back):
		x = x * 10 + int(b[i])
	for i in range(back, a):
		y = y * 10 + int(b[i])
	ans = min(ans, x + y)
print(ans)


n = int(input())
s = input()
f = int(s)
ans = f
c = 0
for i in range(n // 2, n, 1):
	if s[i] != '0':
		c += 1
		a = f // 10 ** (n - i)
		b = f % 10 ** (n - i)
		ans = min(ans, a + b)
		if c >= 2:
			break
c = 0
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		c += 1
		a = f // 10 ** (n - i)
		b = f % 10 ** (n - i)
		ans = min(ans, a + b)
		if c >= 2:
			break
print(ans)


def solution(s):
	k = 1
	while s[k] == '0':
		k += 1
	maxsize = max(k, len(s) - k)
	anscut = k
	for i in range(k, len(s) - 1):
		if s[i] != '0':
			if max(i, len(s) - i) < maxsize or (max(i, len(s) - i) == maxsize and int(s[:i]) + int(s[i:]) < int(s[:anscut]) + int(s[anscut:])):
				maxsize = max(i, len(s) - i)
				anscut = i
	return int(s[:anscut]) + int(s[anscut:])
N = int(input())
s = input()
print(solution(s))


def solve(n, l):
	m = l // 2
	cnd = []
	for i in range(m, l):
		if n[i] != '0' and len(cnd) < 3:
			cnd.append(i)
	for i in range(m, 0, -1):
		if n[i] != '0' and len(cnd) < 6:
			cnd.append(i)

	def get(s, i):
		s1 = s[0:i]
		s2 = s[i:]
		return int(s1) + int(s2)
	ans = -1
	for i in cnd:
		if ans == -1:
			ans = get(n, i)
		ans = min(ans, get(n, i))
	return ans

def solves(n, l):
	m = l // 2
	cnd = []
	for i in range(m, l):
		if n[i] != '0' and len(cnd) < 3:
			cnd.append(i)
	for i in range(m, -1):
		if n[i] != '0' and len(cnd) < 6:
			cnd.append(i)

	def get(s, i):
		s1 = s[0:i]
		s2 = s[i:]
		return int(s1) + int(s2)
	ans = -1
	for i in range(1, l):
		if n[i] != '0':
			if ans == -1:
				ans = get(n, i)
			ans = min(ans, get(n, i))
	return ans
l = int(input())
n = input()
print(solve(n, l))


n = int(input())
s = input()
len = 1000000
ans = int(s)
for i in range(0, n - 1):
	if s[i + 1] is not '0':
		len = min(max(i + 1, n - i - 1), len)
for i in range(0, n - 1):
	if max(i + 1, n - i - 1) == len and s[i + 1] is not '0':
		ans = min(ans, int(s[0:i + 1]) + int(s[i + 1:n]))
print(ans)


def calc(s, pos):
	A = s[0:pos]
	B = s[pos:]
	return int(A) + int(B)
n = input()
s = input()
n = int(n)
result = int(s)
n2 = n // 2
ctr = 0
for i in range(n // 2, 0, -1):
	if s[i] == '0':
		continue
	ctr += 1
	if ctr == 4:
		break
	val = calc(s, i)
	result = min(result, val)
ctr = 0
for i in range(n // 2, n, 1):
	if s[i] == '0':
		continue
	ctr += 1
	if ctr == 4:
		break
	val = calc(s, i)
	result = min(result, val)
print(result)


n = int(input())
s = str(input())
ans = int(s)
left = n // 2
right = (n + 1) // 2
while left > 0 and s[left] == '0':
	left = left - 1
while right < n and s[right] == '0':
	right = right + 1
if left >= 1:
	ans = min(ans, int(s[:left]) + int(s[left:]))
if right <= n - 1:
	ans = min(ans, int(s[:right]) + int(s[right:]))
print(ans)


l = int(input())
n = str(input())

def sum(x):
	return int(n[:x]) + int(n[x:])
if l % 2 == 0:
	left = l // 2 - 1
	right = l // 2
	while n[left] == '0':
		left -= 1
	while right < l and n[right] == '0':
		right += 1
	if right - left == 1:
		print(sum(right))
	elif right == l:
		if left == 0:
			print(n)
		else:
			print(sum(left))
	elif left == 0:
		print(sum(right))
	else:
		print(min(sum(right), sum(left)))
else:
	left = l // 2 - 1
	right = l // 2
	while n[left] == '0':
		left -= 1
	while right < l and n[right] == '0':
		right += 1
	if right - left == 1:
		if n[right + 1] != '0':
			print(min(sum(right), sum(right + 1)))
		else:
			print(sum(right))
	elif right == l:
		if left == 0:
			print(n)
		else:
			print(sum(left))
	elif left == 0:
		print(sum(right))
	else:
		print(min(sum(right), sum(left)))


n = int(input())
S = str(input()).strip()
ans = int(S)
l = n // 2
r = n // 2
while l >= 0 and S[l] == '0':
	l -= 1
while r < len(S) and S[r] == '0':
	r += 1
for i in [l, r]:
	for j in range(max(i - 2, 1), min(len(S), i + 2)):
		if S[j] != '0':
			ans = min(ans, int(S[:j]) + int(S[j:]))
print(ans)


l = int(input())
n = input()
k = l // 2
c = float('inf')
for i in range(k, 0, -1):
	if n[i] != '0':
		a = int(n[:i])
		b = int(n[i:])
		c = a + b
		break
for i in range(k + 1, l):
	if n[i] != '0':
		d = int(n[:i])
		f = int(n[i:])
		g = d + f
		c = min(c, g)
		break
print(c)


n = int(input())
s = input()
ans = int(s)
ind = set()
for i in range(0, n):
	if s[i] != '0':
		ind.add(i)
(L, R) = (False, False)
for i in range(0, n):
	if n // 2 - i > 0 and (not L):
		if n // 2 - i in ind:
			ans = min(ans, int(s[:n // 2 - i]) + int(s[n // 2 - i:]))
			L = True
	if n // 2 + i < n and (not R):
		if n // 2 + i in ind:
			ans = min(ans, int(s[:n // 2 + i]) + int(s[n // 2 + i:]))
			if i:
				R = True
	if L and R:
		break
print(ans)


from math import floor
n = int(input())
string = input()
if n % 2 == 0:
	str1 = string[0:floor(n / 2)]
	str2 = string[floor(n / 2):]
	if str2[0] == '0':
		kol = 1
		i = floor(n / 2) - 1
		while str1[i] == '0':
			kol = kol + 1
			i = i - 1
		kol2 = 0
		z = 0
		while z < len(str2) and str2[z] == '0':
			kol2 = kol2 + 1
			z = z + 1
		new1 = string[0:floor(n / 2) - kol]
		new2 = string[floor(n / 2) - kol:]
		new3 = string[0:floor(n / 2) + kol2]
		new4 = string[floor(n / 2) + kol2:]
		if new4 == '':
			final = int(new1) + int(new2)
		else:
			final = min(int(new1) + int(new2), int(new3) + int(new4))
		print(final)
	else:
		print(int(str1) + int(str2))
else:
	str1 = string[0:floor(n / 2)]
	str2 = string[floor(n / 2):]
	str3 = string[0:floor(n / 2) + 1]
	str4 = string[floor(n / 2) + 1:]
	if str2[0] != '0' and str4[0] != '0':
		final = min(int(str1) + int(str2), int(str3) + int(str4))
		print(final)
	elif str2[0] == '0' and str4[0] == '0':
		kol = 1
		i = floor(n / 2) - 1
		while str1[i] == '0':
			kol = kol + 1
			i = i - 1
		kol2 = 0
		z = 0
		while z < len(str2) and str2[z] == '0':
			kol2 = kol2 + 1
			z = z + 1
		new1 = string[0:floor(n / 2) - kol]
		new2 = string[floor(n / 2) - kol:]
		new3 = string[0:floor(n / 2) + kol2]
		new4 = string[floor(n / 2) + kol2:]
		if new4 == '':
			final1 = int(new1) + int(new2)
		else:
			final1 = min(int(new1) + int(new2), int(new3) + int(new4))
		kol = 1
		i = floor(n / 2)
		while str3[i] == '0':
			kol = kol + 1
			i = i - 1
		z = 0
		kol2 = 0
		while z < len(str4) and str4[z] == '0':
			kol2 = kol2 + 1
			z = z + 1
		new1 = string[0:floor(n / 2) - kol + 1]
		new2 = string[floor(n / 2) - kol + 1:]
		new3 = string[0:floor(n / 2) + 1 + kol2]
		new4 = string[floor(n / 2) + kol2 + 1:]
		if new4 == '':
			final2 = int(new1) + int(new2)
		else:
			final2 = min(int(new1) + int(new2), int(new3) + int(new4))
		print(min(final1, final2))
	else:
		if str2[0] == '0' and str4[0] != '0':
			final = int(str3) + int(str4)
		elif str4[0] == '0' and str2[0] != '0':
			final = int(str1) + int(str2)
		print(final)


n = int(input())
a = input()
ans = None
i = n // 2
for q in range(n // 2):
	if a[:i + q][0] != '0' and a[i + q:][0] != '0':
		if ans is None:
			ans = int(a[:i + q]) + int(a[i + q:])
		else:
			ans = min(ans, int(a[:i + q]) + int(a[i + q:]))
	if a[:i - q][0] != '0' and a[i - q:][0] != '0':
		if ans is None:
			ans = int(a[:i - q]) + int(a[i - q:])
		else:
			ans = min(ans, int(a[:i - q]) + int(a[i - q:]))
	if not ans is None:
		break
ans1 = ans
if n & 1:
	i += 1
	ans = None
	for q in range(n // 2):
		if a[:i + q][0] != '0' and a[i + q:][0] != '0':
			if ans is None:
				ans = int(a[:i + q]) + int(a[i + q:])
			else:
				ans = min(ans, int(a[:i + q]) + int(a[i + q:]))
		if a[:i - q][0] != '0' and a[i - q:][0] != '0':
			if ans is None:
				ans = int(a[:i - q]) + int(a[i - q:])
			else:
				ans = min(ans, int(a[:i - q]) + int(a[i - q:]))
		if not ans is None:
			break
if ans is None:
	print(ans1)
elif ans1 is None:
	print(ans)
else:
	print(min(ans, ans1))


n = int(input())
s = input()
l = n // 2
i = l
j = l + 1
k1 = 0
k2 = 0
while i > 0 and s[i] == '0':
	i -= 1
while j < n and s[j] == '0':
	j += 1
if j != n:
	k2 = int(s[:j]) + int(s[j:])
if i == 0:
	print(k2)
elif j == n:
	k1 = int(s[:i]) + int(s[i:])
	print(k1)
else:
	k1 = int(s[:i]) + int(s[i:])
	print(min(k1, k2))


l = int(input())
n = input()
mid = l // 2

def f(pos):
	if pos == 0 or pos == l or n[pos] == '0':
		return False
	return True
arr = []
for i in range((l + 1) // 2):
	pos = mid - i
	if not (pos == 0 or pos == l or n[pos] == '0'):
		arr.append(pos)
	pos = mid + i
	if not (pos == 0 or pos == l or n[pos] == '0'):
		arr.append(pos)
	if len(arr) > 2:
		break
best_ans = int(n + '00')
for pos in arr:
	ans = int(n[:pos]) + int(n[pos:])
	best_ans = min(best_ans, ans)
print(best_ans)


n = int(input())
a = input()
ans = -1
if n % 2 == 0:
	if a[n // 2:][0] == '0':
		(ans0, ans1) = (-1, -1)
		i = n // 2
		while a[i] == '0':
			i -= 1
		if len(a[:i]) != 0:
			ans0 = int(a[:i]) + int(a[i:])
		else:
			ans0 = int(a[i:])
		i = n // 2
		while i < n and a[i] == '0':
			i += 1
		if len(a[i:]) != 0:
			ans1 = int(a[:i]) + int(a[i:])
		else:
			ans1 = int(a[:i])
		ans = min(ans0, ans1)
	else:
		ans = int(a[:n // 2]) + int(a[n // 2:])
else:
	(ans0, ans1) = (-1, -1)
	if a[n // 2:][0] == '0':
		(ans00, ans01) = (-1, -1)
		i = n // 2
		while a[i] == '0':
			i -= 1
		if len(a[:i]) != 0:
			ans00 = int(a[:i]) + int(a[i:])
		else:
			ans00 = int(a[i:])
		i = n // 2
		while i < n and a[i] == '0':
			i += 1
		if len(a[i:]) != 0:
			ans01 = int(a[:i]) + int(a[i:])
		else:
			ans01 = int(a[:i])
		ans0 = min(ans00, ans01)
	else:
		ans0 = int(a[:n // 2]) + int(a[n // 2:])
	if a[n // 2 + 1:][0] == '0':
		(ans10, ans11) = (-1, -1)
		i = n // 2 + 1
		while a[i] == '0':
			i -= 1
		if len(a[:i]) != 0:
			ans10 = int(a[:i]) + int(a[i:])
		else:
			ans10 = int(a[i:])
		i = n // 2 + 1
		while i < n and a[i] == '0':
			i += 1
		if len(a[i:]) != 0:
			ans11 = int(a[:i]) + int(a[i:])
		else:
			ans11 = int(a[:i])
		ans1 = min(ans10, ans11)
	else:
		ans1 = int(a[:n // 2 + 1]) + int(a[n // 2 + 1:])
	ans = min(ans0, ans1)
print(ans)


def sum(a, b):
	if len(a) < len(b):
		(a, b) = (b, a)
	k = len(a) - 1
	k2 = len(b) - 1
	i = k
	j = k2
	ost = 0
	while j >= 0:
		sum = int(b[j]) + int(a[i]) + ost
		ost = sum // 10
		sum %= 10
		a[i] = str(sum)
		i -= 1
		j -= 1
	while i >= 0 and ost != 0:
		sum = int(a[i]) + ost
		ost = sum // 10
		sum %= 10
		a[i] = str(sum)
		i -= 1
	if ost != 0:
		a = str(ost) + ''.join(a)
	else:
		a = ''.join(a)
	return a

def greather(a, b):
	if len(a) < len(b):
		return a
	elif len(b) < len(a):
		return b
	else:
		k = 0
		while k < len(a) and a[k] == b[k]:
			k += 1
		if k == len(a):
			return a
		elif a[k] < b[k]:
			return a
		else:
			return b

def work(s, bound):
	c = list(s)
	if c[bound] != '0':
		a = c[:bound]
		b = c[bound:]
		return sum(a, b)
	else:
		k = bound
		while k >= 0 and c[k] == '0':
			k -= 1
		if k > 0:
			a = c[:k]
			b = c[k:]
			x = sum(a, b)
		else:
			x = ''
		k = bound
		while k < len(c) and c[k] == '0':
			k += 1
		if k < len(c):
			a = c[:k]
			b = c[k:]
			y = sum(a, b)
		else:
			y = ''
		if x == '' and y != '':
			return y
		elif x != '' and y == '':
			return x
		elif x == '' and y == '':
			return ''.join(c)
		else:
			return greather(x, y)
n = int(input())
s = input()
if n % 2 == 0:
	bound = n // 2
	rez = work(s, bound)
else:
	bound = n // 2 + 1
	rez1 = work(s, bound)
	bound = n // 2
	rez2 = work(s, bound)
	rez = greather(rez1, rez2)
print(rez)


l = int(input())
n = input()
ans = -1
for i in range(int((l - 1) / 2), -1, -1):
	if n[i + 1] != '0':
		a = int(n[0:i + 1])
		b = int(n[i + 1:l])
		if ans == -1 or a + b < ans:
			ans = a + b
		if i != int((l - 1) / 2):
			break
for i in range(int((l - 1) / 2) + 1, l - 1, 1):
	if n[i + 1] != '0':
		a = int(n[0:i + 1])
		b = int(n[i + 1:l])
		if ans == -1 or a + b < ans:
			ans = a + b
		break
print(ans)


t = int(input())
n = input()
ans = int(n)
end = (t - 1) // 2
for i in range(end, -1, -1):
	if n[i + 1] == '0':
		continue
	ans = min(ans, int(n[0:i + 1])) + int(n[i + 1:])
	break
end = t // 2
for i in range(end, t):
	if n[i] == '0':
		continue
	temp = int(n[:i]) + int(n[i:])
	if temp < ans:
		ans = temp
	break
print(ans)


def calc(line, pos):
	if pos == len(line):
		return int(line)
	if line[pos] != '0' or pos == 0 or pos == len(line) - 1:
		L = line[:pos] if pos != 0 else 0
		R = line[pos:]
		if L == '0' or R == '0':
			return pow(10, 200000)
		return int(L) + int(R)
	else:
		right = left = pos
		while right < len(line) and line[right] == '0':
			right += 1
		while left >= 0 and line[left] == '0':
			left -= 1
		if right == len(line):
			right = len(line) - 1
		if left < 0:
			left = 0
		return min(calc(line, left), calc(line, right))
input()
line = input()
pos = len(line) // 2
answer = min(calc(line, pos), calc(line, pos + 1))
print(answer)


import sys
mod = 1000000007
get_arr = lambda : list(map(int, input().split()))
get_int = lambda : int(input())
get_ints = lambda : map(int, input().split())
get_str = lambda : input()
get_strs = lambda : input().split()
n = get_int()
s = get_str()
ans = int(s)
j = 0
for i in range(n // 2, n):
	if j > 3:
		break
	if s[i] == '0':
		continue
	ans = min(ans, int(s[:i]) + int(s[i:]))
	j += 1
j = 0
for i in range(n // 2, 0, -1):
	if j > 3:
		break
	if s[i] == '0':
		continue
	ans = min(ans, int(s[:i]) + int(s[i:]))
	j += 1
print(ans)


l = int(input())
num = str(input())
n = int(num)
x = len(num)
mns = n * 100
h = (x - 1) // 2

def test(i):
	s = int(num[:i]) + int(num[i:])
	if s < mns:
		return s
	return mns
ct = 0
for i in range(h, -1, -1):
	if num[i] != '0' and i > 0:
		mns = test(i)
		ct += 1
	if ct >= 3:
		break
ct = 0
for i in range(h + 1, x):
	if num[i] != '0':
		mns = test(i)
		ct += 1
	if ct >= 3:
		break
print(mns)


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	n = ii()
	s = li()
	if n % 2 == 0:
		if s[n // 2] != '0':
			print(int(''.join(s[:n // 2])) + int(''.join(s[n // 2:])))
		else:
			ind = n // 2
			high = -19999999999
			for i in range(ind, n):
				if s[i] != '0':
					high = i
					break
			low = -199999999999
			for i in range(ind, -1, -1):
				if s[i] != '0':
					low = i
					break
			if low == 0:
				print(int(''.join(s[:high])) + int(''.join(s[high:])))
			elif high == -19999999999:
				print(int(''.join(s[:low])) + int(''.join(s[low:])))
			else:
				print(min(int(''.join(s[:low])) + int(''.join(s[low:])), int(''.join(s[:high])) + int(''.join(s[high:]))))
	elif s[n // 2] != '0':
		print(min(int(''.join(s[:n // 2])) + int(''.join(s[n // 2:])), int(''.join(s[:(n + 1) // 2])) + int(''.join(s[(n + 1) // 2:]))))
	else:
		ind = n // 2
		high = -19999999999
		for i in range(ind, n):
			if s[i] != '0':
				high = i
				break
		low = -199999999999
		for i in range(ind, -1, -1):
			if s[i] != '0':
				low = i
				break
		if low == 0:
			print(int(''.join(s[:high])) + int(''.join(s[high:])))
		elif high == -19999999999:
			print(int(''.join(s[:low])) + int(''.join(s[low:])))
		else:
			print(min(int(''.join(s[:low])) + int(''.join(s[low:])), int(''.join(s[:high])) + int(''.join(s[high:]))))
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


l = int(input())
inf = 10 ** 10 ** 5 + 1
n = input()
if l % 2:
	k1 = l // 2
	while n[k1] == '0':
		k1 -= 1
	if k1:
		n1 = int(n[:k1]) + int(n[k1:])
	else:
		n1 = inf
	k2 = l // 2 + 1
	while n[k2] == '0':
		k2 += 1
		if k2 == l:
			n2 = inf
			break
	else:
		n2 = int(n[:k2]) + int(n[k2:])
	print(min(n1, n2))
else:
	k1 = l // 2
	while n[k1] == '0':
		k1 -= 1
	if k1:
		n1 = int(n[:k1]) + int(n[k1:])
	else:
		n1 = inf
	k2 = l // 2 + 1
	while n[k2] == '0':
		k2 += 1
		if k2 == l:
			n2 = inf
			break
	else:
		n2 = int(n[:k2]) + int(n[k2:])
	print(min(n1, n2))


n = int(input())
s = input()
i = int(n / 2)
while i != 0:
	a = i
	b = n - a
	(total1, total2) = (-1, -1)
	if s[a] != '0':
		total1 = int(s[0:a]) + int(s[a:])
	if s[b] != '0':
		total2 = int(s[0:b]) + int(s[b:])
	if total1 != -1 and total2 != -1:
		print(min(total1, total2))
		break
	if total1 != -1:
		print(total1)
		break
	if total2 != -1:
		print(total2)
		break
	i -= 1


n = int(input())
str = input()
res = 10 ** 123456
midig = 123456
for i in range(1, n):
	if str[i] != '0':
		nowdig = max(i, n - i)
		if nowdig <= midig:
			midig = nowdig
for i in range(1, n):
	if str[i] != '0':
		nowdig = max(i, n - i)
		if nowdig <= midig:
			res = min(res, int(str[0:i]) + int(str[i:]))
print(res)


n = int(input())
m = input()
k = n // 2
l = n // 2
if n == 1:
	print(m)
elif n == 2:
	print(int(m) // 10 + int(m) % 10)
elif n % 2 == 0:
	while m[k] == '0':
		k -= 1
	while l < n and m[l] == '0':
		l += 1
	if k == 0:
		s = int(m)
	else:
		s = int(m[:k]) + int(m[k:])
	if l == n:
		t = int(m)
	else:
		t = int(m[l:]) + int(m[:l])
	print(min(s, t))
elif n % 2 != 0:
	if m[k] != '0' and m[k + 1] != '0':
		s = int(m[:k]) + int(m[k:])
		t = int(m[:k + 1]) + int(m[k + 1:])
		print(min(s, t))
	elif m[k] == '0':
		while m[k] == '0':
			k -= 1
		while l < n and m[l] == '0':
			l += 1
		if k == 0:
			s = int(m)
		else:
			s = int(m[:k]) + int(m[k:])
		if l == n:
			t = int(m)
		else:
			t = int(m[l:]) + int(m[:l])
		print(min(s, t))
	elif m[k + 1] == '0':
		print(int(m[:k]) + int(m[k:]))


import sys
input = sys.stdin.readline

def calc(s, i):
	p1 = s[:i]
	p2 = s[i:]
	return int(p1) + int(p2)
n = int(input())
s = input().strip()
if n == 2:
	print(int(s[0]) + int(s[1]))
else:
	res = int(s)
	cnt = 0
	for i in range((n - 1) // 2, 0, -1):
		if s[i] != '0':
			res = min(res, calc(s, i))
			cnt += 1
		if cnt >= 3:
			break
	for i in range((n - 1) // 2, n):
		if s[i] != '0':
			res = min(res, calc(s, i))
			cnt += 1
		if cnt >= 6:
			break
	print(res)


l = int(input())
s = input()
ans = 10 ** 100005
(l1, l2) = (l // 2, (l + 1) // 2)
check = False
while True:
	if s[l1] != '0':
		check = True
		m1 = int(s[:l1])
		m2 = int(s[l1:])
		b = m1 + m2
		ans = min(ans, b)
	if s[l2] != '0':
		check = True
		m1 = int(s[:l2])
		m2 = int(s[l2:])
		b = m1 + m2
		ans = min(ans, b)
	if check == True:
		print(ans)
		break
	l1 = l1 - 1
	l2 = l2 + 1


n = int(input())
s = input()
if '0' not in s:
	if n % 2 == 0:
		print(int(s[:n // 2]) + int(s[n // 2:]))
	else:
		print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 + 1]) + int(s[n // 2 + 1:])))
else:
	right = -1
	left = -1
	for i in range(n // 2, -1, -1):
		if s[i] != '0':
			left = i
			break
	for i in range(n // 2, n):
		if s[i] != '0':
			right = i
			break
	ans1 = int(s[left:])
	if left != 0:
		ans1 += int(s[0:left])
	an2 = int(s[right:]) + int(s[0:right])
	if right == -1:
		an2 = ans1
	print(min(ans1, an2))


l = int(input())
s = input()
res = None
noimp = 0
for it in range(l - 1):
	i = 0
	if it % 2 == 0:
		i = l // 2 - (it + 1) // 2
	else:
		i = l // 2 + (it + 1) // 2
	if s[i] == '0':
		continue
	cur = int(s[0:i]) + int(s[i:])
	if res is None:
		res = cur
	elif cur < res:
		res = cur
	else:
		noimp += 1
	if noimp >= 4:
		break
print(res)


l = int(input())
num = input()
ans = int(num)
m = l // 2
for i in range(m, l - 1):
	if num[i + 1] != '0':
		ans = min(ans, int(num[0:i + 1]) + int(num[i + 1:l]))
		break
for i in range(m, 0, -1):
	if num[i] != '0':
		ans = min(ans, int(num[0:i]) + int(num[i:l]))
		break
print(ans)


l = eval(input())
s = input()
mid = int((l + 1) // 2)
mn = 10 ** 100010
for i in range(mid, l):
	if s[i] != '0':
		mn = min(mn, int(s[:i]) + int(s[i:]))
		break
for i in range(mid - 1, 0, -1):
	if s[i] != '0':
		mn = min(mn, int(s[:i]) + int(s[i:]))
		break
print(mn)


def sum(str, i):
	if i <= 0 or i == len(str):
		return int(str)
	return int(str[0:i]) + int(str[i:len(str)])

def main():
	n = int(input())
	str = input()
	middle = int(len(str) / 2)
	result = int(str)
	for i in range(middle, -1, -1):
		if str[i] != '0':
			result = min(result, sum(str, i))
			break
	for i in range(middle + 1, len(str)):
		if str[i] != '0':
			result = min(result, sum(str, i))
			break
	print(result)
main()


from sys import stdin
input = stdin.readline
l = int(input())
n = input().rstrip()
if l % 2 == 0:
	i = l // 2
elif int(n[0]) == int(n[l // 2 + 1]):
	if int(n[:l // 2]) <= int(n[l // 2 + 1:]):
		i = l // 2 + 1
	else:
		i = l // 2
elif int(n[0]) > int(n[l // 2 + 1]):
	i = l // 2
else:
	i = l // 2 + 1
j = i - 1
while n[i] == '0' and i < l - 1:
	i += 1
while n[j] == '0' and j > 1:
	j -= 1
if j == 0 or (j == 1 and n[j] == '0'):
	print(int(n[:i]) + int(n[i:]))
elif i == l - 1 and n[i] == '0':
	print(int(n[:j]) + int(n[j:]))
else:
	print(min(int(n[:i]) + int(n[i:]), int(n[:j]) + int(n[j:])))


n = int(input())
m = input()
mi = 100001
for i in range(1, n):
	if m[i] != '0':
		mi = min(mi, max(i, n - i) - min(i, n - i))
res = -1
for i in range(1, n):
	if m[i] != '0' and mi == max(i, n - i) - min(i, n - i):
		if res == -1:
			res = int(m[:i]) + int(m[i:])
		else:
			res = min(res, int(m[:i]) + int(m[i:]))
print(res)


n = int(input())
s = input()
if len(s) == 2:
	print(int(s[0]) + int(s[1]))
	exit(0)
met = len(s) // 2
if s[n // 2] != '0' and s[n // 2 + 1] != '0' and (s[n // 2 - 1 + (n == 3)] != '0'):
	print(min(int(s[:n // 2 + 1]) + int(s[n // 2 + 1:]), min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 - 1 + (n == 3)]) + int(s[n // 2 - 1 + (n == 3):]))))
	exit(0)
elif s[n // 2 + 1] != '0' and s[n // 2] != '0':
	print(min(int(s[:n // 2 + 1]) + int(s[n // 2 + 1:]), int(s[:n // 2]) + int(s[n // 2:])))
	exit(0)
elif s[n // 2] != '0' and s[n // 2 - 1 + (n == 3)] != '0':
	print(min(int(s[:n // 2]) + int(s[n // 2:]), int(s[:n // 2 - 1 + (n == 3)]) + int(s[n // 2 - 1 + (n == 3):])))
	exit(0)
elif s[n // 2 + 1] != '0' and s[n // 2 - 1 + (n == 3)] != '0':
	print(min(int(s[:n // 2 + 1]) + int(s[n // 2 + 1:]), int(s[:n // 2 - 1 + (n == 3)]) + int(s[n // 2 - 1 + (n == 3):])))
	exit(0)
elif s[n // 2] != '0':
	print(int(s[:n // 2]) + int(s[n // 2:]))
	exit(0)
elif s[n // 2 + 1] != '0':
	print(int(s[:n // 2 + 1]) + int(s[n // 2 + 1:]))
	exit(0)
elif s[n // 2 - 1 + (n == 3)] != '0':
	print(int(s[:n // 2 - 1 + (n == 3)]) + int(s[n // 2 - 1 + (n == 3):]))
	exit(0)
ult = n + 1
ult2 = -1
for i in range(n // 2, len(s)):
	if s[i] != '0':
		ult = min(ult, i)
for i in range(0, n // 2):
	if s[i] != '0':
		ult2 = i
if ult != n + 1 and ult2 != -1:
	print(min(int(s[:ult]) + int(s[ult:]), int(s[:ult2]) + int(s[ult2:])))
elif ult != n + 1:
	print(int(s[:ult]) + int(s[ult:]))
elif ult2 != -1:
	print(int(s[:ult2]) + int(s[ult2:]))


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j
c = cinn()
l = c.cin()
n = c.cin(str)
if l % 2 == 0:
	k = l // 2
	if n[k] != '0':
		print(int(n[0:k]) + int(n[k:l]))
	else:
		right = k
		left = k - 1
		while n[right] == '0':
			right += 1
			if right == l:
				right = 'ok'
				break
		while n[left] == '0':
			left -= 1
		if right == 'ok':
			print(int(n[0:left]) + int(n[left:l]))
		elif left == 0:
			print(int(n[0:right]) + int(n[right:l]))
		else:
			t1 = int(n[0:left]) + int(n[left:l])
			t2 = int(n[0:right]) + int(n[right:l])
			print(min(t1, t2))
else:
	k = l // 2
	left = k
	right = k + 1
	while n[right] == '0':
		right += 1
		if right == l:
			right = 'ok'
			break
	while n[left] == '0':
		left -= 1
	if right == 'ok':
		print(int(n[0:left]) + int(n[left:l]))
	elif left == 0:
		print(int(n[0:right]) + int(n[right:l]))
	else:
		t1 = int(n[0:left]) + int(n[left:l])
		t2 = int(n[0:right]) + int(n[right:l])
		print(min(t1, t2))


def main():
	n = int(input())
	s = input()
	ans = int(s)
	half = len(s) // 2
	if len(s) % 2 == 0:
		for i in range(0, half):
			if s[half + i] == '0' and s[half - i] == '0':
				continue
			else:
				if s[half + i] != '0':
					ans = min(ans, int(s[:half + i]) + int(s[half + i:]))
				if s[half - i] != '0':
					ans = min(ans, int(s[:half - i]) + int(s[half - i:]))
				break
	else:
		for i in range(0, half):
			if s[half + 1 + i] == '0' and s[half - i] == '0':
				continue
			else:
				if s[half + 1 + i] != '0':
					ans = min(ans, int(s[:half + 1 + i]) + int(s[half + 1 + i:]))
				if s[half - i] != '0':
					ans = min(ans, int(s[:half - i]) + int(s[half - i:]))
				break
	print(ans)
main()


def get_min(a, b):
	if len(a) < len(b):
		return a
	if len(a) > len(b):
		return b
	return min(a, b)
n = int(input())
s = input()
(l, r) = (0, n)
for i in range(1, n):
	if s[i] == '0':
		continue
	if i <= n // 2:
		l = i
	if i > n // 2 and r == n:
		r = i
(res1, res2) = ('9' * (n + 1), '9' * (n + 1))
if l != 0:
	res1 = str(int(s[:l]) + int(s[l:]))
if r != n:
	res2 = str(int(s[:r]) + int(s[r:]))
print(get_min(res1, res2))


N = int(input())
s = input()
j = 0
k = 0
if N % 2 == 0:
	if 1:
		a = N
		b = 0
		for i in range(N // 2, N):
			if s[i] != '0':
				a = i
				break
		for i in range(N // 2 - 1, -1, -1):
			if s[i] != '0':
				b = i
				break
		if a != N:
			m = int(s[:a]) + int(s[a:])
			n = m
			if b != 0:
				n = int(s[:b]) + int(s[b:])
			if m < n:
				k = m
			else:
				k = n
		elif b != 0:
			k = int(s[:b]) + int(s[b:])
		else:
			k = int(s)
else:
	if s[N // 2] == '0' or 1:
		a = N
		b = 0
		for i in range(N // 2, N):
			if s[i] != '0':
				a = i
				break
		for i in range(N // 2 - 1, -1, -1):
			if s[i] != '0':
				b = i
				break
		if a != N:
			m = int(s[:a]) + int(s[a:])
			n = m
			if b != 0:
				n = int(s[:b]) + int(s[b:])
			if m < n:
				j = m
			else:
				j = n
		elif b != 0:
			j = int(s[:b]) + int(s[b:])
		else:
			k = int(s)
	if 1:
		N = N + 1
		a = N
		for i in range(N // 2, N - 1):
			if s[i] != '0':
				a = i
				break
		for i in range(N // 2 - 1, -1, -1):
			if s[i] != '0':
				b = i
				break
		if a != N:
			m = int(s[:a]) + int(s[a:])
			n = m
			if b != 0:
				n = int(s[:b]) + int(s[b:])
			if m < n:
				k = m
			else:
				k = n
		elif b != 0:
			k = int(s[:b]) + int(s[b:])
		else:
			k = int(s)
	if j < k:
		k = j
print(k)


l = int(input())
str = input()
ans = int(str)
till = (l - 1) // 2
for i in range(till, -1, -1):
	if str[i + 1] == '0':
		continue
	ans = min(ans, int(str[0:i + 1]) + int(str[i + 1:len(str)]))
	break
till = l // 2
for i in range(till, l):
	if str[i] == '0':
		continue
	ans = min(ans, int(str[0:i]) + int(str[i:len(str)]))
	break
print(ans)


n = int(input())
s = input()
minm = int('9' * 100010)
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		minm = min(minm, int(s[:i]) + int(s[i:]))
		break
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		minm = min(minm, int(s[:i]) + int(s[i:]))
		break
print(minm)


l = int(input())
s = input()
i1 = l // 2
i2 = i1 + 1
i3 = i1 - 1
i4 = i2 + 1
p1 = p2 = p3 = p4 = int(s)
if i1 < l and i1 >= 0:
	while i1 > 0 and s[i1] == '0':
		i1 -= 1
	if i1 > 0:
		p1 = int(s[i1:]) + int(s[:i1])
if i2 < l and i2 >= 0:
	while i2 < l and s[i2] == '0':
		i2 += 1
	if i2 < l:
		p2 = int(s[:i2]) + int(s[i2:])
mini = min(p1, p2)
if i3 < l and i3 > 0:
	if s[i3] != '0':
		p3 = int(s[:i3]) + int(s[i3:])
if p3 < mini:
	mini = p3
if l % 2 != 0:
	if i4 < l and i4 > 0:
		if s[i4] != '0':
			p4 = int(s[:i4]) + int(s[i4:])
if p4 < mini:
	mini = p4
print(mini)


n = int(input())
val = input()
mid = n // 2
while mid < n and val[mid] == '0':
	mid += 1
anmid = n // 2
while anmid > -1 and val[anmid] == '0':
	anmid -= 1
ans = 10 ** n
if anmid != 0:
	ans = int(val[:anmid]) + int(val[anmid:])
if mid != n:
	ans = min(ans, int(val[:mid]) + int(val[mid:]))
mid = n // 2 + 1
anmid = mid
while mid < n and val[mid] == '0':
	mid += 1
while anmid > -1 and val[anmid] == '0':
	anmid -= 1
if anmid != 0:
	ans = min(ans, int(val[:anmid]) + int(val[anmid:]))
if mid != n:
	ans = min(ans, int(val[:mid]) + int(val[mid:]))
print(ans)


n = int(input())
m = n // 2
num = input()
ll = m + 1
rr = m
while ll < n and num[ll] == '0':
	ll = ll + 1
while rr >= 0 and num[rr] == '0':
	rr = rr - 1
if ll == n:
	print(int(num[0:rr]) + int(num[rr:n]))
elif rr == 0:
	print(int(num[0:ll]) + int(num[ll:n]))
else:
	print(min(int(num[0:ll]) + int(num[ll:n]), int(num[0:rr]) + int(num[rr:n])))


n = int(input())
a = input()
v = int(a)
for (k, i) in ((1, n // 2), (-1, (n + 1) // 2)):
	while i < n and a[i] < '1':
		i += k
	if 0 < i < n:
		v = min(v, int(a[:i]) + int(a[i:]))
print(v)


l = int(input())
s = input()
vec = []
for i in range(1, l):
	if s[i] == '0':
		continue
	vec.append(i)
vec = sorted(vec, key=lambda x: abs(x - l / 2))
ans = 10 ** 100000
cnt = 0
for i in vec:
	cnt += 1
	if cnt > 4:
		break
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


n = int(input())
s = input()
ans = int(s)
cut = n // 2
if s[cut] != '0':
	ans = min(int(s[:cut]) + int(s[cut:]), int(s[:cut + 1]) + int(s[cut + 1:]))
else:
	cut1 = cut
	cut2 = cut
	while cut1 >= 0 and s[cut1] == '0':
		cut1 -= 1
	while cut2 < n and s[cut2] == '0':
		cut2 += 1
	if cut1 > 0:
		ans = min(ans, int(s[:cut1]) + int(s[cut1:]))
	if cut2 < n:
		ans = min(ans, int(s[:cut2]) + int(s[cut2:]))
print(ans)


a = int(input())
s = input()
res = int(s)
for i in range((a - 1) // 2, -1, -1):
	if s[i + 1] == '0':
		continue
	res = min(res, int(s[0:i + 1]) + int(s[i + 1:]))
	break
for i in range(a // 2, a):
	if s[i] == '0':
		continue
	res = min(res, int(s[0:i]) + int(s[i:]))
	break
print(res)


l = int(input())
n = str(input())
m = l // 2
while n[m] == '0':
	m -= 1
x = int(n[0:m]) + int(n[m:l]) if m > 0 else int(n)
m = (l + 1) // 2
while m < l and n[m] == '0':
	m += 1
if m < l:
	x = min([x, int(n[0:m]) + int(n[m:l])])
print(x)


n = int(input())
s = input()
if n == 2:
	print(int(s[0]) + int(s[1]))
	exit()
i = n // 2
rez1 = 0
rez2 = 0
while i < n - 1:
	if s[i:][0] == '0':
		i += 1
	else:
		break
rez1 = int(s[i:]) + int(s[0:i])
j = n // 2 + 1
while j > 1:
	if s[j:][0] == '0':
		j -= 1
	else:
		break
if s[j:][0] == '0':
	print(rez1)
	exit()
rez2 = int(s[j:]) + int(s[0:j])
if s[i:][0] == '0':
	print(rez2)
	exit()
print(min(rez1, rez2))


import math
n = int(input())
k = input()
q = int(k)
a = [0 for i in range(-1, 100200)]
cnt = 0
t = 0
for i in range(1, n):
	if k[i] != '0':
		a[cnt] = n - i
		cnt += 1
a[-1] = 100010
ans = 0
for i in range(1, cnt + 1):
	if a[cnt - i - 1] >= n // 2:
		b = 1
		for y in range(0, a[cnt - i]):
			b *= 10
		for j in range(i, min(i + 3, cnt + 1)):
			if j > i:
				for y in range(a[cnt - j + 1], a[cnt - j]):
					b *= 10
				x = q // b + q % b
				if x < ans:
					ans = x
			else:
				ans = q // b + q % b
		print(int(ans))
		exit()


n = int(input())
s = input()
mv = n + 1
for i in range(1, n):
	if s[i] != '0':
		mv = min(mv, max(i, n - i))
lst = []
for i in range(1, n):
	if s[i] != '0':
		l = max(i, n - i)
		if l == mv or l == mv + 1:
			lst.append(i)
res = int(s)
for i in lst:
	a = int(s[0:i])
	b = int(s[i:n])
	res = min(res, a + b)
print(res)


n = int(input())
x = input()
num = x[n // 2]
num2 = x[(n + 1) // 2]
ans = -1
if num == '0':
	p = n // 2
	k = p
	while p >= 0 and x[p] == '0':
		p -= 1
	while k < n and x[k] == '0':
		k += 1
	n1 = 0
	if len(x[:p]) > 0:
		n1 = int(x[:p])
	n2 = 0
	if len(x[p:]) > 0:
		n2 = int(x[p:])
	nn1 = 0
	if len(x[:k]) > 0:
		nn1 = int(x[:k])
	nn2 = 0
	if len(x[k:]) > 0:
		nn2 = int(x[k:])
	best = min(n1 + n2, nn1 + nn2)
	if ans == -1:
		ans = best
	else:
		ans = min(ans, best)
else:
	n1 = int(x[:n // 2])
	n2 = int(x[n // 2:])
	best = n1 + n2
	if ans == -1:
		ans = best
	else:
		ans = min(ans, best)
if num2 == '0':
	p = (n + 1) // 2
	k = p
	while p >= 0 and x[p] == '0':
		p -= 1
	while k < n and x[k] == '0':
		k += 1
	n1 = 0
	if len(x[:p]) > 0:
		n1 = int(x[:p])
	n2 = 0
	if len(x[p:]) > 0:
		n2 = int(x[p:])
	nn1 = 0
	if len(x[:k]) > 0:
		nn1 = int(x[:k])
	nn2 = 0
	if len(x[k:]) > 0:
		nn2 = int(x[k:])
	best = min(n1 + n2, nn1 + nn2)
	if ans == -1:
		ans = best
	else:
		ans = min(ans, best)
else:
	n1 = int(x[:(n + 1) // 2])
	n2 = int(x[(n + 1) // 2:])
	best = n1 + n2
	if ans == -1:
		ans = best
	else:
		ans = min(ans, best)
print(ans)


def shTofhShiftIfZero(s, fh, sh):
	curr = ''
	for i in sh:
		if i == '0':
			curr += '0'
		else:
			break
	fh += curr
	sh = sh[len(curr):]
	if fh == '':
		fh = 0
	if sh == '':
		sh = 0
	sum1 = int(fh) + int(sh)
	return sum1

def fhToshShiftIfZero(s, fh, sh):
	curr = ''
	fh1 = fh[::-1]
	for i in fh1:
		if i == '0':
			curr += '0'
		else:
			break
	newSh = fh[len(fh) - len(curr) - 1] + curr + sh
	sh = newSh
	fh = fh[0:len(fh) - len(curr) - 1]
	if fh == '':
		fh = 0
	if sh == '':
		sh = 0
	sum1 = int(fh) + int(sh)
	return sum1
n = int(input())
s = input()
fh = s[0:n // 2]
sh = s[n // 2:]
miniSum = 0
sum1 = 0
sum2 = 0
sum3 = 0
if sh[0] == '0':
	sum1 += shTofhShiftIfZero(s, fh, sh)
	sum2 += fhToshShiftIfZero(s, fh, sh)
	miniSum = min(sum1, sum2)
elif fh[len(fh) - 1] == '0':
	sum3 += fhToshShiftIfZero(s, fh, sh)
	miniSum = sum3
else:
	sh1 = sh
	sh1 = sh1[1:]
	fh1 = fh + sh[0]
	if fh1 == '':
		fh1 = 0
	if sh1 == '':
		sh1 = 0
	fSum = int(fh1) + int(sh1)
	miniSum = min(int(fh) + int(sh), fSum)
print(miniSum)


l = int(input())
s = input()
if l % 2 == 0:
	m1 = l // 2
	m2 = m1
else:
	m1 = l // 2
	m2 = m1 + 1
while s[m1] == '0' and s[m2] == '0':
	m1 = m1 - 1
	m2 = m2 + 1
if s[m1] == '0':
	res = int(s[:m2]) + int(s[m2:])
elif s[m2] == '0':
	res = int(s[:m1]) + int(s[m1:])
else:
	res = min(int(s[:m1]) + int(s[m1:]), int(s[:m2]) + int(s[m2:]))
print(res)


from collections import *
from math import *
from sys import *
n = int(input())
s = input()
i = j = n // 2
while i >= 0 and j < n:
	if n % 2 == 0:
		if s[i] == '0' and s[j] == '0':
			i -= 1
			j += 1
		elif s[j] == '0':
			s1 = int(s[:i]) + int(s[i:])
			s2 = -1
			break
		elif s[i] == '0':
			s1 = -1
			s2 = int(s[:j]) + int(s[j:])
			break
		else:
			s1 = int(s[:i]) + int(s[i:])
			s2 = int(s[:j]) + int(s[j:])
			break
	if n % 2 == 1:
		if s[i] == '0' and s[j + 1] == '0':
			j += 1
			i -= 1
		elif s[j + 1] == '0':
			s1 = int(s[:i]) + int(s[i:])
			s2 = -1
			break
		elif s[i] == '0':
			s1 = -1
			s2 = int(s[:j + 1]) + int(s[j + 1:])
			break
		else:
			s1 = int(s[:i]) + int(s[i:])
			s2 = int(s[:j + 1]) + int(s[j + 1:])
			break
if s1 == -1:
	print(s2)
elif s2 == -1:
	print(s1)
else:
	print(min(s1, s2))


import string
l = input()
l = int(l)
str = input()
mn = 1e309
cnt = 0
for i in range(0, int(l / 2)):
	p = int(l / 2) + i + l % 2
	if str[p] != '0':
		cnt += 1
		mn = min(int(str[0:p]) + int(str[p:l]), mn)
	p = int(l / 2) - i
	if str[p] != '0':
		cnt += 1
		mn = min(int(str[0:p]) + int(str[p:l]), mn)
	if cnt > 4:
		break
print(mn)


def main():
	q = int(input())
	s = input()
	ans = 10 ** 1000000
	for i in range(max(1, q // 2 - 1), q):
		if s[i] != '0' or s[q - i] != '0':
			if s[i] != '0':
				ans = min(ans, int(s[:i]) + int(s[i:]))
			if s[q - i] != '0':
				ans = min(ans, int(s[:q - i]) + int(s[q - i:]))
			if len(str(ans)) <= max(i, q - i) and i > q // 2:
				break
	print(ans)
main()


n = int(input())
a = input()
a = str(a)
ans = int(a)
bb = []
cnt = 0
if a[n - 1] != '0':
	ans = int(a[:n - 1]) + int(a[n - 1:])
for i in range(n - 1):
	if a[i] == '0' and a[i + 1] != '0':
		cnt += 1
		bb.append(i)
	elif a[i] != '0' and a[i + 1] != '0':
		cnt += 1
		bb.append(i)
cc = []
mid = n // 2
for i in range(cnt):
	temp = []
	temp.append(abs(mid - bb[i]))
	temp.append(bb[i])
	cc.append(temp)
cc.sort(key=lambda x: x[0])
for i in range(min(10, len(cc))):
	if int(a[:cc[i][1] + 1]) + int(a[cc[i][1] + 1:]) < int(ans):
		ans = int(a[:cc[i][1] + 1]) + int(a[cc[i][1] + 1:])
print(ans)


l = int(input())
nb = input()
nbr = str(nb)
mini = 0
mid = l // 2
if nbr[mid] != '0':
	tmp = int(nbr[:mid]) + int(nbr[mid:])
	if mini == 0 or mini > tmp:
		mini = tmp
cnt = 1
while mid + cnt < l:
	if nbr[mid + cnt] != '0':
		tmp = int(nbr[:mid + cnt]) + int(nbr[mid + cnt:])
		if mini == 0 or mini > tmp:
			mini = tmp
		break
	else:
		cnt += 1
cnt = 1
while mid - cnt > 0:
	if nbr[mid - cnt] != '0':
		tmp = int(nbr[:mid - cnt]) + int(nbr[mid - cnt:])
		if mini == 0 or mini > tmp:
			mini = tmp
		break
	else:
		cnt += 1
print(mini)


import sys
sys.setrecursionlimit(10 ** 5 + 10)

def input():
	return sys.stdin.readline().strip()

def resolve():
	l = int(input())
	n = str(input())
	ans = float('inf')
	if l % 2 == 0:
		cur = l // 2
		d = 0
		while True:
			found = False
			if cur + d < l and n[cur + d] != '0':
				found = True
				lnum = int(n[:cur + d])
				rnum = int(n[cur + d:])
				if lnum + rnum < ans:
					ans = lnum + rnum
			if cur - d >= 0 and n[cur - d] != '0':
				found = True
				lnum = int(n[:cur - d])
				rnum = int(n[cur - d:])
				if lnum + rnum < ans:
					ans = lnum + rnum
			if found:
				break
			d += 1
	else:
		cur0 = l // 2
		cur1 = cur0 + 1
		d = 0
		while True:
			found = False
			if cur1 + d < l and n[cur1 + d] != '0':
				found = True
				lnum = int(n[:cur1 + d])
				rnum = int(n[cur1 + d:])
				if lnum + rnum < ans:
					ans = lnum + rnum
			if cur0 - d >= 0 and n[cur0 - d] != '0':
				found = True
				lnum = int(n[:cur0 - d])
				rnum = int(n[cur0 - d:])
				if lnum + rnum < ans:
					ans = lnum + rnum
			if found:
				break
			d += 1
	print(ans)
resolve()


n = int(input())
s = input()
ans = int(s)
for (k, i) in ((1, n // 2), (-1, (n + 1) // 2)):
	while i < n and '1' > s[i]:
		i += k
	if 0 < i < n:
		ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


l = int(input())
s = input()
k = l // 2
for i in range(k):
	m1 = 0
	if s[k + i + l % 2] != '0':
		m1 = int(s[:k + i + l % 2]) + int(s[k + i + l % 2:])
	m2 = 0
	if s[k - i] != '0':
		m2 = int(s[:k - i]) + int(s[k - i:])
	if m1 == 0 and m2 == 0:
		continue
	if m1 > 0 and m2 == 0:
		m = m1
	if m2 > 0 and m1 == 0:
		m = m2
	if m1 > 0 and m2 > 0:
		m = min(m1, m2)
	break
print(m)


l = int(input())
n = input()
if l & 1 == 0:
	if n[l // 2] != '0':
		print(int(n[:l // 2]) + int(n[l // 2:]))
	else:
		ind = l // 2
		while ind < l and n[ind] == '0':
			ind += 1
		if ind >= l:
			temp1 = int(n[:ind])
		else:
			temp1 = int(n[:ind]) + int(n[ind:])
		ind = l // 2
		while ind > 0 and n[ind] == '0':
			ind -= 1
		if ind > 0:
			temp2 = int(n[:ind]) + int(n[ind:])
		else:
			temp2 = int(n)
		print(min(temp1, temp2))
else:
	if n[l // 2] != '0':
		temp1 = int(n[:l // 2]) + int(n[l // 2:])
	else:
		ind = l // 2
		while ind < l and n[ind] == '0':
			ind += 1
		if ind >= l:
			temp1 = int(n[:ind])
		else:
			temp1 = int(n[:ind]) + int(n[ind:])
		ind = l // 2
		while ind > 0 and n[ind] == '0':
			ind -= 1
		if ind > 0:
			temp2 = int(n[:ind]) + int(n[ind:])
		else:
			temp2 = int(n)
		temp1 = min(temp1, temp2)
	if n[l // 2 + 1] != '0':
		temp3 = int(n[:l // 2 + 1]) + int(n[l // 2 + 1:])
	else:
		ind = l // 2 + 1
		while ind < l and n[ind] == '0':
			ind += 1
		if ind >= l:
			temp3 = int(n[:ind])
		else:
			temp3 = int(n[:ind]) + int(n[ind:])
		ind = l // 2 + 1
		while ind > 0 and n[ind] == '0':
			ind -= 1
		if ind > 0:
			temp4 = int(n[:ind]) + int(n[ind:])
		else:
			temp4 = int(n)
		temp3 = min(temp3, temp4)
	print(min(temp3, temp1))


l = int(input())
s = input()
best = 0
best2 = None
for sl in range(1, l):
	if s[sl] != '0':
		if max(sl, l - sl) < max(best, l - best):
			best = sl
			best2 = None
		elif max(sl, l - sl) == max(best, l - best):
			best2 = sl
f = s[:best]
b = s[best:]
res = int(s[:best]) + int(s[best:])
if best2 is None:
	print(res)
else:
	res2 = int(s[:best2]) + int(s[best2:])
	print(min(res, res2))


n = int(input())
y = input()
pek = int

def int(x):
	if x == '':
		return 0
	else:
		return pek(x)
if n % 2 == 0:
	mul1 = 0
	mul2 = n - 1
	for i in range(n // 2, n):
		mul1 = i
		if y[i] == '0':
			continue
		else:
			break
	for i in range(n // 2 - 1, -1, -1):
		mul2 = i
		if y[i] == '0':
			continue
		else:
			break
	if mul1 == n - 1 and y[mul1] == '0':
		mul1 = mul2
	m = min(int(y[mul1:n]) + int(y[0:mul1]), int(y[mul2:n]) + int(y[0:mul2]))
	print(m)
else:
	res1 = res2 = 0
	if True:
		mul1 = 0
		mul2 = n - 1
		for i in range(n // 2, n):
			mul1 = i
			if y[i] == '0':
				continue
			else:
				break
		for i in range(n // 2 - 1, -1, -1):
			mul2 = i
			if y[i] == '0':
				continue
			else:
				break
		if mul1 == n - 1 and y[mul1] == '0':
			mul1 = mul2
		res1 = min(int(y[mul1:n]) + int(y[0:mul1]), int(y[mul2:n]) + int(y[0:mul2]))
	if True:
		mul1 = 0
		mul2 = n - 1
		for i in range(n // 2 + 1, n):
			mul1 = i
			if y[i] == '0':
				continue
			else:
				break
		for i in range(n // 2, -1, -1):
			mul2 = i
			if y[i] == '0':
				continue
			else:
				break
		if mul1 == n - 1 and y[mul1] == '0':
			mul1 = mul2
		res2 = min(int(y[mul1:n]) + int(y[0:mul1]), int(y[mul2:n]) + int(y[0:mul2]))
	print(min(res1, res2))


from bisect import bisect as br, bisect_left as bl
N = int(input())
L = input().strip()
S = [i for i in range(N) if L[i] != '0']
candi = []
xr = bl(S, -(-N // 2))
for i in range(-2, 3):
	if 0 < xr + i < len(S):
		candi.append(S[xr + i])
if 0 < -(-N // 2) < N and L[-(-N // 2)] != '0':
	candi.append(-(-N // 2))
if 0 < -(-N // 2) + 1 < N and L[-(-N // 2) + 1] != '0':
	candi.append(-(-N // 2) + 1)
if 0 < -(-N // 2) - 1 < N and L[-(-N // 2) - 1] != '0':
	candi.append(-(-N // 2) - 1)
ans = float('inf')
for c in candi:
	ans = min(ans, int(''.join(L[:c])) + int(''.join(L[c:])))
print(ans)


MAX = int('9' * 100001)
N = int(input())
S = str(input())
a = N // 2
b = N - a
while True:
	M1 = None
	if S[a] != '0':
		A1 = S[0:a]
		B1 = S[a:]
		M1 = int(A1) + int(B1)
	M2 = None
	if S[b] != '0':
		A2 = S[0:b]
		B2 = S[b:]
		M2 = int(A2) + int(B2)
	if M1 != None and M2 != None:
		print(min(M1, M2))
		exit(0)
	elif M1 != None:
		print(M1)
		exit(0)
	elif M2 != None:
		print(M2)
		exit(0)
	a -= 1
	b += 1


import math
lent = int(input())
strd = input()
anss = math.inf

def ceil(i):
	return i // 2

def forward_check(i, j):
	val = math.inf
	while i >= 0 and strd[i] == '0':
		i -= 1
	if i > 0:
		val = min(val, int(strd[:i]) + int(strd[i:]))
	return val

def backward_check(i, j):
	val = math.inf
	while i < j and strd[i] == '0':
		i += 1
	if i < j:
		val = min(val, int(strd[:i]) + int(strd[i:]))
	return val
k = ceil(lent)
anss = min(anss, forward_check(k, lent))
anss = min(anss, backward_check(k, lent))
anss = min(anss, forward_check(k + 1, lent))
anss = min(anss, backward_check(k + 1, lent))
print(anss)


l = int(input())
line = input()
if l % 2 == 0:
	index = l // 2
	m = float('inf')
	while index < l - 1 and line[index] == '0':
		index += 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		m = min(m, f + s)
	index = l // 2 + 1
	while index >= 1 and line[index] == '0':
		index -= 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		m = min(m, f + s)
	print(m)
else:
	index = l // 2 + 1
	m = float('inf')
	while index < l - 1 and line[index] == '0':
		index += 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		m = min(m, f + s)
	index = l // 2 + 1
	while index >= 1 and line[index] == '0':
		index -= 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		m = min(m, f + s)
	index = l // 2
	q = float('inf')
	while index < l - 1 and line[index] == '0':
		index += 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		q = min(q, f + s)
	index = l // 2 + 1
	while index >= 1 and line[index] == '0':
		index -= 1
	if line[index] != '0':
		f = int(line[0:index])
		s = int(line[index:])
		q = min(q, f + s)
	print(min(q, m))


def fun():
	i = m - 1
	while i >= 0 and s[i + 1] == '0':
		i -= 1
	j = m + 1
	while j < l and s[j] == '0':
		j += 1
	if i < 0:
		a = int(s) + 1
	else:
		a = int(s[:i + 1]) + int(s[i + 1:])
	if j == l:
		b = int(s) + 1
	else:
		b = int(s[:j]) + int(s[j:])
	return min(a, b)
l = int(input())
s = input()
m = int(l / 2)
print(fun())


n = int(input())
s = input()
mid = len(s) // 2
l = mid
r = mid + 1
while l >= 0 and s[l] == '0':
	l -= 1
while r < n and s[r] == '0':
	r += 1
if l == 0:
	print(int(s[:r]) + int(s[r:]))
elif r == n:
	print(int(s[:l]) + int(s[l:]))
else:
	print(min(int(s[:r]) + int(s[r:]), int(s[:l]) + int(s[l:])))


import sys
n = int(sys.stdin.readline(40))
buff = sys.stdin.readline(n)
length = len(buff)
maxlen = 100005
ans = 1e309
minList = []
for i in range(1, length):
	if buff[i] != '0':
		tmp = max(i, length - i) + 1
		if tmp < maxlen:
			minList = [i]
			maxlen = tmp
		elif tmp == maxlen:
			minList.append(i)
			maxlen = tmp
for i in minList:
	A = int(buff[0:i])
	B = int(buff[i:])
	ans = min(ans, A + B)
print(ans)


n = int(input())
s = input()
a = (n + 1) // 2
b = a - 1
while a < n and s[a] == '0':
	a += 1
while b > 0 and s[b] == '0':
	b -= 1
ans = int(s)
if a < n:
	ans = min(ans, int(s[:a]) + int(s[a:]))
if b > 0:
	ans = min(ans, int(s[:b]) + int(s[b:]))
print(ans)


def solve(p2, n, s):
	p3 = p2
	while p2 < n and s[p2] == '0':
		p2 += 1
	while p3 >= 0 and s[p3] == '0':
		p3 -= 1
	res = float('inf')
	if p2 != 0 and p2 != n:
		res = int(s[0:p2]) + int(s[p2:])
	if p3 != 0 and p3 != n:
		res = min(res, int(s[0:p3]) + int(s[p3:]))
	return res
n = int(input())
s = input()
res = solve(n // 2, n, s)
if n % 2 == 1:
	res = min(res, solve(n // 2 + 1, n, s))
print(res)


l = int(input())
n = input()
ans = -1
for i in range(int(l / 2), l):
	if n[i] == '0':
		continue
	tmp = int(n[0:i]) + int(n[i:])
	if tmp < ans or ans == -1:
		ans = tmp
	if i > int(l / 2):
		break
for i in range(int(l / 2), 0, -1):
	if n[i] == '0':
		continue
	tmp = int(n[0:i]) + int(n[i:])
	if tmp < ans or ans == -1:
		ans = tmp
	break
print(ans)


number = int(input(''))
input_array = list(input(''))
first = 0
second = 0
result = 0
if number % 2 == 0:
	i = int(number / 2)
	if input_array[i] == '0':
		while i != number and input_array[i] == '0':
			i += 1
		if i == number:
			i = number - 1
			while input_array[i] == '0':
				i -= 1
			result = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
		else:
			first = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
			i = int(number / 2) - 1
			while input_array[i] == '0':
				i -= 1
			second = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
			if first > second:
				result = second
			else:
				result = first
	else:
		result = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
else:
	i = int(number / 2) + 1
	if input_array[i] == '0':
		while i != number and input_array[i] == '0':
			i += 1
		if i == number:
			i = int(number / 2)
			while input_array[i] == '0':
				i -= 1
			result = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
		else:
			first = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
			i = int(number / 2)
			while input_array[i] == '0':
				i -= 1
			second = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
			if first > second:
				result = second
			else:
				result = first
	else:
		first = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
		i = int(number / 2)
		if input_array[i] != '0':
			second = int(''.join(input_array[0:i])) + int(''.join(input_array[i:number]))
			if first > second:
				result = second
			else:
				result = first
		else:
			result = first
print(result)


l = int(input())
a = input()
mn = l
for (i, v) in enumerate(a):
	if v != '0' and mn > max(i, l - i):
		mn = max(i, l - i)
b = []
for i in range(mn - 1, mn + 2):
	if i > 0 and i < l:
		if a[i] != '0':
			b.append(int(a[:i]) + int(a[i:]))
		j = l - i
		if a[j] != '0':
			b.append(int(a[:j]) + int(a[j:]))
print(min(b))


def main():
	l = int(input())
	s = input()
	if l % 2 == 0:
		left = l // 2
		right = l // 2
	else:
		left = l // 2
		right = l // 2 + 1
	while True:
		if right == left:
			if s[right] == '0':
				left -= 1
				right += 1
			else:
				first = int(s[:left])
				second = int(s[right:])
				print(first + second)
				break
		elif s[left] != '0' and s[right] != '0':
			first_left = int(s[:left])
			second_left = int(s[left:])
			first_right = int(s[:right])
			second_right = int(s[right:])
			print(min(first_left + second_left, first_right + second_right))
			break
		elif s[left] == '0' and s[right] != '0':
			first_right = int(s[:right])
			second_right = int(s[right:])
			print(first_right + second_right)
			break
		elif s[left] != '0' and s[right] == '0':
			first_left = int(s[:left])
			second_left = int(s[left:])
			print(first_left + second_left)
			break
		else:
			left -= 1
			right += 1
main()


n = input()
a = str(input())
idx = (len(a) + 1) // 2
l = idx - 1
r = idx
lt = 0
rt = 0
ans = -1
while l > 0:
	if a[l] != '0':
		if ans == -1:
			ans = int(a[:l]) + int(a[l:])
		ans = min(ans, int(a[:l]) + int(a[l:]))
		lt = lt + 1
	l = l - 1
	if lt >= 2:
		break
while r < len(a):
	if a[r] != '0':
		if ans == -1:
			ans = int(a[:r]) + int(a[r:])
		ans = min(ans, int(a[:r]) + int(a[r:]))
		rt = rt + 1
	r = r + 1
	if rt >= 2:
		break
print(ans)


n = int(input())
s = input()
al_l = []
al_r = []
for i in range(1, n):
	if int(s[i]) > 0 and i <= n // 2:
		al_l.append(i)
	if int(s[i]) > 0 and i > n // 2:
		al_r.append(i)
	if len(al_r) == 3:
		break
	if len(al_l) == 3:
		del al_l[0]
ans = int(s)
for x in al_l:
	ans = min(ans, int(s[0:x]) + int(s[x:]))
for x in al_r:
	ans = min(ans, int(s[0:x]) + int(s[x:]))
print(ans)


l = int(input())
s = input()
mx = int(s)
half = l // 2
half += 1
i = half
while i < l:
	if s[i] != '0':
		break
	i = i + 1
if i <= l - 1:
	pref = int(s[:i])
	suff = int(s[i:])
	mx = min(mx, pref + suff)
i = half - 1
while s[i] == '0':
	i = i - 1
if i >= 1:
	pref = int(s[:i])
	suff = int(s[i:])
	mx = min(mx, pref + suff)
print(mx)


l = int(input())
n = input()

def solve(ind, d):
	global ans
	if ind < 1 or ind >= l:
		return
	if n[ind] == '0':
		if d == 0:
			return
		while 1 <= ind < l and n[ind] == '0':
			ind += d
	if ind < 1 or ind >= l:
		return
	if n[ind] == '0':
		return
	res = int(n[:ind]) + int(n[ind:])
	try:
		ans = min(ans, res)
	except:
		ans = res
inds = []
for i in range(l // 2 - 3, l // 2 + 3):
	if 1 <= i < l:
		inds += [i]
for i in range(len(inds)):
	if i == 0:
		d = -1
	elif i == len(inds) - 1:
		d = 1
	else:
		d = 0
	solve(inds[i], d)
print(ans)


n = int(input())
s = input()
if n % 2 == 0:
	i = n // 2
	j = i
	while i < n - 1 and int(s[i]) == 0:
		i = i + 1
	if s[i] != '0':
		x = int(s[:i])
		y = int(s[i:])
		Sum = x + y
	else:
		Sum = float('inf')
	i = n // 2 + 1
	j = i
	while j > 0 and int(s[j]) == 0:
		j -= 1
	if s[j] != '0':
		x = int(s[:j])
		y = int(s[j:])
		sum2 = x + y
	else:
		sum2 = float('inf')
	print(min(Sum, sum2))
else:
	i = n // 2 + 1
	j = i
	while i < n - 1 and int(s[i]) == 0:
		i += 1
	if s[i] != '0':
		x = int(s[:i])
		y = int(s[i:])
		Sum = x + y
	else:
		Sum = float('inf')
	while j > 0 and int(s[j]) == 0:
		j -= 1
	if s[j] != 0:
		x = int(s[:j])
		y = int(s[j:])
		sum2 = x + y
	else:
		sum2 = float('inf')
	Sum3 = min(Sum, sum2)
	i = n // 2
	j = i + 1
	while i < n - 1 and int(s[i]) == 0:
		i += 1
	if s[i] != '0':
		x = int(s[:i])
		y = int(s[i:])
		Sum = x + y
	else:
		Sum = float('inf')
	while j > 0 and int(s[j]) == 0:
		j -= 1
	if s[j] != '0':
		x = int(s[:j])
		y = int(s[j:])
		sum2 = x + y
	else:
		sum2 = float('inf')
	Sum4 = min(Sum, sum2)
	print(min(Sum3, Sum4))


n = int(input())
s = input()
(l, r) = (n // 2, (n + 1) // 2)
ans = int(s)
while True:
	flag = False
	if s[l] != '0':
		flag = True
		(num1, num2) = (int(s[:l]), int(s[l:]))
		ans = min(ans, num1 + num2)
	if s[r] != '0':
		flag = True
		(num1, num2) = (int(s[:r]), int(s[r:]))
		ans = min(ans, num1 + num2)
	if flag:
		break
	l = l - 1
	r = r + 1
print(ans)


l = int(input())
n = input()
mid = l // 2
mid1 = mid
mid2 = mid + 1
mi = int(n)
while mid1 >= 1:
	if n[mid1] != '0':
		mi = min(mi, int(n[0:mid1]) + int(n[mid1:]))
		break
	mid1 -= 1
while mid2 < l:
	if n[mid2] != '0':
		mi = min(mi, int(n[0:mid2]) + int(n[mid2:]))
		break
	mid2 += 1
print(mi)


(n, s) = (int(input()), input())
h = n // 2
ans = 3 * 10 ** 100000
i = h
while i < n - 1 and s[i] == '0':
	i += 1
if not (i >= n - 1 and s[i] == '0'):
	ans = min(ans, int(s[:i]) + int(s[i:]))
i = min(h + 1, n - 1)
while i < n - 1 and s[i] == '0':
	i += 1
if not (i >= n - 1 and s[i] == '0'):
	ans = min(ans, int(s[:i]) + int(s[i:]))
i = h - 1
while s[i] == '0':
	i -= 1
if i > 0:
	ans = min(ans, int(s[:i]) + int(s[i:]))
print(ans)


n = int(input())
s = input()
ans = 10 ** 100001
if n % 2 == 0:
	flag = 0
	for i in range(n // 2):
		if s[n // 2 - i] != '0':
			ans = min(ans, int(s[0:n // 2 - i]) + int(s[n // 2 - i:]))
			flag += 1
		if flag > 2:
			break
	flag = 0
	for i in range(n // 2):
		if s[n // 2 + i] != '0':
			ans = min(ans, int(s[0:n // 2 + i]) + int(s[n // 2 + i:]))
			flag += 1
		if flag > 2:
			break
else:
	flag = 0
	for i in range(n // 2):
		if s[n // 2 - i] != '0':
			ans = min(ans, int(s[0:n // 2 - i]) + int(s[n // 2 - i:]))
			flag += 1
		if flag > 2:
			break
	flag = 0
	for i in range(n // 2 + 1):
		if s[n // 2 + i] != '0':
			ans = min(ans, int(s[0:n // 2 + i]) + int(s[n // 2 + i:]))
			flag += 1
		if flag > 2:
			break
print(ans)


l = int(input())
ns = input()
rr = l // 2
ll = (l + 1) // 2

def gett(x):
	return int(ns[:x]) + int(ns[x:])
for _ in range(l):
	if (ll >= 1 and ns[ll] != '0') and (rr < l and ns[rr] != '0'):
		ansl = gett(ll)
		ansr = gett(rr)
		print(min(ansl, ansr))
		break
	if ll >= 1 and ns[ll] != '0':
		print(gett(ll))
		break
	if rr < l and ns[rr] != '0':
		print(gett(rr))
		break
	ll = ll - 1
	rr = rr + 1


len = int(input())
s = input()
best = 0
best2 = 0
for i in range(1, len):
	if s[i] != '0':
		if max(i, len - i) < max(best, len - best):
			best = i
		elif max(i, len - i) == max(best, len - best):
			best2 = i
ans = int(s[:best]) + int(s[best:])
if best2 != 0:
	anss = int(s[:best2]) + int(s[best2:])
	print(min(ans, anss))
else:
	print(ans)


l = int(input())
n = int(input())
t = str(n)
a = []
x = 1
mid = (l + 1) // 2
L = l
R = 0
LEN = l - 1
while LEN >= 0:
	if t[LEN] != '0':
		if x >= mid:
			L = min(L, x)
		if x < mid:
			R = max(R, x)
	x += 1
	LEN -= 1
N = 100005
ans = 10 ** N
b = []
if L != l:
	b.append(L)
if R != 0:
	b.append(R)
for x in b:
	deg = 10 ** x
	cur = n % deg + n // deg
	ans = min(cur, ans)
print(ans)


l = int(input())
n = input()
minx = int(n)
for i in {l // 2 - 1, l // 2, l // 2 + 1, l // 2 + 2}:
	if n[:i] != '' and n[i:] != '' and (n[i:][0] != '0'):
		minx = min(minx, int(n[:i]) + int(n[i:]))
for i in range(l // 2, -1, -1):
	if n[:i] != '' and n[i:] != '':
		if n[i] != '0':
			minx = min(minx, int(n[:i]) + int(n[i:]))
			break
for i in range(l // 2, l):
	if n[:i] != '' and n[i:] != '':
		if n[i] != '0':
			minx = min(minx, int(n[:i]) + int(n[i:]))
			break
print(minx)


l = int(input())
n = input()
if l % 2:
	flag = False
	for i in range(1, l // 2 + 1):
		seg1 = int(l / 2 + i)
		seg2 = int(l / 2 - i) + 1
		ans1 = -1
		ans2 = -1
		if n[seg1] != '0':
			flag = True
			ans1 = int(n[:seg1]) + int(n[seg1:])
		if n[seg2] != '0':
			flag = True
			ans2 = int(n[:seg2]) + int(n[seg2:])
		if flag == True:
			if ans1 > 0 and ans2 > 0:
				print(min(ans1, ans2))
			elif ans1 > 0:
				print(ans1)
			elif ans2 > 0:
				print(ans2)
			break
else:
	flag = False
	for i in range(0, l // 2):
		seg1 = int(l / 2 + i)
		seg2 = int(l / 2 - i)
		ans1 = -1
		ans2 = -1
		if n[seg1] != '0':
			flag = True
			ans1 = int(n[:seg1]) + int(n[seg1:])
		if n[seg2] != '0':
			flag = True
			ans2 = int(n[:seg2]) + int(n[seg2:])
		if flag == True:
			if ans1 > 0 and ans2 > 0:
				print(min(ans1, ans2))
			elif ans1 > 0:
				print(ans1)
			elif ans2 > 0:
				print(ans2)
			break


l = int(input())
n = input()
ans = float('inf')
temp = 1
mid1 = l // 2
mid2 = l // 2
while mid1 < l and int(n[mid1]) == 0:
	mid1 += 1
while mid2 >= 0 and int(n[mid2]) == 0:
	mid2 -= 1
if mid1 != l:
	ans = min(ans, int(n[0:mid1]) + int(n[mid1:l]))
if mid2 >= 1:
	ans = min(ans, int(n[0:mid2]) + int(n[mid2:l]))
if mid1 < l - 1 and int(n[mid1 + 1] != 0):
	ans = min(ans, int(n[0:mid1 + 1]) + int(n[mid1 + 1:l]))
print(ans)


n = int(input())
s = input()
if n == 2:
	print(int(s[0]) + int(s[1]))
	exit(0)
mid = n // 2
tmid = mid
INF = pow(10, 50002)
ras = INF
ans = INF
while tmid < n - 1:
	if s[tmid + 1] != '0':
		a = int(s[0:tmid + 1])
		b = int(s[tmid + 1:])
		ras = a + b
		break
	tmid += 1
if ras != INF:
	ans = ras
tmid = mid
las = INF
while tmid > 0:
	if s[tmid] != '0':
		b = int(s[tmid:])
		a = int(s[0:tmid])
		las = a + b
		break
	tmid -= 1
if las != INF:
	ans = min(ans, las)
print(ans)


n = int(input())
s = str(input())
ans = int(s)
mid = n // 2
if n % 2 == 0:
	mid -= 1
c = int(s[mid])
d = int(s[mid + 1])
if c != 0 or d != 0:
	if c != 0 and mid > 0:
		ans = int(s[:mid]) + int(s[mid:n])
	if d != 0 and mid + 1 < n:
		tmp = int(s[:mid + 1]) + int(s[mid + 1:n])
		ans = min(ans, tmp)
	print(ans)
else:
	posl = -2
	posr = -2
	for i in range(mid, 0, -1):
		if int(s[i]) != 0:
			posl = i
			break
	for i in range(mid, n):
		if int(s[i]) != 0:
			posr = i
			break
	if posl > 0:
		ans = min(ans, int(s[:posl]) + int(s[posl:n]))
	if posr > 0:
		ans = min(ans, int(s[:posr]) + int(s[posr:n]))
	print(ans)


n = int(input())
s = input()
op1 = -1
op2 = -1
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		op1 = i
		break
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		op2 = i
		break
if op1 == -1:
	num = str(int(s[op2:]) + int(s[:op2]))
	print(num)
elif op2 == -1:
	num = str(int(s[op1:]) + int(s[:op1]))
	print(num)
else:
	num1 = int(s[op1:]) + int(s[:op1])
	num2 = int(s[op2:]) + int(s[:op2])
	num = str(min(num1, num2))
	print(num)


def check(s, n):
	ans = 0
	j = 0
	for i in range(n // 2, n):
		j = n - i
		if s[i] != '0' and s[j] != '0':
			sumi = getsum(s, i)
			sumj = getsum(s, j)
			if sumi < sumj:
				ans = i
			else:
				ans = j
		elif s[i] != '0':
			ans = i
		elif s[j] != '0':
			ans = j
		else:
			continue
		break
	return ans

def getsum(s, n):
	f = int(s[:n])
	h = int(s[n:])
	return f + h
n = int(input())
s = input()
g = check(s, n)
sum = getsum(s, g)
print(sum)


l = int(input())
s = input()
n = int(s)
if l % 2 == 0:
	div = int(l / 2)
	if s[div] != '0':
		s1 = int(s[:div])
		s2 = int(s[div:])
		print(s1 + s2)
	else:
		right = l
		for i in range(int(l / 2), l):
			if s[i] != '0':
				right = i
				break
		for i in range(int(l / 2) - 1, -1, -1):
			if s[i] != '0':
				left = i
				break
		if right != l:
			s1 = int(s[:right])
			s2 = int(s[right:])
		else:
			s1 = n
			s2 = n
		if left != 0:
			s3 = int(s[:left])
			s4 = int(s[left:])
		else:
			s3 = n
			s4 = n
		print(min(s1 + s2, s3 + s4))
else:
	check1 = int(l / 2)
	s1 = n
	s2 = n
	s3 = n
	s4 = n
	if s[check1 + 1] != '0':
		s1 = int(s[:check1 + 1])
		s2 = int(s[check1 + 1:])
	if s[check1] != '0':
		s3 = int(s[:check1])
		s4 = int(s[check1:])
	if s[check1] == '0' and s[check1 + 1] == '0':
		right = l
		for i in range(int(l / 2), l):
			if s[i] != '0':
				right = i
				break
		for i in range(int(l / 2), -1, -1):
			if s[i] != '0':
				left = i
				break
		if right != l:
			s5 = int(s[:right])
			s6 = int(s[right:])
		else:
			s5 = n
			s6 = n
		if left != 0:
			s7 = int(s[:left])
			s8 = int(s[left:])
		else:
			s7 = n
			s8 = n
		print(min(s5 + s6, s7 + s8))
	else:
		print(min(s1 + s2, s3 + s4))


def summ(i):
	global a
	b = a[:i]
	c = a[i:]
	if len(b) < len(c):
		b = [0] * (len(c) - len(b)) + b[:]
	if len(c) < len(b):
		c = [0] * (len(b) - len(c)) + c[:]
	ans = ['0'] * len(b)
	car = 0
	for i in range(len(b) - 1, -1, -1):
		ans[i] = str((int(b[i]) + int(c[i]) + car) % 10)
		car = (int(b[i]) + int(c[i]) + car) // 10
	if car != 0:
		ans = [car] + ans[:]
	return ''.join(ans)

def comp(a, b):
	if len(a) < len(b):
		return a
	elif len(b) < len(a):
		return b
	else:
		i = 0
		while i < len(a) and a[i] == b[i]:
			i += 1
		if i == len(a):
			return a
		elif int(a[i]) < int(b[i]):
			return a
		else:
			return b

def minn(i, j):
	return comp(summ(i), summ(j))
n = int(input())
a = list(input())
if a.count('0') == n - 1:
	print(''.join(a))
elif n % 2 == 0:
	t = n // 2
	if a[t] != '0':
		print(summ(n // 2))
	else:
		c = 0
		j = t
		while j < n and a[j] == '0':
			j += 1
		i = t
		while i > 0 and a[i] == '0':
			i -= 1
		t1 = n - i
		t2 = j
		if t1 > t2:
			print(summ(j))
		elif t1 < t2:
			print(summ(i))
		else:
			print(minn(j, i))
else:
	t = n // 2
	if a[t] != '0':
		print(minn(n // 2, n // 2 + 1))
	else:
		c = 0
		j = t
		while j < n and a[j] == '0':
			j += 1
		i = t
		while i > 0 and a[i] == '0':
			i -= 1
		t1 = n - i
		t2 = j
		if t1 > t2:
			print(summ(j))
		elif t1 < t2:
			print(summ(i))
		else:
			print(minn(j, i))


L = int(input())
N = input()
mn = int(N)
m = (L - 1) // 2
for i in range(m, -1, -1):
	if N[i + 1] == '0':
		continue
	mn = min(mn, int(N[0:i + 1]) + int(N[i + 1:]))
	break
m = L // 2
for i in range(m, L):
	if N[i] == '0':
		continue
	mn = min(mn, int(N[0:i]) + int(N[i:]))
	break
print(mn)


n = int(input())
a = str(input())
if n == 1:
	print(a)
else:
	(b, c) = (0, 0)
	res = 1e309
	pos1 = int(n / 2)
	pos2 = int(n / 2)
	pos3 = int(n / 2) + 1
	pos4 = int(n / 2) - 1
	while pos1 < n and a[pos1] == '0':
		pos1 += 1
	while pos3 < n and a[pos3] == '0':
		pos3 += 1
	while pos2 >= 0 and a[pos2] == '0':
		pos2 -= 1
	while pos4 >= 0 and a[pos4] == '0':
		pos4 -= 1
	if pos1 < n and a[pos1] != '0':
		b = int(a[0:pos1])
		if pos1 != n - 1:
			c = int(a[pos1:])
		else:
			c = int(a[n - 1])
		res = min(res, b + c)
	if pos2 >= 0 and a[pos2] != '0':
		if pos2 != 0:
			b = int(a[0:pos2])
		else:
			b = 0
		c = int(a[pos2:])
		res = min(res, b + c)
	if pos3 < n and a[pos3] != '0':
		b = int(a[0:pos3])
		if pos3 != n - 1:
			c = int(a[pos3:])
		else:
			c = int(a[n - 1])
		res = min(res, b + c)
	if pos4 >= 0 and a[pos4] != '0':
		if pos4 != 0:
			b = int(a[0:pos4])
		else:
			b = 0
		c = int(a[pos4:])
		res = min(res, b + c)
	print(int(res))


n = int(input())
s = input()
a = s
a = '0' + s
s = [int(i) for i in s]
s = [0] + s
p = []
if n % 2 is 0:
	i = n // 2 + 1
	while i <= n and s[i] == 0:
		i += 1
	if i <= n and s[i] != 0:
		p.append(i)
	i = n // 2
	while i >= 1 and s[i] == 0:
		i -= 1
	if i > 1 and s[i] != 0:
		p.append(i)
if n % 2 is 1:
	i = n // 2 + 1 + 1
	while i <= n and s[i] == 0:
		i += 1
	if i <= n and s[i] != 0:
		p.append(i)
	i = n // 2 + 1
	while i >= 1 and s[i] == 0:
		i -= 1
	if i > 1 and s[i] != 0:
		p.append(i)
ans = []
for i in p:
	ans.append(int(a[1:i]) + int(a[i:]))
print(min(ans))


l = int(input())
n = input()
k = 1
i = l // 2
j = l // 2 + 1
while i > 0 and n[i] == '0':
	i -= 1
while j < l and n[j] == '0':
	j += 1
ans = -1
if i >= 1:
	b = int(n[:i]) + int(n[i:])
	if ans == -1 or ans > b:
		ans = b
if j < l:
	b = int(n[:j]) + int(n[j:])
	if ans == -1 or ans > b:
		ans = b
print(ans)


length = int(input())
l = input()
min_s = None
start_pos = length // 2
end_pos = start_pos
start_count = 0
while start_pos > 0:
	if l[start_pos] != '0':
		n1 = l[:start_pos]
		n2 = l[start_pos:]
		start_count += 1
		if min_s == None:
			min_s = int(n1) + int(n2)
		else:
			min_s = min(min_s, int(n1) + int(n2))
	start_pos -= 1
	if start_count == 5:
		break
end_count = 0
while end_pos < length:
	if l[end_pos] != '0':
		n1 = l[:end_pos]
		n2 = l[end_pos:]
		end_count += 1
		if min_s == None:
			min_s = int(n1) + int(n2)
		else:
			min_s = min(min_s, int(n1) + int(n2))
	end_pos += 1
	if end_count == 5:
		break
print(min_s)


import math
l = int(input())
s = input()
if int(s) == 0:
	ans = 0
elif l % 2 == 0:
	b = l // 2
	if s[b] == '0':
		left = b
		right = b + 1
		while s[left] == '0' and left > 0:
			left = left - 1
		while s[right] == '0' and right < l - 1:
			right = right + 1
		if left == 0:
			ans = int(s[:right]) + int(s[right:])
		elif right == l - 1:
			ans = int(s[:left]) + int(s[left:])
		else:
			ans = min(int(s[:right]) + int(s[right:]), int(s[:left]) + int(s[left:]))
	else:
		ans = int(s[:b]) + int(s[b:])
else:
	b = l // 2
	if s[b] == '0':
		left = b
		right = b + 1
		while s[left] == '0' and left > 0:
			left = left - 1
		while s[right] == '0' and right < l - 1:
			right = right + 1
		if left == 0:
			ans = int(s[:right]) + int(s[right:])
		elif right == l - 1:
			ans = int(s[:left]) + int(s[left:])
		else:
			ans = min(int(s[:right]) + int(s[right:]), int(s[:left]) + int(s[left:]))
	else:
		ans = min(int(s[:b]) + int(s[b:]), int(s[:b + 1]) + int(s[b + 1:]))
print(ans)


l = int(input())
s = input()
n = int(s)
ans = n
a = []
for i in range(l):
	a.append(int(s[i]))
a = a[::-1]
al = l
for i in range(l):
	if a[i] > 0:
		temp = i + 1
		if temp < l - i - 1:
			temp = l - i - 1
		if al > temp:
			al = temp
for i in range(l):
	if a[i] > 0:
		temp = i + 1
		if temp < l - i - 1:
			temp = l - i - 1
		if al == temp or al == temp + 1 or al == temp + 2:
			t = 10 ** (i + 1)
			tt = n % t + n // t
			if ans > tt:
				ans = tt
print(ans)


n = int(input())
s = input()
i1 = n // 2
i2 = i1 + 1
while i1 > 0 and s[i1] == '0':
	i1 -= 1
while i2 < n and s[i2] == '0':
	i2 += 1
if i1 == 0:
	print(int(s[0:i2]) + int(s[i2:n]))
elif i2 == n:
	print(int(s[0:i1]) + int(s[i1:n]))
else:
	s1 = int(s[0:i1])
	s2 = int(s[0:i2])
	p1 = int(s[i1:n])
	p2 = int(s[i2:n])
	ans1 = s1 + p1
	ans2 = s2 + p2
	print(min(ans1, ans2))


n = int(input())
m = input()
(x, y, z) = (-1, -1, -1)
for i in range(n // 2 - 1, -1, -1):
	if m[i] != '0':
		x = i
		break
for i in range(n - n // 2, n):
	if m[i] != '0':
		y = i
		break
if n % 2 == 1 and m[n // 2] != '0':
	z = n // 2
ans = int(m)
for xx in [x, y, z]:
	if xx == -1:
		continue
	try:
		ans = min(ans, int(m[:xx]) + int(m[xx:]))
	except:
		pass
print(ans)


n = int(input())
m = input()
t = int(m)
i = n // 2
while i > 0 and m[i] == '0':
	i -= 1
if i > 0 and i < n and (m[i] != '0'):
	t = min(t, int(m[0:i]) + int(m[i:]))
i = n // 2 + 1
while i < n and m[i] == '0':
	i += 1
if i > 0 and i < n and (m[i] != '0'):
	t = min(t, int(m[0:i]) + int(m[i:]))
print(t)


def f(s):
	if s == '':
		return 0
	else:
		return int(s)
l = int(input())
s = input()
x = l // 2
y = x + 1
while 0 <= y + 1 < l and s[y + 1] == '0':
	y -= 1
z = x - 1
while 0 <= z + 1 < l and s[z + 1] == '0':
	z += 1
p = x
while 0 <= p + 1 < l and s[p + 1] == '0':
	p -= 1
q = x
while 0 <= q + 1 < l and s[q + 1] == '0':
	q += 1
print(min(f(s[:y + 1]) + f(s[y + 1:]), f(s[:z + 1]) + f(s[z + 1:]), f(s[:p + 1]) + f(s[p + 1:]), f(s[:q + 1]) + f(s[q + 1:])))


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
n = ii()
t = ip()
t = '0' + t
sz = n // 2 + 1
sz1 = n // 2 + 1
while sz < len(t) and t[sz] == '0':
	sz += 1
while sz1 > -1 and t[sz1] == '0':
	sz1 -= 1
k = int(t[:sz1])
if sz1 < len(t):
	k += int(t[sz1:])
p = int(t[:sz])
if sz < len(t):
	p += int(t[sz:])
q = int(t[:sz + 1])
if sz + 1 < len(t):
	q += int(t[sz + 1:])
print(min(k, p, q))


l = int(input())
s = str(input())
best = None
mid = l // 2
cnt = 0
for (i, c) in enumerate(s[mid:]):
	if c != '0':
		if mid + i >= len(s):
			break
		l = s[:mid + i]
		r = s[mid + i:]
		if r[0] == '0':
			continue
		sm = int(l) + int(r)
		if best is None or best > sm:
			best = sm
		cnt += 1
	if cnt == 5:
		break
cnt = 0
for (i, c) in enumerate(s[mid::-1]):
	if c != '0':
		if mid - i < 1:
			break
		l = s[:mid - i]
		r = s[mid - i:]
		if r[0] == '0':
			continue
		sm = int(l) + int(r)
		if best is None or best > sm:
			best = sm
		cnt += 1
	if cnt == 5:
		break
print(best)


l = int(input())
S = input()
pos = l // 2
res = int(S)
if pos != 0 and S[pos] != '0':
	left = int(S[0:pos:1])
	right = int(S[pos:])
	res = left + right
pos = l // 2 - 1
while pos > 0:
	if S[pos] == '0':
		pos -= 1
	else:
		left = int(S[0:pos:1])
		right = int(S[pos:])
		res = min(res, left + right)
		break
pos = l // 2 + 1
while pos < l:
	if S[pos] == '0':
		pos += 1
	else:
		left = int(S[0:pos:1])
		right = int(S[pos:])
		res = min(left + right, res)
		break
print(res)


length = int(input())
num = input()
res = int(num)
right = (length + 1) // 2
left = right - 1
while left > 0 and num[left] == '0':
	left -= 1
while right < length and num[right] == '0':
	right += 1
if left > 0:
	res = min(res, int(num[:left]) + int(num[left:]))
if right < length:
	res = min(res, int(num[:right]) + int(num[right:]))
print(res)


L = int(input())
S = input()
arr = []
for i in range(1, L):
	if S[i] != '0':
		arr.append((abs(L - i - i), i))
arr.sort()
if len(arr) >= 2:
	print(min([int(S[:arr[0][1]]) + int(S[arr[0][1]:]), int(S[:arr[1][1]]) + int(S[arr[1][1]:])]))
else:
	print(int(S[:arr[0][1]]) + int(S[arr[0][1]:]))


l = int(input())
s = input()
x = l // 2
y = (l + 1) // 2
while x > -1 and s[x] == '0':
	x -= 1
while y < l and s[y] == '0':
	y += 1
a = 0
b = 0
for i in range(x):
	a = 10 * a + int(s[i])
for i in range(x, l):
	b = 10 * b + int(s[i])
ans = a + b
a = 0
b = 0
if y != l:
	for i in range(y):
		a = 10 * a + int(s[i])
	for i in range(y, l):
		b = 10 * b + int(s[i])
	print(min(ans, a + b))
else:
	print(ans)


l = int(input())
n = input()
mi = int(n)
for A in range(l // 2 - 1, l // 2 + 2):
	if A > 0 and A < len(n) and (n[:A][0] != '0') and (n[A:][0] != '0'):
		a = int(n[:A])
		b = int(n[A:])
		mi = min(mi, a + b)
if mi == int(n):
	i = l // 2
	while n[i] == '0':
		i -= 1
	if i > 0:
		mi = min(mi, int(n[:i]) + int(n[i:]))
	i = l // 2
	while i < len(n) and n[i] == '0':
		i += 1
	if i < len(n) and n[i] != '0':
		mi = min(mi, int(n[:i]) + int(n[i:]))
print(mi)


n = int(input())
s = input()
num = int(s)
p = n // 2 + 1
while p < n and s[p] == '0':
	p += 1
p -= 1
p = 10 ** (n - p - 1)
(l, r) = divmod(num, p)
m = l + r
p = n // 2
while p > -1 and s[p] == '0':
	p -= 1
p -= 1
p = 10 ** (n - p - 1)
(l, r) = divmod(num, p)
m = min(m, l + r)
print(m)


l = int(input())
n = input()
mid = l // 2
c = 0
v1 = v2 = int(n)
if n[mid] == '0':
	for i in n[mid:]:
		if i == '0':
			c += 1
		else:
			break
	if mid + c < l:
		v1 = int(n[:mid + c]) + int(n[mid + c:])
	c = 0
	for i in n[mid::-1]:
		if i == '0':
			c -= 1
		else:
			break
	if mid + c > 0:
		v2 = int(n[:mid + c]) + int(n[mid + c:])
	print(min(v1, v2))
elif mid + 1 < l:
	print(min(int(n[:mid + 1]) + int(n[mid + 1:]), int(n[:mid]) + int(n[mid:])))
else:
	print(int(n[:mid]) + int(n[mid:]))


def readint():
	return int(input())

def readfloat():
	return float(input())

def readarray(n, f=input):
	return [f() for i in range(n)]

def readlinearray(f=int):
	return list(map(f, input().split()))

def euclide(a, b):
	if a < 0:
		(g, x, y) = euclide(-a, b)
		return (g, -x, y)
	if b < 0:
		(g, x, y) = euclide(a, -b)
		return (g, x, -y)
	if b == 0:
		return (a, 1, 0)
	(g, x, y) = euclide(b, a % b)
	return (g, y, x - a // b * y)

def gen_primes(max):
	primes = [1] * (max + 1)
	for i in range(2, max + 1):
		if primes[i]:
			for j in range(i + i, max + 1, i):
				primes[j] = 0
	primes[0] = 0
	return [x for x in range(max + 1) if primes[x]]

def is_prime(N):
	if N % 2 == 0:
		return N == 2
	i = 3
	while i * i <= N:
		if N % i == 0:
			return False
		i += 2
	return True

def answer():
	return ''

def gcj():
	l = readint()
	s = input()
	best = int(s)
	for i in range(len(s) // 2, 0, -1):
		if s[i] != '0':
			best = min(best, int(s[:i]) + int(s[i:]))
			break
	for i in range(len(s) // 2 + 1, len(s)):
		if s[i] != '0':
			best = min(best, int(s[:i]) + int(s[i:]))
			break
	print(best)
gcj()


l = int(input())
n = input()
mid = l // 2
choose = []
for i in range(mid, l):
	if n[i] == '0':
		continue
	choose.append(int(n[:i]) + int(n[i:]))
	if len(choose) >= 3:
		break
for i in range(1, mid)[::-1]:
	if n[i] == '0':
		continue
	choose.append(int(n[:i]) + int(n[i:]))
	if len(choose) >= 6:
		break
choose.sort()
print(choose[0])


def main():
	buf = input()
	l = int(buf)
	buf = input()
	n = buf
	for i in range(l // 2, l):
		left = None
		right = None
		if n[i] != '0':
			left = i
		if n[-i] != '0':
			right = i
		if left and right:
			li = int(n[0:i]) + int(n[i:l])
			ri = int(n[0:l - i]) + int(n[l - i:l])
			print(min(li, ri))
			return
		elif left:
			print(int(n[0:i]) + int(n[i:l]))
			return
		elif right:
			print(int(n[0:l - i]) + int(n[l - i:l]))
			return
main()


def ans(string, sep, l):
	first = int(string[0:sep])
	second = int(string[sep:l])
	return first + second
l = int(input())
string = input()
mid = l // 2
a = 0
b = 0
for i in range(mid, 0, -1):
	if string[i] != '0':
		a = ans(string, i, l)
		break
for i in range(mid + 1, l):
	if string[i] != '0':
		b = ans(string, i, l)
		break
if a * b == 0:
	print(a + b)
else:
	print(min(a, b))


l = int(input())
n = input()
ans = float('inf')
if l & 1:
	(i, j) = (l // 2, l // 2 + 1)
	while j < l and n[j] == '0':
		j += 1
	while i > 0 and n[i] == '0':
		i -= 1
	if i:
		ans = min(ans, int(n[:i]) + int(n[i:]))
	if j != l:
		ans = min(ans, int(n[:j]) + int(n[j:]))
	print(ans)
else:
	(i, j) = (l // 2 - 1, l // 2)
	while j < l and n[j] == '0':
		j += 1
	while i > 0 and n[i] == '0':
		i -= 1
	if i:
		ans = min(ans, int(n[:i]) + int(n[i:]))
	if j != l:
		ans = min(ans, int(n[:j]) + int(n[j:]))
	print(ans)


n = int(input())
num = input()
start = len(num) // 2
ans = -1
for i in range(start, len(num) - 1):
	if num[i + 1] != '0':
		ans = int(num[:i + 1]) + int(num[i + 1:])
		break
for i in range(start):
	if num[start - i] != '0':
		if ans == -1 or int(num[:start - i]) + int(num[start - i:]) < ans:
			ans = int(num[:start - i]) + int(num[start - i:])
		break
print(ans)


l = int(input())
n = input()
x = l // 2
y = l // 2 + 1
while x > 0 and n[x] == '0':
	x = x - 1
while y < l and n[y] == '0':
	y = y + 1
a = int(n)
if x != 0:
	a = min(a, int(n[:x]) + int(n[x:]))
if y != l:
	a = min(a, int(n[:y]) + int(n[y:]))
print(a)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	n = ii()
	s = si()
	m = int(s)
	p = (n - 1) // 2
	for i in range(p, -1, -1):
		if s[i + 1] == '0':
			continue
		m = min(m, int(s[:i + 1]) + int(s[i + 1:]))
		break
	p = n // 2
	for i in range(p, n):
		if s[i] == '0':
			continue
		m = min(m, int(s[:i]) + int(s[i:]))
		break
	print(m)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
s = input()
j = (n + 1) // 2
i = j - 1
while i > 0 and s[i] == '0':
	i -= 1
while j < n and s[j] == '0':
	j += 1
print(min(int(s[:i] if i != 0 else 10 ** 100000) + int(s[i:]), int(s[:j]) + int(s[j:]) if j != n else 10 ** 100000))


n = int(input())
s = str(input())
mn = int(s)
pos = []
cnt = 0
for i in range(n // 2, n):
	if cnt < 3 and s[i] != '0':
		pos.append(i)
		cnt += 1
cnt = 0
for i in range(n // 2 - 1, 0, -1):
	if cnt < 3 and s[i] != '0':
		pos.append(i)
		cnt += 1
for i in pos:
	s1 = s[:i]
	s2 = s[i:]
	n1 = int(s1)
	n2 = int(s2)
	if n1 + n2 < mn:
		mn = n1 + n2
print(mn)


n = int(input())
s = input()
ans = int(s)
i1 = n // 2
i2 = i1 + 1
while s[i1] == '0' and i1 > 0:
	i1 = i1 - 1
while i2 < n and s[i2] == '0':
	i2 = i2 + 1
if i1 > 0:
	ans = int(s[0:i1]) + int(s[i1:])
if i2 < n:
	ans = min(ans, int(s[0:i2]) + int(s[i2:]))
print(ans)


n = int(input())
s = input()
ans = float('inf')
for i in range(n // 2, n - 1):
	if s[i + 1] != '0':
		ans = min(ans, int(s[:i + 1]) + int(s[i + 1:]))
		break
for i in range(n // 2 - 1, -1, -1):
	if s[i + 1] != '0':
		ans = min(ans, int(s[:i + 1]) + int(s[i + 1:]))
		break
print(ans)


n = int(input())
a = input()
ans = int(a)
for i in range(n // 2 + 1, n):
	if a[i] == '0':
		continue
	l = int(a[:i])
	r = int(a[i:])
	ans = min(ans, l + r)
	break
for i in range(n // 2, 0, -1):
	if a[i] == '0':
		continue
	l = int(a[:i])
	r = int(a[i:])
	ans = min(ans, l + r)
	break
print(ans)


def calc(s, a):
	return int(s[:a]) + int(s[a:])
n = int(input())
s = input()
if n % 2 == 0:
	if s[n // 2] != '0':
		print(calc(s, n // 2))
	else:
		a = n // 2 - 1
		b = n // 2
		while s[a] == '0' and s[b] == '0':
			a -= 1
			b += 1
		res = -1
		if s[a] != '0' and a > 0:
			res = calc(s, a)
		if s[b] != '0':
			if res < 0:
				res = calc(s, b)
			else:
				res = min(res, calc(s, b))
		print(res)
elif s[n // 2] != '0':
	res = calc(s, n // 2)
	if s[n // 2 + 1] != '0':
		res = min(res, calc(s, n // 2 + 1))
	print(res)
else:
	a = n // 2 - 1
	b = n // 2 + 1
	while s[a] == '0' and s[b] == '0':
		a -= 1
		b += 1
	res = -1
	if s[a] != '0' and a > 0:
		res = calc(s, a)
	if s[b] != '0':
		if res < 0:
			res = calc(s, b)
		else:
			res = min(res, calc(s, b))
	print(res)


n = int(input())
a = input()
ans = int('9' * 100010)
for i in range(n // 2, 0, -1):
	if a[i] != '0':
		ans = min(ans, int(a[i:]) + int(a[:i]))
		break
for i in range(n // 2 + 1, n):
	if a[i] != '0':
		ans = min(ans, int(a[i:]) + int(a[:i]))
		break
print(ans)


n = int(input())
s = str(input())
inf = 10 ** 10 ** 5
minsum = inf
flag = False
for i in range(n // 2, n):
	if s[i] != '0':
		flag = True
		minsum = min(minsum, int(s[:i]) + int(s[i:]))
	if s[n - i] != '0':
		flag = True
		minsum = min(minsum, int(s[:n - i]) + int(s[n - i:]))
	if flag:
		break
print(minsum)


l = int(input())
n = input()
i = l // 2 + 1
while i < l and n[i] == '0':
	i += 1
if i == l:
	ans = int(n)
else:
	ans = int(n[:i]) + int(n[i:])
i = l // 2
while i >= 0 and n[i] == '0':
	i -= 1
if not (l <= 3 and i == 0):
	ans = min(ans, int(n[:i]) + int(n[i:]))
print(ans)


a = int(input())
b = input()
d = a // 2
p = d
if a & 1:
	d = d + 1
while d < a:
	if b[d] is '0':
		d = d + 1
	else:
		break
while p > 0:
	if b[p] is '0':
		p = p - 1
	else:
		break
if d == a:
	ans = int(b[0:d])
else:
	ans = int(b[0:d]) + int(b[d:a])
if p == 0:
	ans1 = int(b)
else:
	ans1 = int(b[0:p]) + int(b[p:a])
print(min(ans, ans1))


k = int(input())
n = int(input())
s = str(n)
(x, y) = (-1, -1)
for i in reversed(range(k // 2 + 1)):
	if s[i] != '0':
		x = i
		break
for i in range(k // 2 + 1, k):
	if s[i] != '0':
		y = i
		break
(ans1, ans2) = (0, 0)
if x > 0:
	ans1 = int(s[:x]) + int(s[x:])
if y > 0:
	ans2 = int(s[:y]) + int(s[y:])
if ans1 == 0:
	print(ans2)
elif ans2 == 0:
	print(ans1)
else:
	print(min(ans1, ans2))


def main():
	n = int(input())
	s = input()
	s2 = ''
	s1 = ''
	mid = n // 2
	l = mid
	while s[l] == '0':
		l -= 1
	for i in range(l, n, 1):
		s2 += s[i]
	for i in range(0, l, 1):
		s1 += s[i]
	if len(s1) and len(s2):
		sum1 = int(s1) + int(s2)
	else:
		sum1 = int(s)
	p1 = ''
	p2 = ''
	l = mid
	while l + 1 < n and s[l + 1] == '0':
		l += 1
	for i in range(l + 1, n, 1):
		p2 += s[i]
	for i in range(0, l + 1, 1):
		p1 += s[i]
	if len(p1) and len(p2):
		sum2 = int(p1) + int(p2)
	else:
		sum2 = int(s)
	res = min(sum1, sum2)
	print(res)
main()


l = int(input())
s = input()
v = []
for i in range(1, len(s)):
	if s[i] != '0':
		v.append(i)
ans = 1e309
ch = int(s)
for i in range(0, len(v)):
	if v[i] > l // 2:
		ans = min(ans, int(ch // int(pow(10, l - v[i]))) + ch % int(pow(10, l - v[i])))
		if i > 0:
			ans = min(ans, int(ch // int(pow(10, l - v[i - 1]))) + ch % int(pow(10, l - v[i - 1])))
		break
ans = min(ans, int(ch // int(pow(10, l - v[len(v) - 1]))) + ch % int(pow(10, l - v[len(v) - 1])))
print(ans)


n = int(input())
s = input()

def cmp(x):
	s1 = s[:x]
	s2 = s[x:]
	if s1[0] != '0' and s2[0] != '0':
		return int(s1) + int(s2)
	else:
		return -1
m = -1
i = n // 2
h = 1
if n % 2 == 0:
	m = cmp(i)
	while m < 0:
		m2 = cmp(i + h)
		m1 = cmp(i - h)
		if m1 > 0 and m2 > 0:
			m = min(m1, m2)
		elif m1 > 0:
			m = m1
		elif m2 > 0:
			m = m2
		h += 1
else:
	m1 = cmp(i)
	m2 = cmp(i + 1)
	if m1 > 0 and m2 > 0:
		m = min(m1, m2)
	elif m1 > 0:
		m = m1
	elif m2 > 0:
		m = m2
	while m < 0:
		m2 = cmp(i + h)
		m1 = cmp(i - h)
		if m1 > 0 and m2 > 0:
			m = min(m1, m2)
		elif m1 > 0:
			m = m1
		elif m2 > 0:
			m = m2
		h += 1
print(m)


a = int(input())
l = input()
aa = 0
pi = -1
for i in range(a // 2 + 1, a, 1):
	if l[i] != '0':
		pi = i
		break
for i in range(a // 2, -1, -1):
	if l[i] != '0':
		aa = i
		break
mi = 10 ** 100000
if pi != -1:
	mi = min(mi, int(l[:pi]) + int(l[pi:]))
if aa != 0:
	mi = min(mi, int(l[:aa]) + int(l[aa:]))
print(mi)


n = int(input())
s = input()
d = n // 2
som = []
if n % 2 == 0:
	if s[d] != '0':
		som.append(int(s[0:d]) + int(s[d:]))
	else:
		mid = d
		while mid < n:
			if s[mid] != '0':
				break
			mid += 1
		if mid < n - 1:
			som.append(int(s[0:mid]) + int(s[mid:]))
		mid = d
		while mid >= 0:
			if s[mid] != '0':
				break
			mid -= 1
		if mid > 0:
			som.append(int(s[0:mid]) + int(s[mid:]))
else:
	if s[d + 1] != '0':
		som.append(int(s[0:d + 1]) + int(s[d + 1:]))
	if s[d] != '0':
		som.append(int(s[0:d]) + int(s[d:]))
	else:
		mid = d
		while mid < n:
			if s[mid] != '0':
				break
			mid += 1
		if mid < n - 1:
			som.append(int(s[0:mid]) + int(s[mid:]))
		mid = d
		while mid >= 0:
			if s[mid] != '0':
				break
			mid -= 1
		if mid > 0:
			som.append(int(s[0:mid]) + int(s[mid:]))
print(min(som))


n = int(input())
num = input()
ind = int(n / 2)
mini = int(num)
while num[ind] == '0':
	ind += 1
	if ind == n:
		break
for i in range(max(1, ind - 1), min(ind + 2, n)):
	if num[i] != '0':
		mini = min(mini, int(num[0:i]) + int(num[i:n]))
ind = int(n / 2)
while num[ind] == '0':
	ind -= 1
for i in range(max(1, ind - 1), min(ind + 2, n)):
	if num[i] != '0':
		mini = min(mini, int(num[0:i]) + int(num[i:n]))
print(mini)


size = int(input())
num = input()
j = (size + 1) // 2
i = j - 1
while i > 0 and num[i] == '0':
	i -= 1
while j < size and num[j] == '0':
	j += 1
res = int(num)
if i > 0:
	res = min(res, int(num[0:i]) + int(num[i:]))
if j < size:
	res = min(res, int(num[0:j]) + int(num[j:]))
print(res)


n = int(input())
s = input()
i = n // 2
while i < n and s[i] == '0':
	i += 1
ans = -1
if i != n:
	for newi in range(i - 3, i + 3):
		if newi <= 0 or newi >= n or s[newi] == '0':
			continue
		if ans == -1:
			ans = int(s[:newi]) + int(s[newi:])
		else:
			ans = min(ans, int(s[:newi]) + int(s[newi:]))
i = n // 2
while i >= 0 and s[i] == '0':
	i -= 1
if i != 0:
	for newi in range(i - 3, i + 3):
		if newi <= 0 or newi >= n or s[newi] == '0':
			continue
		if ans == -1:
			ans = int(s[:newi]) + int(s[newi:])
		else:
			ans = min(ans, int(s[:newi]) + int(s[newi:]))
print(ans)


from math import ceil

def findSum(str1, str2):
	if len(str1) > len(str2):
		temp = str1
		str1 = str2
		str2 = temp
	str3 = ''
	n1 = len(str1)
	n2 = len(str2)
	diff = n2 - n1
	carry = 0
	for i in range(n1 - 1, -1, -1):
		sum = ord(str1[i]) - ord('0') + int(ord(str2[i + diff]) - ord('0')) + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	for i in range(n2 - n1 - 1, -1, -1):
		sum = ord(str2[i]) - ord('0') + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	if carry:
		str3 += chr(carry + 48)
	str3 = str3[::-1]
	return str3
N = int(input())
S = input()
if N == 2:
	print(int(S[0]) + int(S[1]))
	exit()
if N & 1:
	Pointer = int(N // 2)
	if S[Pointer] != '0' and S[Pointer + 1] != '0':
		X = findSum(S[:Pointer], S[Pointer:])
		Y = findSum(S[:Pointer + 1], S[Pointer + 1:])
		print(min(int(X), int(Y)))
	elif S[Pointer] == '0' and S[Pointer + 1] != '0':
		X = findSum(S[:Pointer + 1], S[Pointer + 1:])
		print(X)
	elif S[Pointer + 1] == '0' and S[Pointer] != '0':
		X = findSum(S[:Pointer], S[Pointer:])
	else:
		First = -1
		Second = -1
		for i in range(Pointer + 1, N - 1):
			if S[i + 1] != '0':
				First = i + 1
				break
		for i in range(Pointer, 1, -1):
			if S[i - 1] != '0':
				Second = i - 1
				break
		if First == -1:
			X = findSum(S[:Second], S[Second:])
			print(X)
		elif abs(Pointer - First) > abs(Pointer - Second):
			X = findSum(S[:Second], S[Second:])
			print(X)
		elif abs(Pointer - First) == abs(Pointer - Second):
			X = findSum(S[:Second], S[Second:])
			Y = findSum(S[:First], S[First:])
			flag = 1
			if len(X) > len(Y):
				print(Y)
			elif len(X) == len(Y):
				for i in range(len(X)):
					if int(X[i]) > int(Y[i]):
						print(Y)
						flag = 0
						break
					elif int(X[i]) < int(Y[i]):
						print(X)
						flag = 0
						break
				if flag:
					print(X)
			else:
				print(Y)
		else:
			X = findSum(S[:First], S[First:])
			print(X)
else:
	Pointer = int(N / 2)
	if S[Pointer] != '0':
		X = findSum(S[:Pointer], S[Pointer:])
		print(X)
	else:
		First = -1
		Second = -1
		for i in range(Pointer, N - 1):
			if S[i + 1] != '0':
				First = i + 1
				break
		for i in range(Pointer, 1, -1):
			if S[i - 1] != '0':
				Second = i - 1
				break
		if First == -1:
			X = findSum(S[:Second], S[Second:])
			print(X)
		elif abs(Pointer - First) > abs(Pointer - Second):
			X = findSum(S[:Second], S[Second:])
			print(X)
		elif abs(Pointer - First) == abs(Pointer - Second):
			X = findSum(S[:Second], S[Second:])
			Y = findSum(S[:First], S[First:])
			flag = 1
			if len(X) > len(Y):
				print(Y)
			elif len(X) == len(Y):
				for i in range(len(X)):
					if int(X[i]) > int(Y[i]):
						print(Y)
						flag = 0
						break
					elif int(X[i]) < int(Y[i]):
						print(X)
						flag = 0
						break
				if flag:
					print(X)
			else:
				print(Y)
		else:
			X = findSum(S[:First], S[First:])
			print(X)


n = input()
no = input()
n = int(n)
if no[n // 2] != '0':
	ans = int(no[0:n // 2]) + int(no[n // 2:n + 1])
	if n // 2 + 1 < n and no[n // 2 + 1] != '0':
		b = int(no[0:n // 2 + 1]) + int(no[n // 2 + 1:n])
		ans = min(ans, b)
	if n // 2 + 2 < n and no[n // 2 + 2] != '0':
		b = int(no[0:n // 2 + 2]) + int(no[n // 2 + 2:n])
		ans = min(ans, b)
	if n // 2 - 1 > 0 and no[n // 2 - 1] != '0':
		c = int(no[0:n // 2 - 1]) + int(no[n // 2 - 1:n])
		ans = min(ans, c)
	if n // 2 - 2 > 0 and no[n // 2 - 2] != '0':
		c = int(no[0:n // 2 - 2]) + int(no[n // 2 - 2:n])
		ans = min(ans, c)
	print(ans)
else:
	x = n // 2
	y = n // 2
	while no[x] == '0':
		x -= 1
	while y < n and no[y] == '0':
		y += 1
	ans = -1
	if y < n and no[y] != '0':
		ans = int(no[0:y]) + int(no[y:n])
	if x > 0:
		b = int(no[0:x]) + int(no[x:n])
		if ans != -1:
			ans = min(ans, b)
		else:
			ans = b
	if x - 1 > 0 and no[x - 1] != '0':
		c = int(no[0:x - 1]) + int(no[x - 1:n])
		ans = min(ans, c)
	if x - 2 > 0 and no[x - 2] != '0':
		c = int(no[0:x - 2]) + int(no[x - 2:n])
		ans = min(ans, c)
	if y + 1 < n and no[y + 1] != '0':
		d = int(no[0:y + 1]) + int(no[y + 1:n])
		ans = min(ans, d)
	if y + 2 < n and no[y + 2] != '0':
		d = int(no[0:y + 2]) + int(no[y + 2:n])
		ans = min(ans, d)
	print(ans)


n = int(input())
s = str(input())
sLen = len(s)

def getSum(ss, cut):
	num1 = int(ss[0:int(cut)])
	num2 = int(ss[cut:])
	ans = num1 + num2
	return ans
split1 = -1
for i in range(int(sLen / 2) - 1, -1, -1):
	if s[i + 1] != '0':
		split1 = i + 1
		break
split2 = -1
for i in range(int(sLen / 2), sLen - 1, 1):
	if s[i + 1] != '0':
		split2 = i + 1
		break
(ans1, ans2, ans) = (0, 0, 0)
if split1 != -1:
	ans1 = getSum(s, split1)
if split2 != -1:
	ans2 = getSum(s, split2)
if split1 == -1 or split2 == -1:
	if split1 == -1:
		ans = ans2
	elif split2 == -1:
		ans = ans1
elif split1 != -1 and split2 != -1:
	ans = min(ans1, ans2)
print(ans)


n = int(input())
l = list(input())
inf = -1
ans = 0
left = []
right = []
for i in range(1, n // 2 + n % 2):
	if l[i] != '0':
		left.append(i)
for i in range(n // 2, n):
	if l[i] != '0':
		right.append(i)
for i in range(len(left) - 1, max(len(left) - 3, 0) - 1, -1):
	if ans == 0:
		ans = int(''.join(l[0:left[i]])) + int(''.join(l[left[i]:]))
	else:
		ans = min(ans, int(''.join(l[0:left[i]])) + int(''.join(l[left[i]:])))
for i in range(min(3, len(right))):
	if ans == 0:
		ans = int(''.join(l[0:right[i]])) + int(''.join(l[right[i]:]))
	else:
		ans = min(ans, int(''.join(l[0:right[i]])) + int(''.join(l[right[i]:])))
print(ans)


import math

def f(i, n):
	s1 = n // 10 ** i
	s2 = n % 10 ** i
	return s1 + s2
s = int(input())
n = int(input())
t = n.__str__()
ans = math.inf
k = 0
for i in range(0, s // 2 + 1):
	if t[s // 2 - i] != '0':
		k = s // 2 - i
		break
b = 0
for i in range(s // 2 + 1, s):
	if t[i] != '0':
		b = i
		break
print(min(f(s - k, n), f(s - b, n)))


n = int(input())
s = input()
num = int(s)
(pos1, pos2) = (len(s) // 2 - 1, len(s) // 2 + 1)
while pos1 >= 0 and s[pos1] == '0':
	pos1 -= 1
while pos2 < n and s[pos2] == '0':
	pos2 += 1
for i in range(max(1, pos1), min(n, pos2 + 1)):
	if s[i:][0] == '0':
		continue
	num = min(int(s[:i]) + int(s[i:]), num)
print(num)


l = int(input())
n = input()
index1 = l // 2
index2 = l // 2 if not l % 2 else l // 2 + 1
while True:
	num1 = n[:index1]
	num2 = n[index1:]
	num3 = n[:index2]
	num4 = n[index2:]
	if num1[0] == '0' or num2[0] == '0':
		if num3[0] == '0' or num4[0] == '0':
			index1 -= 1
			index2 += 1
		else:
			print(int(num3) + int(num4))
			break
	elif num3[0] == '0' or num4[0] == '0':
		print(int(num1) + int(num2))
		break
	else:
		print(min(int(num1) + int(num2), int(num3) + int(num4)))
		break


l = int(input())
s = input()
right = (l // 2, l // 2 + 1)[l % 2]
left = (l // 2 - 1, l // 2)[l % 2]
while right < l and s[right] == '0':
	right += 1
while s[left] == '0':
	left -= 1
if left == 0:
	left = right
if right == l:
	right = left
ans = min(int(s[:right]) + int(s[right:]), int(s[:left]) + int(s[left:]))
print(ans)


Len = int(input())
s = input()
r = (Len + 1) // 2
l = r - 1
while l > 0 and s[l] == '0':
	l = l - 1
while r < Len and s[r] == '0':
	r = r + 1
ans = int(s)
if l > 0:
	ans = min(ans, int(s[0:l]) + int(s[l:]))
if r < Len:
	ans = min(ans, int(s[0:r]) + int(s[r:]))
print(ans)


n = int(input())
s = input()
nm = 9999999
for i in range(n // 2, 0, -1):
	if s[i] != '0':
		nm = int(s[:i]) + int(s[i:])
		break
for i in range(n // 2 + 1, n):
	if s[i] != '0':
		nm = min(nm, int(s[:i]) + int(s[i:]))
		break
print(nm)


n = int(input())
l = str(input())
value = int(l)
if n % 2 == 0:
	i = int(n / 2)
	while i < n and l[i] == '0':
		i += 1
	if i != n:
		x = l[:i]
		y = l[i:]
		if x == '':
			x = 0
		if y == '':
			y = 0
		value = min(value, int(x) + int(y))
	i = int(n / 2) - 1
	while l[i] == '0' and i > 0:
		i -= 1
	x = l[:i]
	y = l[i:]
	if x == '':
		x = 0
	if y == '':
		y = 0
	value = min(value, int(x) + int(y))
else:
	i = int(n / 2) + 1
	while i < n and l[i] == '0':
		i += 1
	if i != n:
		x = l[:i]
		y = l[i:]
		if x == '':
			x = 0
		if y == '':
			y = 0
		value = min(value, int(x) + int(y))
	i = int(n / 2)
	while l[i] == '0' and i > 0:
		i -= 1
	x = l[:i]
	y = l[i:]
	if x == '':
		x = 0
	if y == '':
		y = 0
	value = min(value, int(x) + int(y))
print(value)


def getSum(s, rhInd):
	r1 = rhInd
	while r1 >= 0 and s[r1] == '0':
		r1 -= 1
	if r1 == 0:
		s1 = int(s)
	else:
		s1 = int(s[:r1]) + int(s[r1:])
	r2 = rhInd
	while r2 < len(s) and s[r2] == '0':
		r2 += 1
	if r2 == len(s):
		s2 = int(s)
	else:
		s2 = int(s[:r2]) + int(s[r2:])
	return min(s1, s2)
n = int(input())
s = input()
if n % 2 == 0:
	print(getSum(s, n // 2))
else:
	getSum(s, n // 2)
	getSum(s, n // 2 + 1)
	print(min(getSum(s, n // 2), getSum(s, n // 2 + 1)))


l = int(input())
num = input()
c1 = None
if l % 2 == 0:
	c1 = l // 2
else:
	c1 = l // 2 + 1
c2 = c1 - 1
while c2 > 0 and num[c2] == '0':
	c2 -= 1
while c1 < len(num) and num[c1] == '0':
	c1 += 1
if c2 != 0 and c1 < len(num):
	a = int(num[:c1]) + int(num[c1:])
	b = int(num[:c2]) + int(num[c2:])
	print(min(a, b))
elif c2 == 0:
	print(int(num[:c1]) + int(num[c1:]))
else:
	print(int(num[:c2]) + int(num[c2:]))


import math
l = int(input())
n = input()
i = l // 2
while i < l and n[i] == '0' or (l % 2 == 1 and i == l // 2):
	i += 1
ans1 = int(n[:i]) + int(n[i:]) if i < l else math.inf
i = l // 2
while i > 0 and n[i] == '0':
	i -= 1
ans2 = int(n[:i]) + int(n[i:]) if i > 0 else math.inf
print(min(ans1, ans2))


n = int(input())
m = input()
ans = 10 ** 110000
ind = n // 2
while ind >= 0:
	if m[ind] != '0':
		break
	ind -= 1
if ind > 0:
	ans = min(ans, int(m[:ind]) + int(m[ind:]))
ind = n // 2 + 1
while ind < n:
	if m[ind] != '0':
		break
	ind += 1
if ind < n:
	ans = min(ans, int(m[:ind]) + int(m[ind:]))
print(ans)


def solve():
	l = int(input())
	x_s = input()

	def calculate(split_pos):
		return int(x_s[:split_pos]) + int(x_s[split_pos:])
	lth = l
	pos = -1
	result = int(x_s)
	for i in range(1, l):
		if x_s[i] != '0':
			dl = max(i, l - i)
			if dl < lth:
				pos = i
			elif dl == lth:
				result = calculate(pos)
				pos = i
			lth = min(lth, dl)
	result = min(result, calculate(pos))
	return result
print(solve())


n = int(input())
s = str(input())
mid = len(s) // 2
index1 = -1
ans1 = -1
for i in range(mid, len(s)):
	if s[i] != '0':
		index1 = i
		break
if index1 != -1:
	ans1 = int(s[:index1]) + int(s[index1:])
index2 = -1
ans2 = -1
for i in range(mid, -1, -1):
	if s[i + 1] != '0':
		index2 = i
		break
if index2 != -1:
	ans2 = int(s[:index2 + 1]) + int(s[index2 + 1:])
if ans1 == -1:
	print(ans2)
elif ans2 == -1:
	print(ans1)
else:
	print(min(ans2, ans1))


l = int(input())
num = input()
pos = l // 2
ans = -1
c = 0
while pos >= 0 and c < 2:
	if pos + 1 < l and num[pos + 1] != '0':
		if ans == -1:
			ans = int(num[:pos + 1]) + int(num[pos + 1:])
		else:
			ans = min(ans, int(num[:pos + 1]) + int(num[pos + 1:]))
		c += 1
	pos -= 1
pos = l // 2 + 1
while pos < l - 1:
	if num[pos + 1] != '0':
		if ans == -1:
			ans = int(num[:pos + 1]) + int(num[pos + 1:])
		else:
			ans = min(ans, int(num[:pos + 1]) + int(num[pos + 1:]))
		break
	pos += 1
print(ans)


n = input()
r = input()
n = int(n)
ans = int(r)
for i in range(n // 2, 0, -1):
	j = r[0:i]
	k = r[i:n]
	if len(j) == 0 or len(k) == 0 or j[0] == '0' or (k[0] == '0'):
		continue
	int_j = int(j)
	int_k = int(k)
	ans = min(ans, int_j + int_k)
	break
for i in range(n // 2 + 1, n, 1):
	j = r[0:i]
	k = r[i:n]
	if len(j) == 0 or len(k) == 0 or j[0] == '0' or (k[0] == '0'):
		continue
	int_j = int(j)
	int_k = int(k)
	ans = min(ans, int_j + int_k)
	break
print(ans)


l = int(input())
s = str(input())
m = (l - 1) // 2
x1 = y1 = x2 = y2 = -5
ok = True
for i in range(l // 2):
	if m + i + 1 < l and s[m + i + 1] != '0':
		ok = False
		x1 = int(s[m + i + 1:])
		y1 = int(s[:m + i + 1])
	if m - i > 0 and s[m - i] != '0':
		ok = False
		x2 = int(s[m - i:])
		y2 = int(s[:m - i])
	if not ok:
		break
if x1 == -5:
	print(x2 + y2)
elif x2 == -5:
	print(x1 + y1)
else:
	print(min(x2 + y2, x1 + y1))


n = int(input())
s = input().strip()
l_non0 = [-1] * n
r_non0 = [-1] * n
for i in range(n):
	if s[i] == '0':
		l_non0[i] = -1 if i == 0 else l_non0[i - 1]
	else:
		l_non0[i] = i
for i in range(n - 1, -1, -1):
	if s[i] == '0':
		r_non0[i] = -1 if i == n - 1 else r_non0[i + 1]
	else:
		r_non0[i] = i
bl = max(0, n // 2 - 2)
br = min(n, n // 2 + 2)

def Calc(pos):
	return int(s[0:pos]) + int(s[pos:n])
ans = -1
for i in range(bl, br):
	if l_non0[i] != -1 and l_non0[i] != 0:
		tans = Calc(l_non0[i])
		if ans == -1 or ans > tans:
			ans = tans
	if r_non0[i] != -1 and r_non0[i] != 0:
		tans = Calc(r_non0[i])
		if ans == -1 or ans > tans:
			ans = tans
print(ans)


l = int(input())
n = input()
x = l // 2 - 1
res = int('9' * 100005)
while x < l - 1 and n[x + 1] == '0':
	x += 1
if x != l - 1:
	res = int(n[:x + 1]) + int(n[x + 1:])
x = l // 2
while x < l - 1 and n[x + 1] == '0':
	x -= 1
if x < l - 1:
	res = min(res, int(n[:x + 1]) + int(n[x + 1:]))
print(res)


n = int(input())
s = input()

def func(m):
	l = r = t = ''
	for i in range(0, m):
		l += s[i]
	for i in range(m, n):
		r += s[i]
	cn = 0
	for i in range(0, len(r)):
		if r[i] == '0':
			l += '0'
			cn = cn + 1
		else:
			break
	r = r[cn:]
	if len(l) == 0:
		x = int(r)
	elif len(r) == 0:
		x = int(l)
	else:
		x = int(l) + int(r)
	for i in range(len(l) - 1, -1, -1):
		if l[i] == '0':
			t += l[i]
		else:
			t += l[i]
			break
	t = t[::-1]
	l = l[:-len(t)]
	r = t + r
	if len(l) == 0:
		y = int(r)
	elif len(r) == 0:
		y = int(l)
	else:
		y = int(l) + int(r)
	return min(x, y)
if n % 2 == 0:
	m = n // 2
	print(func(m))
else:
	m = n // 2
	print(min(func(m), func(m + 1)))


n = int(input())
s = str(input())
m = n // 2
if n % 2 == 0:
	if s[m] == '0':
		left = m - 1
		right = n - 1
		for i in range(m, n):
			if s[i] != '0':
				right = i
				break
		for i in range(m, -1, -1):
			if s[i] != '0':
				left = i
				break
		if right == n - 1:
			print(int(str(s[0:max(left, 1)])) + int(str(s[left:n])))
		else:
			print(min(int(str(s[0:max(left, 1)])) + int(str(s[left:n])), int(str(s[0:max(1, right)])) + int(str(s[right:n]))))
	else:
		print(int(str(s[0:m])) + int(str(s[m:n])))
if n % 2 == 1:
	if s[m] == '0':
		left = m - 1
		right = n - 1
		for i in range(m, n):
			if s[i] != '0':
				right = i
				break
		for i in range(m, -1, -1):
			if s[i] != '0':
				left = i
				break
		print(min(int(str(s[0:max(left, 1)])) + int(str(s[left:n])), int(str(s[0:max(1, right)])) + int(str(s[right:n]))))
	else:
		ans1 = int(str(s[0:m])) + int(str(s[m:n]))
		ans2 = int(str(s[0:m + 1])) + int(str(s[m + 1:n]))
		s111 = str(s[m + 1:n])
		if s111[0] == '0':
			ans = ans1
		else:
			ans = min(ans1, ans2)
		print(ans)


n = int(input())
num = input()
mid = int(n / 2)
if n % 2 == 1:
	mid = mid + 1
ans = 0
if num[mid] != '0':
	ans1 = int(num[0:mid]) + int(num[mid:])
	if n % 2 == 1 and num[mid - 1] != '0':
		ans2 = int(num[0:mid - 1]) + int(num[mid - 1:])
		ans = min(ans1, ans2)
	else:
		ans = ans1
else:
	t_mid = mid
	ans1 = -1
	ans2 = -1
	while t_mid >= 0 and num[t_mid] == '0':
		t_mid = t_mid - 1
	if t_mid >= 0:
		ans1 = int(num[0:t_mid]) + int(num[t_mid:])
	t_mid = mid
	while t_mid < n and num[t_mid] == '0':
		t_mid = t_mid + 1
	if t_mid < n:
		ans2 = int(num[0:t_mid]) + int(num[t_mid:])
	if ans1 == -1:
		ans = ans2
	elif ans2 == -1:
		ans = ans1
	else:
		ans = min(ans1, ans2)
print(ans)


def fun(s, l):
	if l == 1:
		return int(s)
	else:
		i = l // 2
		j = i
		a = s[:i]
		b = s[j:]
		front = int(s)
		while 1:
			if b[0] == '0':
				j += 1
				i += 1
				a = s[:i]
				b = s[j:]
				if a == '' or b == '':
					break
			else:
				front = int(a) + int(b)
				break
		i = l // 2
		j = i
		a = s[:i + 1]
		b = s[j + 1:]
		if b == '':
			b = '0'
		back = int(s)
		while 1:
			if b[0] == '0':
				j -= 1
				i -= 1
				a = s[:i]
				b = s[j:]
				if a == '' or b == '':
					break
			else:
				back = int(a) + int(b)
				break
		return min(front, back)
		return mini
l = int(input())
s = input()
print(fun(s, l))


n = int(input())
s = input()
x = int(s)
y = 0
mn = 1e309
tp = 1
l = n // 2
r = n // 2
while s[l] == '0':
	l -= 1
while r < n and s[r] == '0':
	r += 1
l = max(1, l - 1)
r = min(n - 1, r + 1)
for i in range(l, r + 1):
	if s[i] != '0':
		x = int(s[:i])
		y = int(s[i:])
		mn = min(mn, x + y)
print(mn)


from sys import stdin, stdout
l = int(stdin.readline())
s = stdin.readline().strip()
mid = l // 2
front = s[:mid][::-1]
back = s[mid:]
i = 0
ll = len(back)
while i < ll:
	if back[i] != '0':
		break
	i += 1
j = 0
ll = l - ll
while j < ll:
	if front[j] != '0':
		break
	j += 1
best = int(s)
for loc in range(mid - i - 3, mid - i + 3):
	if loc <= 0 or loc >= l - 1 or s[loc] == '0':
		continue
	best = min(best, int(s[:loc]) + int(s[loc:]))
for loc in range(mid + j - 3, mid + j + 3):
	if loc <= 0 or loc > l - 1 or s[loc] == '0':
		continue
	best = min(best, int(s[:loc]) + int(s[loc:]))
stdout.write(str(best) + '\n')


n = int(input())
s = input()
lens = []
for i in range(len(s) - 1):
	if s[i + 1] != '0':
		lens.append((i, max(i + 1, len(s) - i - 1)))
mnlen = len(s) + 1
for (a, b) in lens:
	mnlen = min(mnlen, b)
ans = int('9' * (len(s) + 1))
for (a, b) in lens:
	if b == mnlen or b == mnlen + 1:
		ans = min(ans, int(s[:a + 1]) + int(s[a + 1:]))
print(ans)


n = int(input())
s = input()

def valid(l):
	return l > 0 and l < n
ANS = int(s)

def test(l):
	if not valid(l):
		return ANS
	sL = s[:l]
	sR = s[l:]
	if sL[0] == '0':
		return ANS
	if sR[0] == '0':
		return ANS
	L = int(s[:l])
	R = int(s[l:])
	M = L + R
	return M
l = n // 2
while valid(l - 1) and s[l - 1] == '0':
	l -= 1
ANS = test(l)
m = n // 2
while valid(m) and s[m] == '0':
	m -= 1
ANS = min(ANS, test(m))
m = n // 2
while valid(m) and s[m] == '0':
	m += 1
ANS = min(ANS, test(m))
r = n // 2 + 1
while valid(r) and s[r] == '0':
	r += 1
ANS = min(ANS, test(r))
print(ANS)


n = int(input())
s = input()
ans = 10 ** 100000 + 2
i = n // 2
j = n // 2 + 1
cp = 0
while i > 0:
	if s[i] != '0':
		cp += 1
		ans = ans = min(ans, int(s[0:i]) + int(s[i:n]))
	i -= 1
	if cp == 3:
		break
cp = 0
while j < n:
	if s[j] != '0':
		cp += 1
		ans = ans = min(ans, int(s[0:j]) + int(s[j:n]))
	j += 1
	if cp == 3:
		break
print(ans)


l = int(input())
n = input().strip()
m = l // 2
ans = int(n) * 2
for d in range(m, -1, -1):
	ok = False
	for x in [d, l - d]:
		if x > 0 and x < l and (n[x] != '0'):
			ok = True
			ans = min(ans, int(n[:x]) + int(n[x:]))
	if ok:
		break
print(ans)


l = int(input())
n = input()
good = l // 2
lgood = good - 1
rgood = good + 1
if n[good] != '0':
	print(min(int(n[:good]) + int(n[good:]), int(n[:1 + good]) + int(n[1 + good:])))
else:
	while lgood > 0 and n[lgood] == '0':
		lgood -= 1
	while rgood < l and n[rgood] == '0':
		rgood += 1
	if lgood == 0:
		a = float('inf')
	else:
		a = int(n[:lgood]) + int(n[lgood:])
	if rgood == l:
		b = float('inf')
	else:
		b = int(n[:rgood]) + int(n[rgood:])
	print(min(a, b))


def is_empty(x):
	return len(x) == 0

def has_leading_zero(x):
	return x[0] == '0'

def is_legal(x):
	return is_empty(x) or not has_leading_zero(x)

def safe_to_int(x):
	if len(x) == 0:
		return 0
	return int(x)
length_string = input()
number_string = input()
length = int(length_string)
ans = int(number_string)
if length == 1:
	ans = int(number_string)
else:
	border = middle = int((length + 1) / 2)
	while border >= 0:
		first = number_string[:border]
		second = number_string[border:]
		found = False
		if is_legal(first) and is_legal(second):
			tmp_ans = safe_to_int(first) + safe_to_int(second)
			ans = min(ans, tmp_ans)
			found = True
		other_border = length - border
		first = number_string[:other_border]
		second = number_string[other_border:]
		if is_legal(first) and is_legal(second):
			tmp_ans = safe_to_int(first) + safe_to_int(second)
			ans = min(ans, tmp_ans)
			found = True
		if found:
			break
		border = border - 1
print(ans)


n = int(input())
s = input()
h = (n + 1) // 2
ans = pow(10, 100000) + 9
for i in range(h, n):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
for i in range(h, 0, -1):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		break
h -= 1
if h > 0:
	for i in range(h, n):
		if s[i] != '0':
			ans = min(ans, int(s[:i]) + int(s[i:]))
			break
	for i in range(h, 0, -1):
		if s[i] != '0':
			ans = min(ans, int(s[:i]) + int(s[i:]))
			break
print(ans)


_ = int(input())
__ = input()
j = (_ + 1) // 2
i = j - 1
while i > 0 and __[i] == '0':
	i -= 1
while j < _ and __[j] == '0':
	j += 1
___ = int(__)
if i > 0:
	___ = min(___, int(__[0:i]) + int(__[i:]))
if j < _:
	___ = min(___, int(__[0:j]) + int(__[j:]))
print(___)


l = int(input())
n = input()
p = l // 2 + 1
res = int(n)
while p < l and n[p] == '0':
	p += 1
if p < l:
	res = min(res, int(n[:p]) + int(n[p:]))
p = l // 2
while p > 0 and n[p] == '0':
	p -= 1
if p > 0:
	res = min(res, int(n[:p]) + int(n[p:]))
print(res)


l = int(input())
a = input()
check = []
for i in range(l - 1):
	if a[i + 1] != '0':
		check.append([abs(i + 1 - (l - i - 1)), i])
check.sort()
ans = -1
d = check[0][0]
for i in check:
	if i[0] != d:
		break
	if ans == -1:
		ans = int(a[:i[1] + 1]) + int(a[i[1] + 1:])
	else:
		ans = min(ans, int(a[:i[1] + 1]) + int(a[i[1] + 1:]))
print(ans)


def summator(s, n):
	num_1 = int(s[:n])
	num_2 = int(s[n:])
	return num_1 + num_2

def main_sum(s, n, a, b):
	for i in range(n // 2):
		if s[a - i] != '0' or s[b + i] != '0':
			if s[a - i] == '0':
				sum_1 = summator(s, b + i)
				return sum_1
			elif s[b + i] == '0':
				sum_1 = summator(s, a - i)
				return sum_1
			else:
				sum_1 = summator(s, b + i)
				sum_2 = summator(s, a - i)
				if sum_1 > sum_2:
					return sum_2
				else:
					return sum_1
n = int(input())
number = input()
if n % 2 == 1:
	ans = main_sum(number, n, n // 2, n // 2 + 1)
elif number[n // 2] != '0':
	ans = summator(number, n // 2)
else:
	ans = main_sum(number, n, n // 2 - 1, n // 2 + 1)
print(ans)


n = int(input())
s = input()
if n % 2:
	k = n // 2
	if s[k] != '0':
		ans = int(s[:k]) + int(s[k:])
		if s[k + 1] != '0':
			ans1 = int(s[:k + 1]) + int(s[k + 1:])
			ans = min(ans, ans1)
	else:
		p = k + 1
		while p < len(s) and s[p] == '0':
			p += 1
		p1 = k
		while s[p1] == '0':
			p1 -= 1
		if p1 == 0:
			ans = int(s[:p]) + int(s[p:])
		else:
			ans = int(s[:p1]) + int(s[p1:])
		if p != len(s):
			ans1 = int(s[:p]) + int(s[p:])
			if ans1 < ans:
				ans = ans1
else:
	k = n // 2
	if s[k] != '0':
		ans = int(s[:k]) + int(s[k:])
		if k + 1 < len(s) and s[k + 1] != '0':
			ans1 = int(s[:k + 1]) + int(s[k + 1:])
			ans = min(ans, ans1)
	else:
		p = k
		while p < len(s) and s[p] == '0':
			p += 1
		p1 = k
		while s[p1] == '0':
			p1 -= 1
		if p1 == 0:
			ans = int(s[:p]) + int(s[p:])
		else:
			ans = int(s[:p1]) + int(s[p1:])
		if p != len(s):
			ans1 = int(s[:p]) + int(s[p:])
			if ans1 < ans:
				ans = ans1
print(ans)


n = int(input())
s = input()

def lol(k):
	global s, n, u
	if k <= 0 or k >= n or s[k] == '0':
		return
	x = s[0:k]
	y = s[k:]
	u = min(u, int(x) + int(y))
a = n // 2
while a - 1 >= 0 and s[a] == '0':
	a -= 1
b = n // 2
while b + 1 <= n - 1 and s[b] == '0':
	b += 1
u = int(s)
for i in range(-3, 4):
	lol(a + i)
	lol(b + i)
print(u)


n = int(input())
s = input()
ans = int(s)
l = n // 2
while l > 0 and s[l] == '0':
	l -= 1
if l > 0 and int(s[:l]) + int(s[l:]) < ans:
	ans = int(s[:l]) + int(s[l:])
r = n // 2 + 1
while r < n and s[r] == '0':
	r += 1
if r < n and int(s[:r]) + int(s[r:]) < ans:
	ans = int(s[:r]) + int(s[r:])
if s[1] != '0' and int(s[0]) + int(s[1:]) < ans:
	ans = int(s[0]) + int(s[1:])
if int(s[-1]) + int(s[:-1]) < ans:
	ans = int(s[0]) + int(s[1:])
print(ans)


l = int(input())
n = input()
mid = int(l / 2)
ans = int(n)
cnt = 0
for i in range(mid, 0, -1):
	if n[i] == '0':
		continue
	cnt += 1
	if cnt > 3:
		break
	a = int(n[0:i])
	b = int(n[i:])
	ans = min(ans, a + b)
cnt = 0
for i in range(mid + 1, l, 1):
	if n[i] == '0':
		continue
	cnt += 1
	if cnt > 3:
		break
	a = int(n[0:i])
	b = int(n[i:])
	ans = min(ans, a + b)
print(ans)


L = int(input())
X = input()
ans = float('inf')
cnt = 0
idx = L // 2
while cnt < 5 and idx >= 1:
	if X[idx] != '0':
		ans = min(ans, int(X[:idx]) + int(X[idx:]))
		cnt += 1
	idx -= 1
cnt = 0
idx = L // 2
while cnt < 5 and idx < L:
	if X[idx] != '0':
		ans = min(ans, int(X[:idx]) + int(X[idx:]))
		cnt += 1
	idx += 1
print(ans)


n = int(input())
arr = input()
arr1 = []
arr2 = []
arr3 = []
arr4 = []
if len(arr) % 2 == 0:
	i = len(arr) // 2
	j = len(arr) // 2 - 1
else:
	i = len(arr) // 2
	j = len(arr) // 2
while arr[i] == '0' and i < len(arr) - 1:
	i += 1
while arr[j] == '0' and j > 0:
	j -= 1
if i == len(arr):
	i -= 1
if j == 0:
	j += 1
arr1 = arr[:i]
arr2 = arr[i:]
if len(arr) % 2 == 0:
	arr3 = arr[:j]
	arr4 = arr[j:]
elif arr[j + 1] == '0' and j - 1 != -1:
	arr3 = arr[:j]
	arr4 = arr[j:]
else:
	arr3 = arr[:j + 1]
	arr4 = arr[j + 1:]
flag1 = 0
flag2 = 0
if arr2[0] == '0':
	flag1 = 1
if arr4[0] == '0':
	flag2 = 1
x1 = int(arr1)
x2 = int(arr2)
y1 = int(arr3)
y2 = int(arr4)
if flag1 == 1 and flag2 == 0:
	print(y1 + y2)
elif flag1 == 0 and flag2 == 1:
	print(x1 + x2)
elif flag1 == 0 and flag2 == 0:
	if x1 + x2 >= y1 + y2:
		print(y1 + y2)
	else:
		print(x1 + x2)


n = int(input())
s = input()
poss = []
for i in range(1, n):
	if s[i] != '0':
		poss.append((abs(i - (n - i)), i))
poss = sorted(poss)

def build(n, s, idx):
	a = int(s[0:idx[1]])
	b = int(s[idx[1]:])
	return a + b
v1 = build(n, s, poss[0])
if len(poss) > 1:
	v2 = build(n, s, poss[1])
	print(min(v1, v2))
else:
	print(v1)


n = int(input())
s = input()
j = 0
k = 0
if n % 2 == 0:
	if s[n // 2] != '0':
		print(int(s[:n // 2]) + int(s[n // 2:]))
	else:
		for i in range(n):
			if s[i] != '0' and i < n // 2:
				j = i
			elif s[i] != '0':
				k = i
				break
		if j == 0:
			print(int(s[:k]) + int(s[k:]))
		elif k == 0:
			print(int(s[:j]) + int(s[j:]))
		else:
			print(min(int(s[:j]) + int(s[j:]), int(s[:k]) + int(s[k:])))
else:
	for i in range(n):
		if s[i] != '0' and i <= n // 2:
			j = i
		elif s[i] != '0':
			k = i
			break
	if j == 0:
		print(int(s[:k]) + int(s[k:]))
	elif k == 0:
		print(int(s[:j]) + int(s[j:]))
	else:
		print(min(int(s[:j]) + int(s[j:]), int(s[:k]) + int(s[k:])))


import math
n = int(input())
s = input()
mid = n // 2
mid1 = mid
mid2 = mid + 1
if s[mid] == '0':
	mid1 = mid
	while s[mid1] == '0' and mid1 < n - 1:
		mid1 += 1
	mid2 = mid
	while s[mid2] == '0' and mid2 >= 0:
		mid2 -= 1
n1 = s[:mid1]
n2 = s[mid1:]
m1 = s[:mid2]
m2 = s[mid2:]
flag1 = 0
flag2 = 0
if len(n1) == 0 or len(n2) == 0 or n1 == '0' or (n2 == '0'):
	flag1 = 1
if len(m1) == 0 or len(m2) == 0 or m1 == '0' or (m2 == '0'):
	flag2 = 1
ans = math.inf
if flag1 == 0:
	ans = min(int(n1) + int(n2), ans)
if flag2 == 0:
	ans = min(int(m1) + int(m2), ans)
print(ans)


n = int(input())
s = input()
ans = -1
mid = int(n / 2)
while s[mid] == '0':
	mid = mid - 1
if mid in [0, n]:
	k = 1
elif ans == -1:
	ans = int(s[:mid]) + int(s[mid:])
else:
	ans = min(int(s[:mid]) + int(s[mid:]), ans)
mid = int(n / 2) - 1
while mid != n and s[mid] == '0':
	mid = mid + 1
if mid in [0, n]:
	k = 1
elif ans == -1:
	ans = int(s[:mid]) + int(s[mid:])
else:
	ans = min(int(s[:mid]) + int(s[mid:]), ans)
mid = int(n / 2) + 1
while mid != n and s[mid] == '0':
	mid = mid + 1
if mid in [0, n]:
	k = 1
elif ans == -1:
	ans = int(s[:mid]) + int(s[mid:])
else:
	ans = min(int(s[:mid]) + int(s[mid:]), ans)
print(ans)


n = int(input())
s = input()
lim = n // 2
ans = -1
cnt = 0
for i in range(lim, 0, -1):
	if cnt >= 3:
		break
	if s[i] == '0':
		continue
	res = int(s[0:i]) + int(s[i:])
	if ans == -1:
		ans = res
	else:
		ans = min(ans, res)
	cnt += 1
cnt = 0
for i in range(lim, n):
	if cnt >= 3:
		break
	if s[i] == '0':
		continue
	res = int(s[0:i]) + int(s[i:])
	if ans == -1:
		ans = res
	else:
		ans = min(ans, res)
	cnt += 1
print(ans)


n = int(input())
s = input()
mas = []
for i in s:
	mas.append(int(i))
centr = n // 2
(pos1, pos2) = (0, 0)
for i in range(centr, n):
	if s[i] != '0':
		pos1 = i
		break
for i in range(centr, -1, -1):
	if s[i] != '0':
		pos2 = i
		break
ans = []
var1 = (s[:pos2], s[pos2:])
var2 = (s[:pos1], s[pos1:])
if len(var1[0]) > 0 and len(var1[1]) > 0:
	ans.append(int(var1[0]) + int(var1[1]))
if len(var2[0]) > 0 and len(var2[0]) > 0:
	ans.append(int(var2[0]) + int(var2[1]))
if pos1 != n - 1 and s[pos1 + 1] != '0':
	ans.append(int(s[:pos1 + 1]) + int(s[pos1 + 1:]))
ans.sort()
print(ans[0])


l = int(input())
s = input()
ans = int(s)
for i in range(max(1, l // 2 - 2), l):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		if i >= l // 2 + 2:
			break
for i in range(min(l - 1, l // 2 + 2), 0, -1):
	if s[i] != '0':
		ans = min(ans, int(s[:i]) + int(s[i:]))
		if i <= l // 2 - 2:
			break
print(ans)


n = int(input())
s = input()
dt = [n + 10] * n
for i in range(n):
	if i > 0 and s[i] != '0':
		dt[i] = max([i, n - i])
mn = min(dt)
ans = int(s)
for i in range(n):
	if dt[i] == mn:
		ans = min([ans, int(s[:i]) + int(s[i:])])
print(ans)


def res(digits):
	if '0' not in digits:
		if len(digits) % 2 == 0:
			return int(digits[:len(digits) // 2]) + int(digits[len(digits) // 2:])
		else:
			mid = len(digits) // 2
			return min(int(digits[:mid]) + int(digits[mid:]), int(digits[:mid + 1]) + int(digits[mid + 1:]))
	else:
		mid = len(digits) // 2
		i = mid
		while i > 0 and digits[i] == '0':
			i -= 1
		closestNonZeroL = i
		i = mid
		while i < len(digits) and digits[i] == '0':
			i += 1
		closestNonZeroR = i
		sum1 = int(digits[:closestNonZeroL]) + int(digits[closestNonZeroL:]) if closestNonZeroL > 0 else int(digits)
		sum2 = int(digits[:closestNonZeroR]) + int(digits[closestNonZeroR:]) if closestNonZeroR > 0 and closestNonZeroR < len(digits) else int(digits)
		i = mid - 1
		while i > 0 and digits[i] == '0':
			i -= 1
		closestNonZeroL = i
		i = mid - 1
		while i < len(digits) and digits[i] == '0':
			i += 1
		closestNonZeroR = i
		sum3 = int(digits[:closestNonZeroL]) + int(digits[closestNonZeroL:]) if closestNonZeroL > 0 else int(digits)
		sum4 = int(digits[:closestNonZeroR]) + int(digits[closestNonZeroR:]) if closestNonZeroR > 0 and closestNonZeroR < len(digits) else int(digits)
		return min(min(sum1, sum2), min(sum3, sum4))
l = int(input())
digs = input()
print(str(res(digs)))


import math
l = int(input())
num = input()
if l % 2 == 0:
	mid = l // 2
	i = 0
	while True:
		r = mid + i
		l = mid - i
		ans = []
		if num[r] != '0':
			ans.append(int(num[:r]) + int(num[r:]))
		if num[l] != '0':
			ans.append(int(num[:l]) + int(num[l:]))
		if len(ans) != 0:
			if len(ans) == 1:
				print(ans[0])
			else:
				print(min(ans[0], ans[1]))
			break
		i = i + 1
else:
	mid = l // 2
	i = 0
	while True:
		r = mid + i + 1
		l = mid - i
		ans = []
		if num[r] != '0':
			ans.append(int(num[:r]) + int(num[r:]))
		if num[l] != '0':
			ans.append(int(num[:l]) + int(num[l:]))
		if len(ans) != 0:
			if len(ans) == 1:
				print(ans[0])
			else:
				print(min(ans[0], ans[1]))
			break
		i = i + 1


l = int(input())
n = input()
p = 1 if l & 1 else 0
while n[l + p >> 1] == '0' and n[l - p >> 1] == '0':
	p += 2
if n[l + p >> 1] == '0':
	print(int(n[l - p >> 1:]) + int(n[:l - p >> 1]))
elif n[l - p >> 1] == '0':
	print(int(n[l + p >> 1:]) + int(n[:l + p >> 1]))
else:
	print(min(int(n[l + p >> 1:]) + int(n[:l + p >> 1]), int(n[l - p >> 1:]) + int(n[:l - p >> 1])))


from math import inf
n = int(input())
ss = input()
minn = inf
if n % 2 == 0:
	k = n // 2
	(i1, i2) = (k, k)
	while ss[i1] == '0':
		i1 += 1
		if i1 == n:
			break
	while ss[i2] == '0':
		i2 -= 1
	if i1 == n:
		print(int(ss[:i2]) + int(ss[i2:]))
	else:
		print(min(int(ss[:i1]) + int(ss[i1:]), int(ss[:i2]) + int(ss[i2:])))
if n % 2 != 0:
	k = n // 2
	k1 = n // 2 + 1
	while ss[k] == '0':
		k += 1
		if k == n:
			break
	while ss[k1] == '0':
		k1 -= 1
	if k == n:
		print(int(ss[:k1]) + int(ss[k1:]))
	else:
		print(min(int(ss[:k]) + int(ss[k:]), int(ss[:k1]) + int(ss[k1:])))