import sys input = sys.stdin.readline def read_values(): return tuple(map(int, input().split())) def main(): q=int(input()) mod=998244353 r=[0]*500000 e=[0]*500000 r[0]=e[0]=r[1]=1 e[1]=3 for i in range(500000-2): r[i+2]=(r[i+1]+r[i])%mod e[i+2]=(e[i+1]+e[i])%mod for _ in range(q): n=int(input()) n-=1 print((r[n]*r[n]*5-e[n]*e[n])%mod) if __name__ == "__main__": main()