s = gets.chomp n = s.size n.times do |i| s += s[i] end ans = 0 n.times do |i| begin t = s[i,n] next if t[0] == "+" next if t[0] == "-" next if t[-1] == "+" next if t[-1] == "-" ans = [ans,eval(t)].max rescue SyntaxError => s end end puts ans