def fast_exp_mod(k,n,MOD):
    import math
    
    ans = 1
    temp = k%MOD
    a = [temp]
    saidai = int(math.log2(n))+1
    
    for _ in range(saidai):
        temp = temp**2 % MOD
        a.append(temp)
        
    for i in range(saidai):
        if n & 1 << i:
            ans = ans*a[i] % MOD
    
    return ans

def Main():
    a,n=map(int,input().split())
    MOD=998244353
    print(MOD)
    print(fast_exp_mod(a,n,MOD))
    
Main()