#include using namespace std; using ll = long long; using PII = pair; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define POPCOUNT(x) __builtin_popcount(x) template void chmin(T &a, const T &b) { a = min(a, b); } template void chmax(T &a, const T &b) { a = max(a, b); } const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; struct FastIO { FastIO() { cin.tie(0); ios::sync_with_stdio(0); } } fastiofastio; ll a[100000], c[201]; ll sum[100000][201]; ll imos[100000]; int main() { int K, N, M; cin >> K >> N >> M; for (int i = 0; i < K; i++) { cin >> a[i]; a[i] %= MOD; } for (int i = 1; i <= K; i++) { cin >> c[i]; c[i] %= MOD; } for (int i = 0; i < N; i++) { sum[i][0] = 0; for (int j = 1; j <= K; j++) { (sum[i][j] += sum[i][j - 1]) %= MOD; if (i >= j) (sum[i][j] += c[j] * a[i - j] % MOD) %= MOD; } if (i >= K) a[i] = sum[i][K]; } for (int i = 0; i < M; i++) { int l, r; cin >> l >> r; for (int j = 0; j < K; j++) { if (l + j >= N) break; ll add = a[j]; (add += MOD - sum[j][j]) %= MOD; (imos[l + j] += add) %= MOD; } for (int j = 0; j < K; j++) { if (r + j >= N) break; ll sub = a[r - l + j]; (sub += MOD - sum[r - l + j][j]) %= MOD; (imos[r + j] += MOD - sub) %= MOD; } } for (int i = 0; i < N; i++) { for (int j = 1; j <= K; j++) { if (j > i) break; (imos[i] += c[j] * imos[i - j] % MOD) %= MOD; } } for (int i = 0; i < N; i++) cout << imos[i] << '\n'; }