integer::N integer,pointer::XY(:,:) integer,pointer::X(:),Y(:),Z(:) read *,N allocate(XY(2,N)) allocate(Z(N)) read *, XY X => XY(1,1:N) Y => XY(2,1:N) Z = Y - X if (Z(1).gt.0 .and. ALL(Z.eq.Z(1))) then print '(i0)', Z(1) else print '(i0)', -1 end if end program