#include using namespace std; using ll = long long; #define TYPE_OF( VAR ) remove_const::type >::type #define CIN( LL , A ) LL A; cin >> A #define ASSERT( A , MIN , MAX ) assert( MIN <= A && A <= MAX ) #define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX ) #define FOREQ( VAR , INITIAL , FINAL ) for( TYPE_OF( FINAL ) VAR = INITIAL ; VAR <= FINAL ; VAR ++ ) #define QUIT return 0 #define RETURN( ANSWER ) cout << ( ANSWER ) << "\n"; QUIT #define CHECK_REDUNDANT_INPUT string VARIABLE_FOR_CHECK_REDUNDANT_INPUT = ""; cin >> VARIABLE_FOR_CHECK_REDUNDANT_INPUT; assert( VARIABLE_FOR_CHECK_REDUNDANT_INPUT == "" ); assert( ! cin ); int main() { constexpr const int bound_N = 3000; CIN_ASSERT( N , 3 , bound_N ); CHECK_REDUNDANT_INPUT; constexpr const int bound_length = bound_N + 2; ll count[2][bound_length] = {}; int i_prev = 0; int i_curr = 1; count[i_prev][1] = 1; N++; constexpr const ll P = 998244353; FOREQ( total_length_plus , 2 , N ){ ll ( &count_prev )[bound_length] = count[i_prev]; ll ( &count_curr )[bound_length] = count[i_curr]; FOREQ( length_plus , 1 , total_length_plus ){ count_curr[length_plus] = ( count_prev[length_plus] * 25 + count_prev[length_plus - 1] ) % P; } swap( i_prev , i_curr ); } ll ( &count_last )[bound_length] = count[i_prev]; ll answer = 0; while( --N > 0 ){ answer += count_last[N+1] * ( N / 3 ); } RETURN( answer % P ); }