#include <stdio.h>
int main(){
	int n;
	if(scanf("%d",&n)==EOF){return 0;}
	int ftemp = n/3;
	double f =(double) ftemp;
	int btemp = n/5;
	double b =(double) btemp;
	int fbtemp = n/15;
	double fb =(double) fbtemp;
	
	double nd = (double)n;
	//printf("%lf %lf %lf", f,b,fb);
	
	double sum =(double) (1+nd)*nd/2;
	double fizz = f*(f+1)/2;
	double buzz = (b)*(b+1)/2;
	double fizzbuzz = (fb)*(fb+1)/2;
	sum = sum - 3*fizz - 5*buzz+15*fizzbuzz;


	printf("%.0lf\n",sum);
	return 0;
	
}
