toInt :: String -> Int
toInt = read :: String -> Int

fizzBuzz :: Int -> Int
fizzBuzz n
  | mod n 3 == 0 = 0
  | mod n 5 == 0 = 0
  | otherwise = n

fizzBuzzArray :: [Int]
fizzBuzzArray = map fizzBuzz [0..]

main = do
  n <- toInt <$> getLine
  print $ sum $ take (n+1) fizzBuzzArray
