#include<stdio.h>
int main()
{
   long long int n,i,sum=0;
    scanf("%lld",&n);
    for (i = 1; i <= n; i++)
    {
        if((i%3==0 ) && (i%5==0))
        {
             sum=sum+0;
        }
        else if(i%3==0)
        {
            sum=sum+0;
        }
        else if(i%5==0)
       {
          sum=sum+0;
       }
       else 
       {
           sum=sum+i;
       } 
    }
      printf("%lld\n",sum);  
    
}