implicit none integer(8) i,N,M integer(8),allocatable :: x(:) integer(8),allocatable :: y(:) integer(8),allocatable :: z(:) read(*,*) N allocate (x(N)) allocate (y(N)) allocate (z(N)) do i=1,N read(*,*) x(i),y(i) end do do i=1,N z(i)= y(i) -x(i) end do M=0 do i=1,N M=M+1 if (z(i)/=z(i+1)) exit end do if (M==N) then if (z(M)>0) then write(*,*) z(M) else write(*,*) "-1" end if else write(*,*) "-1" end if end