r=eval s=gets 1.step(s.size){|i|r=[r,eval(s[i..-2]+s[0,i])].max if /\d\d/=~s[i-1,2]} p r