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