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

using namespace std;

int main() {
	long int n;
	cin >> n;
	long long int ans = 0;
	int roop = n / 15;
	int roopP = n % 15;
	for (int i = 0; i < roop; i++) {
		ans += 60 + 8*15*i;
	}
	for (int i = 15*roop + 1; i < n + 1; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}