#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#include <numeric>
using namespace std;
 int main(){
 int n,sum=0; 
 cin>>n;
rep(i,n){
if(i/3==0&&i/5==0)
  sum+=i;
}
cout<<sum<<endl;
}