#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    int d; cin >> d;
    vector<int> poly = {120960, -6104592, 15425220, -15567308, 8236431, -2529492, 466830, -51012, 3039, -76};
    int ans = 0;
    int curr = 1;
    for (auto p : poly) {
        ans += curr * p;
        curr *= d;
    }
    cout << ans / 120960 << "\n";
}