main = do
    line<-getLine
    let p = read line ::Int
    print $ sum_ $ filter nr3n5 [1..p]

nr3n5 :: Int -> Bool
nr3n5 x
    | (mod x 3)==0 = False
    | (mod x 5)==0 = False
    | otherwise = True

sum_ :: [Int] ->Integer
sum_ [] = 0
sum_ (x:xs) = (fromIntegral x) + sum_ xs