#jag2017summerday3e. [jag2017summer_day3_e]Route Calculator

[jag2017summer_day3_e]Route Calculator

MathJax.Hub.Config({ tex2jax: { inlineMath: [["","",""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 16px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }

Problem Statement

You have a grid with HH rows and WW columns. H+WH+W is even. We denote the cell at the ii-th row from the top and the jj-th column from the left by (i,j)(i, j). In any cell (i,j)(i, j), an integer between 11 and 99 is written if i+ji+j is even, and either + or * is written if i+ji+j is odd.

You can get a mathematical expression by moving right or down H+W2H+W-2 times from (1,1)(1,1) to (H,W)(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)(1, 1) to (H,W)(H, W). If the maximum value is 101510^{15} or less, print the value. Otherwise, print 1-1.


Input

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

HH WW a_1,1a\_{1,1} cdots\\cdots a_1,Wa\_{1,W} ldots\\ldots a_H,1a\_{H,1} cdots\\cdots a_H,Wa\_{H,W}

The first line consists of two integers HH and WW (1leH,Wle501 \\le H,W \\le 50). It is guaranteed that H+WH+W is even. The following HH lines represent the characters on the grid. a_i,ja\_{i,j} represents the character written in the cell (i,j)(i,j). In any cell (i,j)(i, j), an integer between 11 and 99 is written if i+ji+j is even, and either + or * is written if i+ji+j is odd.

Output

Print the answer in one line.


Sample Input 1

3 3
1+2
+9*
1*5

Output for Sample Input 1

46

The maximum value is obtained by passing through the following cells: (1,1)(1,1), (2,1)(2,1), (2,2)(2,2), (2,3)(2,3), (3,3)(3,3).


Sample Input 2

1 31
9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9

Output for Sample Input 2

-1

You can obtain 9169^{16}, but it's too large.


Sample Input 3

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

Output for Sample Input 3

10

Sample Input 4

9 7
8+9*4*8
*5*2+3+
1*3*2*2
*5*1+9+
1+2*2*2
*3*6*2*
7*7+6*5
*5+7*2+
3+3*6+8

Output for Sample Input 4

86408