#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

using std::cout;
using std::endl;
using std::cin;
using std::string;

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