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

int main() {
  
  int N;
  cin >> N;
  
  int x,y,z,S;
  
  x = 15*(1 - 15^N/15) / -14;
  y = 3*(1 - 3^N/3) / -2;
  z = 5*(1 - 5^N/5) / -4;
  
  S = (1 + N) * N / 2;
  
  cout << S - x - y- z << endl;
  
}
