integer*8::X,Y,L,step read*,X,Y,L if(X.eq.0.and.Y.ge.0) then step = 0 else if(Y.ge.0) then step = 1 else step = 2 endif print '(i0)',step+(ABS(X)+L-1)/L+(ABS(Y)+L-1)/L end program