Scanf.scanf "%d" (fun n ->
    let extgcd x y =
        let rec eg r0 r1 a0 a1 b0 b1 =
            if r1 = 0 then a0 else
                let q1 = r0 / r1 in
                eg r1 (r0 mod r1) a1 (a0 - q1 * a1) b1 (b0 - q1 * b1)
        in
        eg x y 1 0 0 1
    in
    let inv x y = (* 1/x in mod y *)
        let c = extgcd x y in
        if c < 0 then c + y else c
    in
    let z = 998244353 in
    let ( +@) a b = (a + b) mod z in
    let ( -@) a b = (((a - b) mod z) + z) mod z in
    let ( *@) a b = (a * b) mod z in
    let ( /@) a b = a *@ inv b z in

    let modpow a b =
        let rec loop r i acc =
            if i = 0 then acc else loop (r *@ r) (i lsr 1) (if i land 1 = 1 then r *@ acc else acc)
        in
        loop a b 1
    in

    let rec loop a b cur acc =
        let acc = acc +@ cur in
        if b * 2 = n then acc else
            loop (a - 1) (b + 1) (cur *@ 2 *@ a /@ b) acc
    in
    let ans = loop n 1 2 0 in
    Printf.printf "%d\n" @@ modpow 3 n -@ ans
)