s=gets.chop l=s.size p (l.times.map{|i| eval (s[i..-1]+s[0...i]).gsub /(?!<\d)0+(?=\d)/,''if s[i]=~/\d/&&s[i-1]=~/\d/ }-[p]).max