#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
ll INF = 1000000007;

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