implicit none integer::N,M,X,Y read *, N,M read *, X,Y X = MOD((X-1),2*M) Y = MOD((Y-1),2*M) if(X.ge.M) then X = 2*M-X -1 end if if(Y.ge.M) then Y = 2*M-Y -1 end if if(X.eq.Y) then print '(a)', "YES" else print '(a)', "NO" end if end program