// g++-13 1.cpp -std=c++17 -O2 -I . #include using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include using namespace __gnu_pbds; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) using mint = modint998244353; random_device seed; mt19937_64 randint(seed()); ll grr(ll mi, ll ma) { // [mi, ma) return mi + randint() % (ma - mi); } // [その方向に最後に伸びる確率, 高さの期待値] vector> nxt(vector> &now){ vector> res(5); res[0]={now[0].first/2+now[1].first/3,now[0].second*now[0].first/2+now[1].second*now[1].first/3}; res[1]={now[0].first/2+now[1].first/3+now[2].first/3,(now[0].second*now[0].first)/2+(now[1].second*now[1].first)/3+(now[2].second*now[2].first)/3+1}; res[2]={now[1].first/3+now[2].first/3+now[3].first/3,now[1].second*now[1].first/3+now[2].second*now[2].first/3+now[3].second*now[3].first/3+1}; res[0]={now[0].first/2+now[1].first/3,now[0].second/2+now[1].second/3}; res[1]={now[0].first/2+now[1].first/3+now[2].first/3,(now[0].second)/2+(now[1].second)/3+(now[2].second)/3+now[0].first/2+now[1].first/3+now[2].first/3}; res[2]={now[1].first/3+now[2].first/3+now[3].first/3,now[1].second/3+now[2].second/3+now[3].second/3+now[1].first/3+now[2].first/3+now[3].first/3}; res[3]=res[1]; res[4]=res[0]; // rep(i,0,5){ // res[i].second/=res[i].first; // } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n;cin>>n; vector> v(5); rep(i,0,5){ v[i].first=1; v[i].first/=5; v[i].second=1; if(i==0||i==4)v[i].second=0; v[i].second/=5; } rep(i,0,n-1){ v=nxt(v); } mint ans=0; rep(i,0,5){ auto [a,b]=v[i]; ans+=b; // cout<<(15*b).val()<