#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n;
  cin >> n;
  n++;
  vi a(n);
  rep(i, n) a[i] = i;
  for(int i=0;i<n;i+=3){
    a[i] = 0;
  }
  for(int i=0;i<n;i+=5){
    a[i] = 0;
  }

  ll ans = 0;
  rep(i, n){
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}