n,*d,x,y=`dd`.split.map{|e|e.to_i.abs} x=[x,y].max p (d.index(x)?0:1)+(x-1+m=d.max)/m