Problem3007--整数串拆段

3007: 整数串拆段

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

将一个长度小于 lns="http://www.w3.org/1998/Math/MathML">10 位的数字串拆成 lns="http://www.w3.org/1998/Math/MathML">2 段,使其和为最小的素数。

例如数字串“13304” ,拆的方法有:

1 + 3304 = 3305 
13 + 304 = 317 
133 + 04 = 137 
1330 + 4 = 1334 

从上面可看出,和为素数的有:lns="http://www.w3.org/1998/Math/MathML">317 与 lns="http://www.w3.org/1998/Math/MathML">137 ,最小的是lns="http://www.w3.org/1998/Math/MathML">137

Input

一个长度小于 lns="http://www.w3.org/1998/Math/MathML">10 的数字串。

Output

最小的和为素数的数,若无素数则输出 lns="http://www.w3.org/1998/Math/MathML">-1

Sample Input Copy

13304

Sample Output Copy

137

Source/Category