s=gets.chop.chars p ((1..s.size).map{|i|x=s.rotate(i)*"";x!~/^[+-]|[+-]$/&&x}-[1<0]).map{|i|eval i.gsub(/\d+/){eval$&}}.max