import java.util.*;

public long cutRope (long number) {
    // write code here
    if(number <= 3){
        return number - 1;
    }
    long time = 0;
    long rest = 0;
    if(number % 3 == 1){
        time = number / 3 - 1;
        rest = 4;
    }else if(number % 3 == 2) {
        time = number / 3;
        rest = number % 3;
    }else {
        time = number / 3 - 1;
        rest = 3;
    }
    //快速幂做法
    long ans = rest;
    long base = 3;
    while(time > 0){
        if(time % 2 == 1){
            ans = (ans * base) % 998244353;
        }
        base = ((base * base)) % 998244353;
        time /= 2;
    }
    return ans;
}

}