import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

main = abc162b

abc162b = do
    [n] <- getIntList
    let nV = V.fromList [1..n]
    let nVfb = convFizzBuzz nV
    print $ V.sum nVfb

convFizzBuzz :: V.Vector Integer -> V.Vector Integer
convFizzBuzz = fmap (\x -> if (mod x 3 /= 0) && (mod x 5 /= 0) then x else 0) 

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine