#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=2;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
#define stringc(s) string s; cin >> s;
using namespace std;
int main() {
  llc(n);
  ll a=0;
  r1(i,n) if(a%3!=0 && a%5!=0) a+=i;
  cout << a << endl;
}
