n,m,q=map(int,input().split()) a=list(map(int,input().split())) M=998244353 h=[1]*(n+1) for i in range(n): h[i]=(a[i]*h[i-1])%M for i in range(q): l,r=map(int,input().split()) l-=1 r-=1 print((h[r]*pow(h[l],M-2,M))%M)