      subroutine horner(N,a,b,x,R)
      implicit none
      integer j,k,N
      real*8 a,b,x,R
      dimension a(0:N),b(0:N-1)
      b(N-1)=a(N)
      do 1,j=N-2,0,-1
      b(j)=a(j+1)+x*b(j+1)
    1 continue
      R=a(0)+x*b(0)
      return
      end
