#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; constexpr long long MOD = 998244353; vector> prod(vector>& X, vector>& Y) { vector> Z = {{0, 0}, {0, 0}}; for( int i = 0; i < 2; i++ ) { for( int j = 0; j < 2; j++ ) { for( int k = 0; k < 2; k++ ) { Z[i][j] += X[i][k]*Y[k][j]%MOD; Z[i][j] %= MOD; } } } return Z; } int main() { cin.tie(0); ios::sync_with_stdio(false); long long N; cin >> N; N--; vector> A = {{1, 1}, {1, 0}}, B = {{1, 0}, {0, 1}}; while( N > 0 ) { if( N&1 ) { B = prod(A, B); } A = prod(A, A); N >>= 1; } cout << (B[0][0]+B[1][0]-1+MOD)%MOD << endl; }