func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 998244353;   const int maxn = 1000000 + 100;   long long n, ans;   long long inv[maxn], pro[maxn], invpro[maxn];   void Prepare_C() {     inv[1] = 1;     for (int i = 2; i < maxn; ++i) {       inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;     }     pro[0] = invpro[0] = 1;     for (int i = 1; i < maxn; ++i) {       pro[i] = pro[i - 1] * i % MOD;       invpro[i] = invpro[i - 1] * inv[i] % MOD;     }   }   long long get_C(long long n, long long m) {     if (n < m) {       return 0;     }     return pro[n] * invpro[m] % MOD * invpro[n - m] % MOD;   }   long long Lucas(long long n, long long m) {     if (n < MOD && m < MOD) {       return get_C(n, m);     }     long long tmp = get_C(n % MOD, m % MOD);     if (tmp == 0) {       return 0;     }     return tmp * Lucas(n / MOD, m / MOD) % MOD;   }   long long fast_pow(long long x, long long n) {     long long ans;     for (ans = 1; n != 0; n >>= 1) {       if ((n & 1) == 1) {         ans = (ans * x) % MOD;       }       x = (x * x) % MOD;     }     return ans;   }   int main() {     ios::sync_with_stdio(false);     Prepare_C();     while (scanf( %I64d , &n) != EOF) {       ans = 0;       for (long long i = 1; i <= n; ++i) {         long long first = 1;         long long second = 1;         if (i % 2 == 0) {           first = (-1 * first % MOD + MOD) % MOD;           second = first;         }         first = 2 * first % MOD * Lucas(n, i) % MOD *                 fast_pow(3, (n - i) * n + i) % MOD;         long long tmp = ((fast_pow(3, n - i) - 1) % MOD + MOD) % MOD;         tmp = ((fast_pow(tmp, n) - fast_pow(3, (n - i) * n)) % MOD + MOD) % MOD;         second = 3 * second % MOD * Lucas(n, i) % MOD * tmp % MOD;         ans = (ans + first + second) % MOD;       }       printf( %I64d n , ans);     }     return 0;   }   