/// Frail the skin is dry and pale
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#include "bits/stdc++.h"
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using ll = long long;
using ii = pair<int, int>;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp make_pair
const int N = 2e6 + 5, LG = 18, MOD = 1e9 + 7;
const double PI = acos(-1);
///number of ways such that the number of 5s is X and the count of 3s is odd or even
int cnt[N][2];
int F[N], iF[N];
int fast(int b, int e) {
int res = 1;
for(;e;e>>=1,b=1ll*b*b % MOD)
if(e & 1)
res = 1ll * res * b % MOD;
return res;
}
int C(int n, int k) {
if(k > n || k < 0)
return 0;
return 1ll * F[n] * iF[k] % MOD * iF[n-k] % MOD;
}
int StarsAndBars(int n, int k) {
return C(n + k - 1, k - 1);
}
void doWork() {
int n;
cin >> n;
int ans = 0;
for(int cnt5s = 0; cnt5s <= n; cnt5s++)
for(int cnt3s = 0; cnt3s < 2 && cnt5s + cnt3s <= n; cnt3s++) {
///for a 3 to be odd it has to be alone
int num = n - cnt5s - cnt3s;
///distribute the rest over (3,3) (11) (7) (1)
///if frequency of twos is less than or equal <= cnt5 + cnt3s
ans += 1ll * (cnt5s + cnt3s + 1) * StarsAndBars(num,4) % MOD;
// cout << cnt5s << " " << cnt3s << ' ' << 1ll * (cnt5s + cnt3s + 1) * StarsAndBars(num,4) << endl;
if(ans >= MOD)ans -= MOD;
///if frequency of twos is more than cnt5 + cnt3
///(2,2,2) (3,3) (11) (7), (1)
ans += (StarsAndBars(num,5));
if(ans >= MOD)ans -= MOD;
ans += (MOD - StarsAndBars(num,4)); ///subtract number of ways that (2,2,2) doesn't appear in it's already calculated
if(ans >= MOD)ans -= MOD;
if(num >= 1) { ///take one for (2) or (2,2) can't put both
for(int extra = 1; extra <= 2; extra++){
ans += StarsAndBars(num - 1,5);
if(ans >= MOD)ans -= MOD;
}
}
}
cout << (ans + 1) % MOD << '\n';
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
F[0] = 1;
f(i,1,N)F[i] = 1ll * i * F[i-1] % MOD;
iF[N-1] = fast(F[N-1],MOD-2);
for(int i = N - 2; i >= 0; --i) {
iF[i] = iF[i+1] * 1ll * (i + 1) % MOD;
}
int t = 1;
// cin >> t;
while (t--) {
doWork();
}
return 0;
}
Copy