#include<iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int fizz = 3;
  int buzz = 5;
  int fizzbuzz = 15;
  double fizzsum = 0;
  double buzzsum = 0;
  double fizzbuzzsum =0;
  int fizzstate = N/fizz;
  int buzzstate = N/buzz;
  int fizzbuzzstate = N/fizzbuzz;
  double ans;

  for(int i=1;i<=N;i++){
    ans +=i;
  }


  for(int i=1;i<=buzzstate;i++){
    buzzsum += buzz*i;
  }
  for(int i=1;i<=fizzstate;i++){
    fizzsum += fizz*i;
  }
  for(int i=1;i<=fizzbuzzstate;i++){
    fizzbuzzsum += fizzbuzz*i;
  }
  
  cout << ans - fizzsum - buzzsum + fizzbuzzsum << endl;






}