#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
ll cnt = 0;

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