program FizzBuzz
      implicit none
      
      integer(8) N,S,i
      read(*,*) N
      S=0
      do i =1, N
      if (mod(i,5)==0.or.mod(i,3)==0) then
            go to 1
      else
            S=S+i
      1 end if
      end do
      
      write(*,*) S
      stop 
      end program FizzBuzz


