P8843 [AOJ] Route Calculator
普及
题目描述

You have a grid with $H$ rows and $W$ columns. $H + W$ is even. We denote the cell at the $i$-th row from the top and the $j$-th column from the left by ($i, j$). In any cell ($i, j$), an integer between $1$ and $9$ is written if $i+j$ is even, and either '+' or '*' is written if $i+j$ is odd.

You can get a mathematical expression by moving right or down $H + W - 2$ times from ($1, 1$) to ($H, W$) and concatenating all the characters written in the cells you passed in order. Your task is to maximize the calculated value of the resulting mathematical expression by choosing an arbitrary path from ($1, 1$) to ($H, W$). If the maximum value is $10^{15}$ or less, print the value. Otherwise, print $-1$.

Input

The input consists of a single test case in the format below.

$H$ $W$
$a_{1,1}$ ... $a_{1,W}$
...
$a_{H,1}$ ... $a_{H,W}$

The first line consists of two $H$ integers and $W$ ($1 \leq H, W \leq 50$). It is guaranteed that $H + W$ is even. The following $H$ lines represent the characters on the grid. $a_{i,j}$ represents the character written in the cell ($i, j$). In any cell ($i, j$), an integer between $1$ and $9$ is written if $i+j$ is even, and either '+' or '*' is written if $i+1$ is odd.

Output

Print the answer in one line.

Examples

Input

3 3
1+2
+9
1
5

Output

46

Input

1 31
999999999999999*9

Output

-1

Input

5 5
2+2+1
+1+1+
1+2+2
+1+1+
1+1+2

Output

10

Input

9 7
8+948
52+3+
1322
51+9+
1+2
22
362
7
7+65
5+72+
3+3
6+8

Output

86408

输入格式

见题面

输出格式

见题面

样例输入
5 5 2+2+1 +1+1+ 1+2+2 +1+1+ 1+1+2
样例输出
10