a = []
i = 0
 
for i in range(1, 10000):
    if i%3==0 or i%5==0:
        a.append(i)
    i += 1
 
print sum(a)