Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] 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.


-----Input-----

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.


-----Output-----

In the first line print the maximum possible value of an expression.


-----Examples-----
Input
3+5*7+8*4

Output
303

Input
2+3*5

Output
25

Input
3*4*5

Output
60



-----Note-----

Note to the first sample test. 3 + 5 * (7 + 8) * 4 = 303.

Note to the second sample test. (2 + 3) * 5 = 25.

Note to the third sample test. (3 * 4) * 5 = 60 (also many other variants are valid, for instance, (3) * 4 * 5 = 60).

Difficulty: interview

Starter code:

Solutions:
s = input()
res = eval(s)
n = len(s)
for i in range(-1, n):
    if i == -1 or s[i] == '*':
        for j in range(i + 1, n + 1):
            if j == n or s[j] == '*':
                new_s = s[0:i + 1] + "(" + s[i + 1:j] + ")" + s[j:n]
                res = max(res, eval(new_s))
print(res)


# -*- coding: utf-8 -*-
from collections import deque

s = input()
n = len(s)

ans = eval(s)

for i in range(n):
    if s[i] == '*':
        _s = '(' + s[:i] + ')' + s[i:]
        ans = max(ans, eval(_s))
        _s = s[:i + 1] + '(' + s[i + 1:] + ')'
        ans = max(ans, eval(_s))
        for j in range(i):
            if s[j] == '*':
                _s = s[:j + 1] + '(' + s[j + 1:i] + ')' + s[i:]
                ans = max(ans, eval(_s))
        
print(ans)

from heapq import heapify, heappush, heappop
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit, maxsize
from bisect import bisect_left, bisect, insort_left, insort
from math import ceil, log, factorial, hypot, pi
from fractions import gcd
from copy import deepcopy
from functools import reduce
from operator import mul
from itertools import product, permutations, combinations, accumulate, cycle
from string import ascii_uppercase, ascii_lowercase, ascii_letters, digits, hexdigits, octdigits

prod = lambda l: reduce(mul, l)
prodmod = lambda l, mod: reduce(lambda x, y: mul(x,y)%mod, l)

def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

exp = read_line(str)
len_exp = len(exp)
ans = eval(exp)
mul_p = [i for i, s in enumerate(exp) if s == '*']
mul_p = [-1] + mul_p + [len(exp)]
for i1, i2 in combinations(mul_p, 2):
#    print(exp[:i1+1], exp[i1+1:i2], exp[i2:])
    ans = max(ans, eval('{}({}){}'.format(exp[:i1+1], exp[i1+1:i2], exp[i2:])))
print(ans)
        



    


def __starting_point():
    s = input()
    pos = [-1]
    for i, x in enumerate(s):
        if x == '*':
            pos.append(i)

    pos.append(len(s))
    max_v = 0

    for i in range(len(pos) - 1):
        for j in range(i + 1, len(pos)):
            a = pos[i] + 1
            b = pos[j]
            ns = s[:a] + '(' + s[a : b] + ')' + s[b:]
            e = eval(ns)
            if e > max_v:
                max_v = e

    print(max_v)
__starting_point()

s = input()
ma = eval(s)
for i in range(len(s)):
    if s[i] == '*':
        s1 = s[:i]
        s2 = s[i - len(s) + 1:]
        s3 = '(' + s1 + ')*' + s2
        ma = max(ma, eval(s3))
        s3 = s1 + '*(' + s2 + ')'
        ma = max(ma, eval(s3))
        for j in range(i):
            if s[j] == '*':
                s1 = s[:j]
                s3 = s[j + 1:i-len(s)]
                s4 = (s1 + '*(' + s3 + ')*' + s2)
                ma = max(ma, eval(s4))
print(ma)


s = input()
s = "0+1*" + s + "*1+0"
n = len(s)
ans = eval(s)
p = []
for i in range(0, n):
    if s[i] == '*':
        p.append(i)
for i in p:
    for j in p:
        if i >= j:
            continue
        if s[i] == '*' and s[j] == '*':
            t = s[:i+1] + "(" + s[i+1:j] + ")" + s[j:]
            res = eval(t)
            if res > ans:
                ans = res
print(ans)

s = input()
ans = eval(s)
for i in range(len(s)-1):
    if s[i] == "*":
        k = "(" + s[0:i] + ")" + s[i:len(s)]
        t = eval(k)
        if t > ans:
            ans = t
        k = s[0:i+1] + "(" + s[i+1:len(s)] + ")"
        t = eval(k)
        if t > ans:
            ans = t
        for j in range(i+2, len(s)):
            if s[j] == "*":
                k = s[0:i+1] + "(" + s[i+1:j] + ")" + s[j:len(s)]
                t = eval(k)
                if t > ans:
                    ans = t
print(ans)

qw = input()
g = ['*']
s = [1]
for i in range(len(qw)):
    if i % 2 == 0:
        s.append(int(qw[i]))
    else:
        g.append(qw[i])
c = 0
g.append('*')
s.append(1)
for i in range(len(g)):
    if g[i] == '*':
        for j in range(i + 1, len(g)):
            if g[j] == '*':
                a = 0
                b = s[0]
                for k in range(i):
                    if g[k] == '*':
                        b *= s[k + 1]
                    else:
                        a += b
                        b = s[k + 1]
                v = a
                w = b
                a = 0
                b = s[i + 1]
                for k in range(i + 1, j):
                    if g[k] == '*':
                        b *= s[k + 1]
                    else:
                        a += b
                        b = s[k + 1]
                b = w * (a + b)
                a = v
                for k in range(j, len(g)):
                    if g[k] == '*':
                        b *= s[k + 1]
                    else:
                        a += b
                        b = s[k + 1]
                c = max(c, a + b)
print(c)

s = input()

processed = True
i1 = 1
while i1 < len(s):
    while i1 < len(s):
        if s[i1] == '+':
            break
        i1 += 2
    if i1 >= len(s):
        break
    i2 = i1 + 2
    while i2 < len(s):
        if s[i2] == '*':
            break
        i2 += 2

    i2 = i2 - 2
    if i2 - i1 > 2:
        s1 = eval(s[i1+1: i2])
        s = s[:i1+1] + str(s1) + s[i2:]
        i1 += 4
    else:
        i1 += 2

mults = [-1]
for i in range(len(s)):
    if s[i] == '*':
        mults.append(i)

mults.append(len(s))
max = 0
for i in range(len(mults)):
    for j in range(i+1, len(mults)):
        news =  s[:mults[i]+1] + '(' + s[mults[i]+1:mults[j]] + ')' +s[mults[j]:]
        v = eval(news)
        if v > max:
            max = v
print(max)


s = '1*' + input() + '*1'

muls = [1]
for i in range(3, len(s) - 2, 2):
    if s[i] == '*' and (s[i-2] == '+' or s[i+2] == '+'):
        muls.append(i)
muls.append(len(s) - 2)

m = eval(s)
for i in range(len(muls)):
    for j in range(i + 1, len(muls)):
        a, b = muls[i], muls[j]
        new_s = s[:a+1] + '(' + s[a+1:b] + ')' + s[b:]
        m = max(m, eval(new_s))

print(m)


s = input()
mult_list = []
for i in range(len(s)):
    if s[i] == '*':
        mult_list.append(i)
best = eval(s)
for k in mult_list:
    t = '('+s[:k]+')'+s[k:]
    q = eval(t)
    if q > best:
        best = q
    t = s[:(k+1)]+'('+s[(k+1):]+')'
    q = eval(t)
    if q > best:
        best = q
    for j in mult_list:
        if j >= k:
            continue
        if j < k:
            t = s[:(j+1)]+'('+s[(j+1):k]+')'+s[k:]
            q = eval(t)
            if q > best:
                best = q

print(best)


s = input()

mults = [-1]
for i in range(len(s)):
    if s[i] == '*':
        mults.append(i)

mults.append(len(s))
max = 0
for i in range(len(mults)):
    for j in range(i+1, len(mults)):
        news =  s[:mults[i]+1] + '(' + s[mults[i]+1:mults[j]] + ')' +s[mults[j]:]
        v = eval(news)
        if v > max:
            max = v
print(max)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = input()
length = len(s)
ans = eval(s)

for j in range(0,length,2):
    if j == 0 or s[j-1] == '*':
        for k in range(j+3,length+1,2):
            if k == length or s[k] == '*':
                tmp = eval(s[:j] + str(eval(s[j:k])) + s[k:])
                ans = ans if tmp < ans else tmp
print(ans)


s=input()
d=list(s.split('*'))
if len(s)>1:
 last=0;
 po=[]
 ki=[]
 for i in range(len(d)):
     po+=[last]
     ki+=[len(d[i])+last]
     last+=len(d[i])+1
 ans=[]
 for a in po:
     for b in ki:
        if a>b-2: continue 
        x=s[:a]+'('+s[a:b]+')'+s[b:]
        ans+=[eval(x)]
 print(max(ans))
else: print(s)

s = input()
res = eval(s)
n = len(s)
for i in range(-1, n):
    if i == -1 or s[i] == '*':
        for j in range(i + 1, n + 1):
            if j == n or s[j] == '*':
                new_s = s[0:i + 1] + "(" + s[i + 1:j] + ")" + s[j:n]
                res = max(res, eval(new_s))
print(res)

s = input()
a = [0]
for i in range(len(s)):
    if s[i] == '*':
        a.append(i+1)
a.append(len(s)+1)
maxRes = eval(s)
#print(a)
for i in a:
    for j in a:
        if j > i:
            maxRes = max(maxRes, eval(s[:i]+'('+s[i:j-1]+')'+s[j-1:]))
            #print(s[:i]+'('+s[i:j-1]+')'+s[j-1:])
print(maxRes)


s=input()
d=list(s.split('*'))
last=0;
po=[]
ki=[]
for i in range(len(d)):
    po+=[last]
    ki+=[len(d[i])+last]
    last+=len(d[i])+1
ans=[eval(s)]
for a in po:
    for b in ki:
       if a>b-2: continue 
       x=s[:a]+'('+s[a:b]+')'+s[b:]
       ans+=[eval(x)]
print(max(ans))


e = '1*' + input() + '*1'
l = len(e)
a = 0
for i in range(2, l, 2):
    if (e[i - 1] == '*'):
        for j in range(i + 1, l, 2):
            if e[j] == '*':
                a = max(a, eval(e[:i] + '(' + e[i:j] + ')' + e[j:]))
print(a)

s = input()
t = len(s)
res = eval(s)
for i in range(0, t):
    if i != 0 and s[i - 1] != '*':
        continue;
    a = s[:i]+'('+s[i:]
    for j in range(i, t + 2):
        if j != t + 1 and a[j] != '*':
            continue;
        if j == t + 1:
            b = a[:j] + ')'
        else:
            b = a[:j] + ')' + a[j:]
        res = max(res, eval(b))
print(res)

str = '1*' + input() + '*1'
l = len(str)
ans = 0
for i in range(2, l, 2):
    if (str[i - 1] == '*'):
        for j in range(i + 1, l, 2):
            if str[j] == '*':
                ans = max(ans, eval(str[:i] + '(' + str[i:j] + ')' + str[j:]))
print(ans)

input_str = input()
str = '1*' + input_str + '*1'
str_len = len(str)
ans = 0
 
for i in range(2, str_len, 2):
    if (str[i - 1] == '*'):
        for j in range(i + 1, str_len, 2):
            if str[j] == '*':
                ans = max(ans, eval(str[:i] + '(' + str[i:j] + ')' + str[j:]))
 
print(ans)

s = input()
s = "0+1*"+s+"*1+0"
answer = eval(s)
n = len(s)
p = []
for i in range(0, n):
	if s[i] == '*':
		p.append(i)
for i in p:
	for j in p:
		if i >= j:
			continue;
		test = eval(s[:i+1]+"("+s[i+1:j]+")"+s[j:])
		if test > answer:
			answer = test
print(answer)

import math,string,itertools,fractions,heapq,collections,re,array,bisect,copy
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict, deque
import operator as op

# Guide:
#   1. construct complex data types while reading (e.g. graph adj list)
#   2. avoid any non-necessary time/memory usage
#   3. avoid templates and write more from scratch
#   4. switch to "flat" implementations

def VI(): return list(map(int,input().split()))
def I(): return int(input())
def LIST(n,m=None): return [0]*n if m is None else [[0]*m for i in range(n)]
def ELIST(n): return [[] for i in range(n)]
def MI(n=None,m=None): # input matrix of integers
    if n is None: n,m = VI()
    arr = LIST(n)
    for i in range(n): arr[i] = VI()
    return arr
def MS(n=None,m=None): # input matrix of strings
    if n is None: n,m = VI()
    arr = LIST(n)
    for i in range(n): arr[i] = input()
    return arr
def MIT(n=None,m=None): # input transposed matrix/array of integers
    if n is None: n,m = VI()
    a = MI(n,m)
    arr = LIST(m,n)
    for i,l in enumerate(a):
        for j,x in enumerate(l):
            arr[j][i] = x
    return arr


# BFS is probably overkill, as one can reach it by brute force (below)
def bfs(l, sgn, r, best,par=0):
    if len(r) ==1:
        # if par==1:
        #     return max(best, sgn(l,r[0]))
        return max(best, sgn(l,r[0]))
    if sng == op.add:
        if par==0:
            return max(bfs(op.add(l,r[1]),r[2],r[3:],best,par),
                       bfs(op.add(l,r[1]),r[2],r[3:],best,par+1))
        if r[1] == op.add:
            return bfs(op.add(l,r[1]),r[2],r[3:],best)
        else:
            return max()
def run_bfs(s):
    x = list(s)
    lst = [int(v) if i%2==0 else op.add if v=='+' else op.mul for i,v in enumerate(x)]
    # d = [int(i) for i in x[::2]]
    # g = x[1::2]
    b = bfs(lst[0], lst[1], lst[2:], 0)


def run2(s):
    best = eval(s)
    n = len(s)
    if n<=3:
        print(eval(s))
        return
    x = list(s)
    for i in range(1,n-2,2):
        if s[i] == '+' and (i==1 or s[i-2]=='*'):
            l=i-1
            for j in range(i+2,n,2):
                if s[j] == '*':
                    exp = s[:l]+ '(' + s[l:j]+')'+s[j:]
                    best = max(best, eval(exp))
            best = max(best, eval(s[:l]+ '(' + s[l:]+')'))
    print(best)

def run3(s):
    best = eval(s)
    n = len(s)
    if n<=3:
        print(eval(s))
        return
    m = [i for i,v in enumerate(s) if v=='*']
    l = [0,]
    r = [n,]
    for x in m:
        if x<n-2 and s[x+2]=='+':
            l.append(x+1)
        if x>2 and s[x-2]=='+':
            r.append(x)
    for v in l:
        for w in r:
            if v>=w: continue
            exp = s[:v]+ '(' + s[v:w]+')'+s[w:]
            best = max(best, eval(exp))
    print(best)

def run(s):
    best = eval(s)
    n = len(s)
    if n<=3:
        print(best)
        return
    for i in range(1,n-1,2):
        if s[i] == '+' and (i==1 or s[i-2]=='*'):
            for j in range(i+2,n,2):
                if s[j] == '*':
                    best = max(best, eval(s[:i-1]+ '(' + s[i-1:j]+')'+s[j:]))
            best = max(best, eval(s[:i-1]+ '(' + s[i-1:]+')'))
    print(best)


def main(info=0):
    s = input()
    run(s)



def __starting_point():
    main()

__starting_point()