1220: 最大的乘积

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:31 Solved:11

Description

给定一个正整数$m$和一个正整数$n$,使用$m$个乘号插入到数字中,且两个乘号不能相邻,插入后生成一个乘法算式。

找出一种使乘法算式数值最大的插入方式,并将结果输出。(乘号不能放在字符串的首尾位置)

如 $m=2$,$n=123456$,插入$2$个乘号。插入方式有:

$1\ast 2\ast3456=6912$,$1\ast23\ast456=10488$,$1\ast234\ast56=13104$,$1\ast2345\ast6=14070$,$12\ast3\ast456=16416$,
$12\ast34\ast56=22848$,$12\ast345\ast6=24840$,$123\ast4\ast56=27552$,$123\ast45\ast6=33210$,$1234\ast5\ast6=37020$。

乘法算式数值最大的是第十种,为 $37020$。

Input

共两行。

第一行,包含一个正整数$m$。

第二行,包含一个正整数$n$,表示在数字$n$中要插入$m$个乘号。

Output

输出一个整数,表示最大乘积数值。

Sample Input Copy

2
123456

Sample Output Copy

37020

HINT

$1$ ≤ $m$ ≤ $5$;
$10$$5$ ≤ $n$ < $10$$20$