#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define dbg(x) cerr << #x << ": " << (x) << endl;
ll modpow(ll a, ll n, ll mod) {
    a %= mod;
    ll ans = 1;
    while (n) {
        if (n & 1) ans = ans * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ans;
}
int N;
int main() {
    cin >> N;
    ll mod = 998244353;
    vector exp(5, vector<ll>(N)), prob(5, vector<ll>(N));
    vector<bitset<5>> next(5);
    next[0].set(0);
    next[0].set(1);
    next[1].set(0);
    next[1].set(1);
    next[1].set(2);
    next[2].set(1);
    next[2].set(2);
    next[2].set(3);
    next[3].set(2);
    next[3].set(3);
    next[3].set(4);
    next[4].set(3);
    next[4].set(4);
    vector<int> inv(6);
    for (int i = 1; i < 6; ++i) inv[i] = modpow(i, mod-2, mod);
    exp[1][0] = exp[2][0] = exp[3][0] = inv[5];
    for (int d = 0; d < 5; ++d) prob[d][0] = inv[5];

    for (int i = 1; i < N; ++i) {
        for (int d = 0; d < 5; ++d) {
            for (int to = 0; to < 5; ++to) {
                if (next[d].test(to)) {
                    int grow = (1 <= to && to <= 3) * prob[d][i-1];
                    exp[to][i] += (exp[d][i-1] + grow) * inv[ next[d].count() ] % mod;
                    exp[to][i] %= mod;
                    prob[to][i] += prob[d][i-1] * inv[ next[d].count() ] % mod;
                    prob[to][i] %= mod;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < 5; ++i) ans += exp[i][N-1];
    ans %= mod;
    cout << ans << '\n';
}