{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE Strict #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L
import Data.Maybe

main :: IO ()
main = readInts >>= output . solve

solve :: [Int] -> Int
solve [n] = sum . map toFizzBuzz $ [1..n]
  where
    toFizzBuzz n =
      if n `mod` 3 == 0 || n `mod` 5 == 0
        then 0
        else n

output :: Int -> IO ()
output = print

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine