#include <stdio.h>
int main(void)
{
  	int N=0,n1=0;
  	int sum=0,plus=0;
  	scanf("%d",&N);
  
  	while(n1<N){
    	if(n1/15==0){
    	n1++;
    	}else if(n1/3==0){
    	n1++;
    	}else if(n1/5==0){
    	n1++;
    	}else{
    	sum=sum+n1;
    	n1++;
    	}
    }
  
  	printf("%d",&sum);
  
  	return 0;
  
}
