#D5306. Route Calculator
Route Calculator
Route Calculator
You have a grid with rows and columns. is even. We denote the cell at the -th row from the top and the -th column from the left by (). In any cell (), an integer between and is written if is even, and either '+' or '*' is written if is odd.
You can get a mathematical expression by moving right or down times from () to () 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 () to (). If the maximum value is or less, print the value. Otherwise, print .
Input
The input consists of a single test case in the format below.
... ... ...
The first line consists of two integers and (). It is guaranteed that is even. The following lines represent the characters on the grid. represents the character written in the cell (). In any cell (), an integer between and is written if is even, and either '+' or '*' is written if 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+222 362* 77+65 5+72+ 3+3*6+8
Output
86408
inputFormat
Input
The input consists of a single test case in the format below.
... ... ...
The first line consists of two integers and (). It is guaranteed that is even. The following lines represent the characters on the grid. represents the character written in the cell (). In any cell (), an integer between and is written if is even, and either '+' or '*' is written if is odd.
outputFormat
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+222 362* 77+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