s=gets.chop p (0..s.size).map{|i|x=s[i,$$]+s[0,i];x=~/^\d.*\d$/?eval(x.gsub /011/,'11'):0}.max