def main():

    n = int(eval(input()))

    s = 0

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

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

            pass

        elif i%3 == 0:

            pass

        elif i%5 == 0:

            pass 

        else:

            s += i

    print(s)



if __name__ == "__main__":

    main()
def main():

    n = int(eval(input()))

    s = 0

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

        if not (i % 3 == 0 or i % 5 == 0):

            s += i

    print(s)





if __name__ == "__main__":

    main()

def main():
    n = int(eval(input()))
    s = 0
    for i in range(1, n + 1):
        if i % 3 == 0 and i % 5 == 0:
            pass
        elif i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            s += i
    print(s)


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    s = 0
    for i in range(1, n + 1):
        if not (i % 3 == 0 or i % 5 == 0):
            s += i
    print(s)


if __name__ == "__main__":
    main()

-        if i % 3 == 0 and i % 5 == 0: -            pass -        elif i % 3 == 0: -            pass -        elif i % 5 == 0: -            pass -        else: +        if not (i % 3 == 0 or i % 5 == 0):