K,N,M=map(int,input().split()) a=list(map(int,input().split())) c=list(map(int,input().split())) mod=10**9+7 seq=a+[0]*(N-K) for i in range(K,N): seq[i]=sum(c[j]*seq[i-1-j] for j in range(K)) seq[i]%=mod end_data=[0 for i in range(K)] first=[a[i] for i in range(K)] for i in range(1,K): minus=sum(a[j]*c[i-1-j] for j in range(i)) first[i]-=minus first[i]%=mod check=[first[i] for i in range(K)] for i in range(1,K): check[i]+=sum(c[j]*check[i-1-j] for j in range(i)) check[i]%=mod x=[0]*(N+K+1) too_short=[0]*N end_query=[[] for i in range(N)] for _ in range(M): l,r=map(int,input().split()) if r-l>=K: for i in range(l,l+K): x[i]+=first[i-l] x[i]%=mod if r-l!=N: end_query[r-l].append(r) else: for i in range(l,r): too_short[i]+=a[i-l] too_short[i]%=mod for i in range(N-1,-1,-1): for j in range(K-1,-1,-1): end_data[j]=(end_data[j-1]-c[j-1]*seq[i])%mod end_data[0]=seq[i] for r in end_query[i]: for j in range(r,r+K): x[j]+=-end_data[j-r] x[j]%=mod for i in range(N): x[i]+=sum(c[j]*x[i-1-j] for j in range(min(K,i))) x[i]%=mod for i in range(N): print((x[i]+too_short[i])%mod)