      include 'mpif.h'
      parameter(numdat=100)
      integer isum_arry(10)
      call MPI_INIT(ierr)
      call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ierr)
      call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,ierr)
      ist=((numdat-1)/nprocs+1)*myrank+1
      ied=((numdat-1)/nprocs+1)*(myrank+1)
      isum1=0
      do i=ist,ied
         isum1=isum1+i
      enddo
      call MPI_GATHER(isum1, 1, MPI_INTEGER, isum_arry, 1,
     &                MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
      if(myrank.eq.0) then
        isum=0
        do i=1,nprocs
          isum=isum+isum_arry(i)
        enddo
        write(6,*)'isum=',isum
      endif
      call MPI_FINALIZE(ierr)
      stop
      end
