      PROGRAM GENDATT
c     GENEROWANIE DANYCH DLA GAUSS
      implicit none
      real*8 AAT,BBT,A
      integer N,k,l,j
      dimension AAT(1000000),BBT(10000),A(1000,1000)
      write(*,*)'GENDATT'
      write(*,*)'PODAJ N - WYMIAR ZADANIA'
      read (*,*) N
      call SUBGENDATT(n)
      stop 100
      end
      
      subroutine SUBGENDATT(N)
      real*8 AAT,BBT,A
      integer N,j,k,l
      dimension AAT(N*N),BBT(N),A(N,N)
c     PETLA GENERUJACA
      do 1,l=1,N,1
      do 2,k=1,N,1
      j=N*(k-1)+l
      A(l,k)=k**(l-1)
      AAT(j)=k**(l-1)
    2 continue
    1 continue
      do 3,l=1,N,1
      BBT(l)=0
      do 4,k=1,N,1
      BBT(l)=BBT(l)+A(l,k)
    4 continue
    3 continue
c     KONIEC GENEROWANIA
      open(unit=10,file='AAT')
      rewind(10)
      do 5,j=1,N*N,1
      write(10,*)AAT(j)
    5 continue
      close(10)
      open(unit=11,file='BBT')
      rewind(11)
      do 6,l=1,N,1
      write(11,*)BBT(l)
    6 continue
      close(11)
      return
      end

