#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  
  int ans=0;
  for (int i=1;i<=n;++i){
    if (i%3==0) break;
    if (i%5==0) break;
    ans+=i;
  }
  cout << ans << endl;
}