#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t N;
  cin >> N;
  int64_t sum = 0;
  int64_t i = 0;
while (i <= N) {
  if(i%3 == 0){sum;} 
  else if(i%5 == 0){sum;} 
  else{sum += i;}
  i++;}
  cout << sum <<  endl;}