fizzbuzz :: Integer -> Integer
fizzbuzz 0 = 0
fizzbuzz n
    | n `mod` 3 == 0 = fizzbuzz (n-1)
    | n `mod` 5 == 0 = fizzbuzz (n-1)
    | otherwise = n + fizzbuzz (n-1)

main = do
    n <- readLn
    putStrLn $ show (fizzbuzz n)