#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,sum=0;
  cin >> i;
  for (int count=1;count<=i;count++) {
    if(count%3==0 || count%5==0){
    } else { 
      sum = sum + count;
    }
  }
  cout << sum << endl;
}