//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

#define int long long

const int MAXN = 1;
const int INF = 2e9;
const int mod = 1e9 + 7;

int n,ans;

signed main () {
	cin >> n;
	for(register int i = 1;i <= n; ++i)
		if(i % 3 && i % 5) ans += i;
	cout << ans << endl;
	return 0;
}
