#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #include using mint = atcoder::modint998244353; #include namespace dual_number_ { struct has_id_method_impl { template static auto check(T_ *) -> decltype(T_::id(), std::true_type()); template static auto check(...) -> std::false_type; }; template struct has_id : decltype(has_id_method_impl::check(nullptr)) {}; } // namespace dual_number_ // Dual number (二重数) // Verified: https://atcoder.jp/contests/abc235/tasks/abc235_f template struct DualNumber { T a, b; // a + bx template ::value>::type * = nullptr> static T2 _T_id() { return T2::id(); } template ::value>::type * = nullptr> static T2 _T_id() { return T2(1); } DualNumber(T x = T(), T y = T()) : a(x), b(y) {} static DualNumber id() { return DualNumber(_T_id(), T()); } explicit operator bool() const { return a != T() or b != T(); } DualNumber operator+(const DualNumber &x) const { return DualNumber(a + x.a, b + x.b); } DualNumber operator-(const DualNumber &x) const { return DualNumber(a - x.a, b - x.b); } DualNumber operator*(const DualNumber &x) const { return DualNumber(a * x.a, b * x.a + a * x.b); } DualNumber operator/(const DualNumber &x) const { T cinv = _T_id() / x.a; return DualNumber(a * cinv, (b * x.a - a * x.b) * cinv * cinv); } DualNumber operator-() const { return DualNumber(-a, -b); } DualNumber &operator+=(const DualNumber &x) { return *this = *this + x; } DualNumber &operator-=(const DualNumber &x) { return *this = *this - x; } DualNumber &operator*=(const DualNumber &x) { return *this = *this * x; } DualNumber &operator/=(const DualNumber &x) { return *this = *this / x; } bool operator==(const DualNumber &x) const { return a == x.a and b == x.b; } bool operator!=(const DualNumber &x) const { return !(*this == x); } bool operator<(const DualNumber &x) const { return (a != x.a ? a < x.a : b < x.b); } template friend OStream &operator<<(OStream &os, const DualNumber &x) { return os << '{' << x.a << ',' << x.b << '}'; } T eval(const T &x) const { return a + b * x; } T root() const { return (-a) / b; } // Solve a + bx = 0 (b \neq 0 is assumed) }; using dual = DualNumber; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N; cin >> N; vector dp(3); dp[0] = mint(1); while (N--) { decltype(dp) dpnxt(dp.size()); for (int d = 0; d < 3; ++d) { dpnxt.at(d) += dp.at(d) * mint(25); dpnxt.at((d + 1) % 3) += dp.at(d) * dual(1, d == 2); } dp = dpnxt; } mint ret = 0; for (auto v : dp) ret += v.b; cout << ret.val() << endl; }