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;
const long long inf = (long long)1e18;
int x, k, n, q;
long long cost[10];
vector<vector<long long> > m;
vector<vector<long long> > mul(vector<vector<long long> > a,
                               vector<vector<long long> > b) {
  int n = a.size();
  vector<vector<long long> > result(n, vector<long long>(n, inf));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        result[i][j] = min(result[i][j], a[i][k] + b[k][j]);
      }
    }
  }
  return result;
}
vector<vector<long long> > binpow(vector<vector<long long> > a, int k) {
  if (k == 0) {
    vector<vector<long long> > result(a.size(),
                                      vector<long long>(a.size(), inf));
    for (int i = 0; i < a.size(); i++) result[i][i] = 0;
    return result;
  }
  if (k & 1) return mul(binpow(a, k - 1), a);
  vector<vector<long long> > t = binpow(a, k >> 1);
  return mul(t, t);
}
int num_mask[256];
long long d[300][500];
map<int, int> pos;
int bpos[250];
map<int, int> stones;
int st_mask;
bool check(int mask) {
  int cnt = 0;
  for (int j = 0; j < k; j++) {
    if (mask & (1 << j)) cnt++;
  }
  return cnt == x;
}
void print(int x) {
  for (int j = 0; j < k; j++) {
    if (x & (1 << j))
      cout << 1;
    else
      cout << 0;
  }
  cout << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(num_mask, -1, sizeof(num_mask));
  cin >> x >> k >> n >> q;
  for (int i = 1; i <= k; i++) cin >> cost[i];
  vector<int> masks;
  for (int i = 0; i < (1 << k); i++) {
    int cnt = 0;
    for (int j = 0; j < k; j++) {
      if (i & (1 << j)) cnt++;
    }
    if (cnt == x) {
      num_mask[i] = masks.size();
      masks.push_back(i);
    }
  }
  m.assign(masks.size(), vector<long long>(masks.size(), inf));
  for (int mask : masks) {
    if (mask % 2 == 0) {
      m[num_mask[mask]][num_mask[mask >> 1]] = 0;
    }
    int left = -1;
    for (int j = 0; j < k; j++) {
      if ((mask & (1 << j))) {
        left = j;
        break;
      }
    }
    for (int j = left + 1; j <= k; j++) {
      if (!(mask & (1 << j))) {
        int new_mask = (mask | (1 << j)) ^ (1 << left);
        new_mask >>= 1;
        m[num_mask[mask]][num_mask[new_mask]] = cost[j - left];
      }
    }
  }
  for (int i = 0; i < 300; i++)
    for (int j = 0; j < 500; j++) d[i][j] = inf;
  set<int> poses;
  poses.insert(k);
  for (int i = n; i <= n + k; i++) poses.insert(i);
  pair<int, int> bad[30];
  for (int i = 0; i < q; i++) cin >> bad[i].first >> bad[i].second;
  sort(bad, bad + q);
  for (int i = 0; i < q; i++) {
    int p = bad[i].first;
    int wp = bad[i].second;
    stones[p] = wp;
    if (p - k + 1 < 1) p = k;
    for (int j = p; j <= p + k; j++) poses.insert(j);
  }
  int po = 0;
  for (auto u : poses) {
    bpos[po++] = u;
  }
  d[0][0] = 0;
  for (int i = 0; i < po - 1; i++) {
    int right = bpos[i];
    int left = right - k + 1;
    vector<vector<long long> > r;
    r = binpow(m, bpos[i + 1] - bpos[i]);
    for (int j = 0; j < (int)r.size(); j++) {
      int curmask = masks[j];
      for (int t = 0; t < (int)r.size(); t++) {
        int tomask = masks[t];
        long long move_cost = r[j][t];
        set<int> t1;
        for (int b = 0; b < k; b++) {
          if (curmask & (1 << b)) {
            if (stones.count(left + b)) t1.insert(left + b);
          }
        }
        int _right = bpos[i + 1];
        int _left = _right - k + 1;
        set<int> t2;
        for (int b = 0; b < k; b++) {
          if (tomask & (1 << b)) {
            if (stones.count(_left + b)) t2.insert(_left + b);
          }
        }
        for (auto u : t2) {
          if (!t1.count(u)) move_cost += stones[u];
        }
        d[t][i + 1] = min(d[t][i + 1], d[j][i] + move_cost);
      }
    }
  }
  long long mn = inf;
  int curmask = masks.back();
  int hi = po - 1;
  while (bpos[hi] != n) hi--;
  while (true) {
    mn = min(mn, d[num_mask[curmask]][hi]);
    if (curmask & 1) break;
    curmask >>= 1;
    hi++;
  }
  cout << mn << endl;
}