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

int main() {
  int N,a,b;
  long int sum;
  cin >> N;
  sum = 0;
  
  for (int i = 1; i < N + 1; i++) {
    a = i % 3;
    b = i % 5;
   if (a == 0 || b == 0) {
     sum = sum + 0;
   }
    else {
      sum = sum + i;
    }
  }
     
  
  cout << sum << endl;
}
  
  
