import java.util.*;

public class Solution { final int MOD = 998244353; long pow(long a, long n){

    long ans = 1;

    while(n>0){
       if(n%2 == 1)ans = (ans*a)%MOD;
       a = (a*a)%MOD;
       n/=2;
   }
   return ans % MOD;
}
/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 
 * @param number long长整型 
 * @return long长整型
 */
public long cutRope (long number) {
    // write code here
    long result = 0;
    if(number <= 3) return number - 1;
    if(number % 3 != 1){
        if(number % 3 == 0)
            result = pow(3,number/3);
        if(number % 3 == 2)
            result =pow(3,number/3) * 2 % MOD;
    }else{
        result = pow(3,number/3 - 1) * 4 % MOD;
    }
    return result;
}

}