Codeforces Round 567 (Div. 2)
B
Split a Number
Codeforces
1500
原题
← AD →
翻译中…

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.

翻译中…

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.

翻译中…

样例

Input #1
7
1234567
Output #1
1801
InputCopy OutputCopy
Input #2
3
101
Output #2
11
InputCopy OutputCopy
题目信息
题号
1181B
时间限制
2 s
内存限制
512 MB
标签
贪心
模拟
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。