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