import sys

input = sys.stdin.readline





def fizzbuzz(n):

    if n % 5 == 0 and n % 3 == 0:

        return 0

    elif n % 3 == 0:

        return 0

    elif n % 5 == 0:

        return 0

    else:

        return n





def main():

    n = int(eval(input()))

    li = list(range(1, n+1))



    change_li = list(map(fizzbuzz, li))



    print((sum(change_li)))





if __name__ == '__main__':

    main()

n = int(eval(input()))

ans = 0

for i in range(1, n+1):

    if i % 3 != 0 and i % 5 != 0:

        ans += i



print(ans)

import sys

input = sys.stdin.readline


def fizzbuzz(n):
    if n % 5 == 0 and n % 3 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


def main():
    n = int(eval(input()))
    li = list(range(1, n + 1))
    change_li = list(map(fizzbuzz, li))
    print((sum(change_li)))


if __name__ == "__main__":
    main()

n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

-import sys - -input = sys.stdin.readline - - -def fizzbuzz(n): -    if n % 5 == 0 and n % 3 == 0: -        return 0 -    elif n % 3 == 0: -        return 0 -    elif n % 5 == 0: -        return 0 -    else: -        return n - - -def main(): -    n = int(eval(input())) -    li = list(range(1, n + 1)) -    change_li = list(map(fizzbuzz, li)) -    print((sum(change_li))) - - -if __name__ == "__main__": -    main() +n = int(eval(input())) +ans = 0 +for i in range(1, n + 1): +    if i % 3 != 0 and i % 5 != 0: +        ans += i +print(ans)