#(1/pi)*(1/N)*Integral[1/(x^2+A^2)^m,{x,-Infinity,Infinity}] #=>cal(N,A,m) mod=998244353 def cal(N,A,m): numer=1 denom=N*pow(A,2*m-1,mod)*pow(4,m-1,mod)%mod for i in range(m,2*m-1): numer*=i numer%=mod for i in range(1,m): denom*=i denom%=mod return numer*pow(denom,-1,mod)%mod def change(tuple_1,A2): N1,A1,m1=tuple_1 if A1==A2: return [(N1,A1,m1+1)] if m1==1: return [(N1*(A2**2-A1**2),A1,1),(-N1*(A2**2-A1**2),A2,1)] else: tmp=change((-N1*(A2**2-A1**2), A1, m1-1), A2) return [(N1*(A2**2-A1**2),A1,m1)]+tmp n=int(input()) a=list(map(int,input().split())) a.sort() li=[(1,a[0],1)] for i in range(1,n): ret=[] for tu in li: ret+=change(tu,a[i]) li=ret[:] # print(li) ans=0 for tu in li: ans+=cal(*tu) print(ans%mod)