#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M=1000000007; int K,N,Q; ULL a[200],C[200]; ULL A[100001][200]={}; ULL G[100001][200]={}; int main(){ cin>>K>>N>>Q; rep(i,K) cin>>a[i]; rep(i,K) cin>>C[i]; reverse(C,C+K); A[0][0]=1; for(int i=1; i<=N; i++){ rep(j,K-1) A[i][j+1]=A[i-1][j]; rep(j,K) A[i][j]=(A[i][j]+A[i-1][K-1]*C[j])%M; } rep(q,Q){ int l,r; cin>>l>>r; rep(i,K) G[l][i]=(G[l][i]+A[0][i])%M; rep(i,K) G[r][i]=(G[r][i]+M-A[r-l][i])%M; } for(int i=1; i<=N; i++){ rep(j,K-1) G[i][j+1]=(G[i][j+1]+G[i-1][j])%M; rep(j,K) G[i][j]=(G[i][j]+G[i-1][K-1]*C[j])%M; } rep(i,N){ ULL ans=0; rep(j,K) ans=(ans+G[i][j]*a[j])%M; cout<