import System.IO
main = do
putStrLn $ show $ sum $ filter judge [1..999]
judge a | a `mod` 3 == 0 || a `mod` 5 == 0 = True
| otherwise = False