def main():

    n = int(eval(input()))

    ans = sum([i for i in range(1, n+1) if i%3!=0 and i%5!=0])

    print(ans)



if __name__ == "__main__":

    main()
def main():

    n = int(eval(input()))

    print((sum([i for i in range(1, n+1) if i%3 and i%5])))



if __name__ == "__main__":

    main()

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


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    print((sum([i for i in range(1, n + 1) if i % 3 and i % 5])))


if __name__ == "__main__":
    main()

-    ans = sum([i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0]) -    print(ans) +    print((sum([i for i in range(1, n + 1) if i % 3 and i % 5])))