Problem: As we all know, Dart is some kind of creature from Upside Down world. For simplicity, we call their kind pollywogs. Dart and x - 1 other pollywogs are playing a game. There are n stones in a row, numbered from 1 through n from left to right. At most 1 pollywog may be sitting on each stone at a time. Initially, the pollywogs are sitting on the first x stones (one pollywog on each stone).

<image>

Dart and his friends want to end up on the last x stones. At each second, the leftmost pollywog should jump to the right. A pollywog can jump at most k stones; more specifically, a pollywog can jump from stone number i to stones i + 1, i + 2, ... i + k. A pollywog can't jump on an occupied stone. Jumping a distance i takes ci amounts of energy from the pollywog. 

Also, q stones are special Each time landing on a special stone p, takes wp amounts of energy (in addition to the energy for jump) from the pollywog. wp could be negative, in this case, it means the pollywog absorbs |wp| amounts of energy.

Pollywogs want to spend as little energy as possible (this value could be negative). 

They're just pollywogs, so they asked for your help. Tell them the total change in their energy, in case they move optimally.

Input

The first line of input contains four integers, x, k, n and q (1 ≤ x ≤ k ≤ 8, k ≤ n ≤ 108, 0 ≤ q ≤ min(25, n - x)) — the number of pollywogs, the maximum length of jump, the number of stones and the number of special stones.

The next line contains k integers, c1, c2, ... ck, separated by spaces (1 ≤ ci ≤ 109) — the energetic costs of jumps.

The next q lines contain description of the special stones. Each line contains two integers p and wp (x + 1 ≤ p ≤ n, |wp| ≤ 109). All p are distinct.

Output

Print the minimum amount of energy they need, in the first and only line of output.

Examples

Input

2 3 10 2
1 2 3
5 -10
6 1000


Output

6


Input

4 7 85 3
17 5 28 4 52 46 6
59 -76
33 -69
19 2018


Output

135

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct matrix {
  long long a[71][71], n, m;
  matrix mul(matrix &a, matrix &b) {
    long long n, m, p;
    matrix ans;
    n = a.n, m = a.m, p = b.m;
    ans.n = n, ans.m = p;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < p; j++) {
        ans.a[i][j] = 4557430888798830399;
        for (long long k = 0; k < m; k++)
          ans.a[i][j] = ans.a[i][j] < a.a[i][k] + b.a[k][j]
                            ? ans.a[i][j]
                            : a.a[i][k] + b.a[k][j];
      }
    return ans;
  }
  matrix getpow(matrix a, long long p) {
    if (p == 1) return a;
    matrix tmp = getpow(a, p / 2), ans = mul(tmp, tmp);
    if (p & 1) ans = mul(ans, a);
    ans.m = a.m;
    ans.n = a.n;
    return ans;
  }
};
vector<long long> v;
long long x, k, n, q, c[9], pos[257], dp[2][71], sz;
map<long long, long long> take, cnt;
set<long long> s;
pair<long long, long long> p[26];
matrix m, def;
void manual(long long cur, long long fin) {
  memset(dp, 63, sizeof(dp));
  for (long long i = 0; i < sz; i++) dp[cur & 1][i] = m.a[0][i];
  for (long long it = cur; it < fin; it++) {
    long long i = it & 1, nxt = i ^ 1;
    for (long long j = 0; j < sz; j++) dp[nxt][j] = 4557430888798830399;
    for (long long j = 0; j < sz; j++) {
      if (dp[i][j] != 4557430888798830399) {
        long long mask = v[j] >> 1;
        if (v[j] & 1) {
          for (long long temp = 0; temp < k; temp++)
            if (!(mask & (1 << temp))) {
              long long realpos = it + 1 + temp,
                        cost = c[realpos - it] +
                               (take.count(realpos) > 0 ? take[realpos] : 0);
              dp[nxt][pos[mask | (1 << temp)]] =
                  dp[nxt][pos[mask | (1 << temp)]] < dp[i][j] + cost
                      ? dp[nxt][pos[mask | (1 << temp)]]
                      : dp[i][j] + cost;
            }
        } else
          dp[nxt][pos[mask]] =
              dp[nxt][pos[mask]] < dp[i][j] ? dp[nxt][pos[mask]] : dp[i][j];
      }
    }
  }
  for (long long i = 0; i < sz; i++) m.a[0][i] = dp[fin % 2][i];
}
void builddef() {
  def.m = sz;
  def.n = sz;
  for (long long i = 0; i < sz; i++) {
    long long msk = v[i];
    if (msk & 1) {
      long long nxt = msk >> 1;
      for (long long temp = 0; temp < k; temp++)
        if (!(nxt & (1 << temp))) {
          long long cost = c[temp + 1];
          def.a[i][pos[nxt | (1 << temp)]] = cost;
        }
    } else
      def.a[i][pos[msk >> 1]] = 0;
  }
}
void updmatrix(long long cur, long long fin) {
  matrix temp = temp.getpow(def, fin - cur);
  m = m.mul(m, temp);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> x >> k >> n >> q;
  for (long long i = 1; i < k + 1; i++) cin >> c[i];
  for (long long i = 0; i < q; i++) {
    long long pos, val;
    cin >> pos >> val;
    pos--;
    cnt[max(pos - k, 0LL)]++;
    cnt[pos + 1]--;
    s.insert(max(pos - k, 0LL));
    s.insert(pos + 1);
    take[pos] = val;
  }
  memset(pos, -1, sizeof(pos));
  for (long long i = 0; i < (1 << k); i++)
    if (__builtin_popcount(i) == x) pos[i] = v.size(), v.push_back(i);
  sz = v.size();
  m.n = 1;
  m.m = sz;
  memset(m.a, 63, sizeof(m.a));
  memset(def.a, 63, sizeof(def.a));
  builddef();
  m.a[0][0] = 0;
  long long incnt = 0;
  s.insert(0);
  s.insert(n - x);
  auto curpos = s.begin();
  curpos++;
  for (auto i : s) {
    if (i == n - x) break;
    incnt += cnt[i];
    if (!incnt)
      updmatrix(i, *curpos);
    else
      manual(i, *curpos);
    if (*curpos != n - 1) curpos++;
  }
  cout << m.a[0][pos[(1 << x) - 1]];
  return 0;
}