#include <bits/stdc++.h>

using std::cout;
using std::cin;
using std::endl;

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