/* -*- coding: utf-8 -*- * * 2131.cc: No.2131 Concon Substrings (COuNt Version) - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 3000; const int MOD = 998244353; /* typedef */ template struct MI { int v; MI(): v() {} MI(int _v): v(_v % MOD) {} MI(long long _v): v(_v % MOD) {} MI operator+(const MI m) const { return MI(v + m.v); } MI operator-(const MI m) const { return MI(v + MOD - m.v); } MI operator*(const MI m) const { return MI((long long)v * m.v); } MI &operator+=(const MI m) { return (*this = *this + m); } MI &operator-=(const MI m) { return (*this = *this - m); } MI &operator*=(const MI m) { return (*this = *this * m); } bool operator==(const MI m) const { return v == m.v; } bool operator!=(const MI m) const { return v != m.v; } MI pow(int n) const { // a^n % MOD MI pm = 1, a = *this; while (n > 0) { if (n & 1) pm *= a; a *= a; n >>= 1; } return pm; } MI inv() const { return pow(MOD - 2); } MI operator/(const MI m) const { return *this * m.inv(); } MI &operator/=(const MI m) { return (*this = *this / m); } }; typedef MI mi; /* global variables */ mi dp[MAX_N + 1][MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); dp[0][0] = 1; for (int i = 0; i < n; i++) for (int j = 0; j <= i; j++) { dp[i + 1][j] += dp[i][j] * 25; dp[i + 1][j + 1] += dp[i][j]; } mi sum = 0; for (int j = 0; j <= n; j++) sum += dp[n][j] * (j / 3); printf("%d\n", sum.v); return 0; }