s=gets.chop p ((0..s.size).map{|i|x=s[i,$$]+s[0...i];eval x.gsub /011/,'11'if x !~/^[+-]|[+-]$/}-[p]).max