#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
	long long n;
	scanf("%lld",&n);
	long long sum=0;
	int i, a;
	for(i=1;i<=n;i++){
		a = i;
		if(i%3 == 0 || i%5 == 0){
			a = 0;
		}
		sum += a;
	}
	printf("%lld\n",sum);
    return 0; 
}
