#include<stdio.h>

int main()
{
    unsigned long long i,n,sum;
    sum = 0;
    scanf("%llu",&n);
    for(i=3;i<=n;i++){
        if(i%3==0||i%5==0){
            sum+=i;
        }
    }
    printf("%d\n",sum);

    return 0;
}
