       parameter (M=11, NN=2**M)
       complex C(0:NN), D(0:NN), Z(0:NN)
       complex w, u

       do 100 KK=1, 3

       pi=4.0*atan(1.0)
       w=cmplx(cos(-2*pi/NN), sin(-2*pi/NN))

       do 10 k=0, NN-1
          Z(k)=w**k
          C(k)=cos(5*2*pi*k/NN)
 10    continue

       do 20 n=0, NN-1
          u=C(0)
          do 30 k=1, NN-1
             u=u+Z(n)**k*C(k)
 30       continue
          D(n)=u/NN
 20    continue

 100    continue

c       do 99 j=0, NN-1
c          write (11, *) D(j)
c          print *, D(j)
c 99    continue    

       stop
       end


