      include 'mpif.h'
      parameter(numdat=100)
      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_REDUCE(isum1,isum,1,MPI_INTEGER,MPI_SUM,
     &                0,MPI_COMM_WORLD,ierr)
      if(myrank.eq.0)write(6,*)'isum=',isum
      call MPI_FINALIZE(ierr)
      stop
      end
