#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){ 
  Int N;
  cin >> N;
  
  Int q, r, s, t, ans;
  q = N / 15;
  r = N % 15;
  s = 0;
  t = 0;
  
  for(int i = 0; i<=r, i++) {
    if (i%3!=0 && i%5!=0) {
      s += i;
      t ++;
    }
  }
  
  ans = 60 * q * q + 15 * q * t + s;
  
  cout << ans << endl;

}