#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; const long long MOD = 1000000007; int main(){ int K, N, M; cin >> K >> N >> M; vector a(N); for (int i = 0; i < K; i++){ cin >> a[i]; } vector c(K); for (int i = 0; i < K; i++){ cin >> c[i]; } for (int i = K; i < N; i++){ for (int j = 0; j < K; j++){ a[i] += a[i - j - 1] * c[j] % MOD; a[i] %= MOD; } } vector x(N, 0); for (int i = 0; i < M; i++){ int l, r; cin >> l >> r; for (int j = l; j < r; j++){ x[j] += a[j - l]; } } for (int i = 0; i < N; i++){ cout << x[i] % MOD << endl; } }