#include<iostream>
#include<vector>
#include<algorithm>
typedef long long int ll; 
using namespace std;

int main()
{
  ll n;
  cin>>n;
  ll sum = 0;
  for(ll i = 0; i< n; i++)
  {
    if(i%3==0 || i%5==0)
      continue;
    else
      sum = sum + i;
  }
  cout<<sum;
  return 0;
}