#include<iostream>
using namespace std;
int main()
{
    long long int n,m=0,l=0,num=0,sum=0;

        cin>>n;
        while(l<n){
            l++;
            if(l%3!=0&&l%5!=0){
                m+=l;}


        }sum=sum+m;
       cout << sum<<endl;



}
