#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll add(ll a, ll b) { 
    return ((a % mod) + (b % mod)) % mod; 
}
ll mul(ll a, ll b) { 
    return ((a % mod) * (b % mod)) % mod; 
}
ll sub(ll a, ll b) { 
    return ((a % mod) - (b % mod) + mod) % mod; 
}

class Matrix {
public:
    ll r, c;
    vector<vector<ll>> mat;
    Matrix(ll rows, ll cols, ll init = 0) {
        r = rows;
        c = cols;
        mat = vector<vector<ll>>(rows, vector<ll>(cols, init));
    }
    static Matrix identity(ll n) {
        Matrix I(n, n, 0);
        for (ll i = 0; i < n; i++)
            I.mat[i][i] = 1;
        return I;
    }
    Matrix operator+(const Matrix& other) const {
        Matrix res(r, c);
        for (ll i = 0; i < r; i++) {
            for (ll j = 0; j < c; j++) {
                res.mat[i][j] = add(mat[i][j], other.mat[i][j]);
            }
        }
        return res;
    }
    Matrix& operator+=(const Matrix& other) {
        for (ll i = 0; i < r; i++) {
            for (ll j = 0; j < c; j++) {
                mat[i][j] = add(mat[i][j], other.mat[i][j]);
            }
        }
        return *this;
    }
    Matrix operator*(const Matrix& other) const {
        Matrix res(r, other.c, 0);
        for (ll i = 0; i < r; i++) {
            for (ll j = 0; j < other.c; j++) {
                ll sum = 0;
                for (ll k = 0; k < c; k++) {
                    sum = add(sum, mul(mat[i][k], other.mat[k][j]));
                }
                res.mat[i][j] = sum;
            }
        }
        return res;
    }
    Matrix& operator*=(const Matrix& other) {
        *this = *this * other;
        return *this;
    }
    Matrix pow(ll n) const {
        Matrix base = *this;
        Matrix result = Matrix::identity(r);
        while (n > 0) {
            if (n & 1) result *= base;
            base *= base;
            n >>= 1;
        }
        return result;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    ll m, N, Q;
    cin >> m >> N >> Q;
    vector<ll> a(m);
    for (auto &x : a)
        cin >> x;
    
    // Build the companion matrix for f(i) = ∑(previous m numbers)
    Matrix orig(m, m, 0);
    for (int j = 0; j < m; j++) {
        orig.mat[0][j] = 1;  
    }
    for (int i = 1; i < m; i++) {
        orig.mat[i][i - 1] = 1;
    }
    
    // Base state vector: [f(m), f(m-1), ..., f(1)]^T
    Matrix base(m, 1, 0);
    for (int i = 0; i < m; i++) {
        base.mat[i][0] = a[m - 1 - i];
    }
    
    vector<pair<ll, ll>> v;
    for (int i = 0; i < Q; i++) {
        ll j, f;
        cin >> j >> f;
        // Ensure the forced value is in the range [0, mod)
        v.push_back({j, (f % mod + mod) % mod});
    }
    
    ll prev = m; // current index computed
    sort(v.begin(), v.end());
    for (auto &p : v) {
        ll j = p.first, forcedVal = p.second;
        if (j <= prev)
            continue;
        // Jump from 'prev' to forced index j with matrix exponentiation
        Matrix R = orig.pow(j - prev);
        R *= base;
        // Update the state vector: override f(j) with forced value,
        // and keep the rest computed as:
        // New state should be [f(j)_forced, f(j-1)_computed, ..., f(j-m+1)_computed]^T.
        vector<ll> temp(m, 0);
        temp[0] = forcedVal;
        // Fix: use R.mat[k][0], not R.mat[k-1][0]
        for (int k = 1; k < m; k++)
            temp[k] = R.mat[k][0];
        for (int i = 0; i < m; i++)
            base.mat[i][0] = temp[i];
        prev = j;
    }
    
    ll ans;
    if (N <= prev) {
        if (N <= m)
            ans = ((a[N - 1] % mod) + mod) % mod;
        else 
            ans = base.mat[0][0]; // already computed for N = prev
    } else {
        Matrix R = orig.pow(N - prev);
        R *= base;
        ans = R.mat[0][0];
    }
    
    cout << ans << '\n';
    return 0;
}