#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<n+1;i++)

using namespace std;
using std::swap;

vector<long long int> v;
vector<long long int> w;



int main() {
	long double N,T,F,FT,ANS;
	cin >> N;

	T = N / 3;
	F = N / 5;
	FT = N / 15;
	ANS = (1 + N)*N / 2;
	ANS = ANS - (T * 3 + 3)*T / 2 - (F * 5 + 5)*F / 2 + (FT * 15 + 15)*FT / 2;
	cout << ANS << "\n";
	return 0;
}