      program example64b
      include "omp_lib.h"
      parameter (n = 1000000000)
      integer i, size
      double precision w, x, sum, pi, f, y, t1, t2
      f(y) = 4.d0/(1.d0+y*y)
      t1=omp_get_wtime()
      w = 1.0d0/n
      sum = 0.0d0;
!$omp parallel private(x) shared(w)
      size=omp_get_num_threads();
!$omp do reduction(+:sum)
      do i=1, n
         x = w*(i-0.5d0)
         sum = sum + f(x)
      end do
!$omp end parallel
      pi = w*sum
      t2=omp_get_wtime()
      print *, "N=", n, ", Nproc=", size, "pi = ", pi,
     &         " Time=", t2-t1
      end
