
      program pop_sum

      integer i, j, k,  imax, jmax
      parameter(imax=360, jmax=180 )
      integer igrid, jgrid,kn
      parameter(igrid=2, jgrid=2,kn=5)
      integer data(imax*igrid, jmax*igrid), sum, tmp(kn),sumsum

      open(10,file='glp95agi.asc',status='old')

      do j=1,jmax*jgrid
          read(10,*) (data(i,j), i=1,imax*igrid)
      end do

      close(10)

c- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      sum=0
      k=1
        do j=1,jmax*jgrid
          do i=1,imax*igrid
            sum = sum + data(i,j)
c         ---   ---   ---   ---   ---   ---   
            if(sum .ge. 1 000 000 000) then            
              tmp(k) = sum
              k = k+1
              sum =0
            end if            
c         ---   ---   ---   ---   ---   ---  
          end do
        end do

      sumsum = sum/1000
      do k=1,kn
        sumsum = sumsum + tmp(kn)/1000 
      end do
      write(6,*) sumsum,'*1000'
      end 

        
