str = gets ans = 0 (0..str.length-2).each {|i| left = str[0..i] right = str[(i+1)..(str.length-2)] expr = right + left if expr[0] == '+' || expr[-1] == '+' next end if expr[0] == '-' || expr[-1] == '-' next end val = eval(expr) if val > ans ans = val end } puts ans