Vanya is doing his maths homework. He has an expression of form <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/12fd75e59feeb788ff8b791f7194301b0d005ad6.png" style="max-width: 100.0%;max-height: 100.0%;"/>, where *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub> are digits from 1 to 9, and sign <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/5535bcdec4c47f48bc7dcaaf51ba2b5901a202e5.png" style="max-width: 100.0%;max-height: 100.0%;"/> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expression so that to maximize the value of the resulting expression.
The first line contains expression *s* (1 ≤ |*s*| ≤ 5001, |*s*| is odd), its odd positions only contain digits from 1 to 9, and even positions only contain signs  +  and  * . 

The number of signs  *  doesn't exceed 15.
s = input()
x = []
for i in range(0, len(s), 2):
    x.append(int(s[i]))

f = [] * len(s)
for i in range(len(s)):
    f.append([0] * len(s))
for i in range(0, len(s), +2):
    f[i][i], cur, sum = int(s[i]), int(s[i]), 0
    for j in range(i + 2, len(s), +2):
        if s[j - 1] == '*':
            f[i][j] = sum + cur * int(s[j])
            cur *= int(s[j])
        else:
            f[i][j] = sum + cur + int(s[j])
            sum += cur
            cur = int(s[j])

left, right = [-1] * len(s), [len(s)] * len(s)
for i in range(0, len(s), +2):
    if i - 2 >= 0:
        left[i] = left[i - 2]
    if i - 1 >= 0 and s[i - 1] == '+':
        left[i] = i - 1
for i in range(len(s) - 1, -1, -2):
    if i + 2 < len(s):
        right[i] = right[i + 2]
    if i + 1 < len(s) and s[i + 1] == '+':
        right[i] = i + 1

ans = -1
for i in range(0, len(s), +2):
    for j in range(i, len(s), +2):
        sum = 0
        cur = f[i][j]
        if i - 2 >= 0 and left[i - 2] - 1 >=0:
            sum += f[0][left[i - 2] - 1]
        if j + 2<len(s) and right[j + 2] + 1<len(s):
            sum += f[j + 2][right[j + 2] + 1]
        if i - 1 >= 0:
            if s[i - 1]=='*':
                cur*=f[left[i - 2] + 1][i - 2]
            else:
               sum += f[left[i - 2] + 1][i - 2]
        if j + 1<len(s):
            if s[j + 1]=='*':
                cur*=f[j + 2][right[i + 2] - 1]
            else:
                sum += f[j + 2][right[i + 2] - 1]
        ans = max(ans, sum + cur)
print(ans)
# Tue Oct 15 2019 15:48:50 GMT+0300 (MSK)
