import Control.Applicative

main :: IO ()
main = solve <$> readLn >>= print

solve :: Int -> Int
solve n = sum_mult n 1 - sum_mult n 3 - sum_mult n 5 + sum_mult n 15

sum_mult :: Int -> Int -> Int
sum_mult x y =
  let i = x `div` y in
  i * (i + 1) `div` 2 * y
