#include <iostream>
#include <string>
#include <algorithm>
#include<vector>

using namespace std;

int main(){
	int n;
	cin >> n;
	long long sum = 0;
	for (int i = 1; i <= n; i++) {
		int a;
		if (i % 5 == 0 || i % 3 == 0) {
			a = 0;
		}
		else {
			a = i;
		}
		sum += a;
	}
	cout << sum << endl;
	return 0;
}