func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2000005;   const int P = 998244353;   long long n;   long long f[N], g[N];   long long a[N];   long long inv_9, inv_6, inv_1;   long long ans;   long long exp_3[N];   long long fac[N], c_n[N];   inline long long ksm(long long base, long long x) {     long long res = 1;     while (x) {       if (x & 1) res *= base, res %= P;       base *= base, base %= P;       x >>= 1;     }     return res;   }   void work() {     int type;     for (int i = 0; i < n; i++) {       if ((n - i) % 2 == 0)         type = 1;       else         type = P - 1;       ans +=           ((c_n[i]) *            (((type) *              ((P + ksm((exp_3[i] - 1 + P) % P, n) - ksm(exp_3[i], n)) % P) % P)) %            P),           ans %= P;     }     ans *= 3, ans %= P;     ans = P - ans, ans %= P;     for (int i = 1; i <= n; i++) {       if (i & 1)         type = 1;       else         type = P - 1;       ans +=           ((2) *            (((type) * (((c_n[i]) * (ksm(3, n * n - i * (n - 1))) % P)) % P)) % P),           ans %= P;     }   }   void init() {     scanf( %lld , &n);     a[2 * n] = ksm(3, 2 * n);     a[n] = ((P - 2) * ksm(3, n)) % P;     a[0] = 1;     exp_3[0] = 1;     for (int i = 1; i <= n; i++) exp_3[i] = ((3) * (exp_3[i - 1]) % P);     fac[0] = 1;     for (int i = 1; i <= n; i++) fac[i] = ((i) * (fac[i - 1]) % P);     for (int i = 0; i <= n; i++)       c_n[i] = ((fac[n]) *                 (((ksm(fac[i], P - 2)) * (ksm(fac[n - i], P - 2)) % P)) % P);     work();     printf( %lld n , ans);   }   int main(int argc, char** argv) {     init();     return 0;   }   