#include <iostream>
using namespace std;

int main(){
  
  long long N;
  cin >> N;
  long long Total=0;
  Total = 60*(N/15)*(N/15);
  long long G;
  G = N - N%15;
  for(int i=0;i<(N%15)+1;i++){
    if(i%3!=0 & i%5!=0){
      Total += (G+i);
    }
  }
  cout << Total << endl;
  
  
}