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

int main() {
  int N, a, b, ans;
  cin >> N;
  for (int i = 0; i++; i < N) {
    a = i % 3;
    b = i % 5;
    if (a != 0 && b != 0) {
      ans += i;
    }
  }
  cout << ans << endl;
}