import java.util.*; import java.util.stream.*; public class Main { static Scanner scan; public static long M = 998_244_353l; public static long pow(long n, long p, long m) { if (p == 0) { return 1l; } if (n == 0) { return 0l; } int lp = 0; //log_2{p} long tp = p; while (tp > 0) { tp >>= 1; lp++; } long tn = n % m; tp = p; long res = 1; for (int i = 0; i < lp; i++) { if ((tp & 1) > 0) { res = (res*tn)%m; } tn = (tn*tn)%m; tp >>= 1; } return res; } public static void main(String []args) { scan = new Scanner(System.in); int n = scan.nextInt(); System.out.println(pow(3l, n, M)); } }