      Program Lab1
      implicit none
      real*8 integral, al(314), es(314), h
      integer i,j,k
      al = 0.0d0
      es = 0.0d0
      open(unit=10, file="P21.txt")
      do i=1,314
        read(10,*) al(i), es(i)
      end do
      h = al(2) - al(1)
      integral = es(1) + es(314)
      !metodo simpson
      do i=3,(314)-1,2
        integral = integral + 4*(es(i))
      end do
      do i=2,(314)-1,2
        integral = integral + 2*(es(i)) 
      end do
      write(*,*) ((al(314)-al(1))/2.0d0)*(es(1) + es(314))
      integral = integral*(h/3.0d0)
      write(*,*) integral
      End Program Lab1
