#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const ll MAX_N = 100000;

// vector<int> dp(100000, 1e9);



ll sum(ll num)
{
    ll ans = num * (num + 1) / 2;
    return ans;
}

int main()
{
    ll N;
    ll ans = 0;
    scanf("%lld", &N);
    ll n3 = floor(N / 3);
    ll n5 = floor(N / 5);
    ll n15 = floor(N / 15);
    ll ansN = sum(N);
    ll ansN3 = sum(n3);
    ll ansN5 = sum(n5);
    ll ansN15 = sum(n15);
    ans = ansN - (3*ansN3 +5* ansN5 -15* ansN15);
    cout << ansN << endl
     << ansN3 << endl
     << ansN5 << endl
     << ansN15 << endl;
    printf("%lld",ans);


    return 0;
}