#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;

 
int main(){
   
    ll n;
    cin >> n;
    ll ans_ = 0;
    rep(i, 200000){
        int a_3 = (i+1)*5;
        if(a_3 > n) break;
        if(a_3%3==0) ans_+=a_3;
    }
    ll wan = n*(n+1)/2;
    ll n_3 = n/3;
    ll n_5 = n/5;

    ll wa_3 = n_3 * (2 *3 + (n_3 - 1)*3)/2;
    ll wa_5 = n_5 * (2 *5 + (n_5 - 1)*5)/2;

    ll ans = wan - wa_3 - wa_5 + ans_;
    cout << ans << endl;


    return 0;
}