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 = 2e18;
const int inf_int = 2e9;
vector<vector<long long>> mul(vector<vector<long long>>& a,
                              vector<vector<long long>>& b) {
  int n = a.size();
  int m = b[0].size();
  int v = a[0].size();
  vector<vector<long long>> ret(n, vector<long long>(m, inf));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < v; k++) {
        ret[i][j] = min(ret[i][j], a[i][k] + b[k][j]);
      }
    }
  }
  return ret;
}
vector<vector<long long>> identity(int n) {
  vector<vector<long long>> ret(n, vector<long long>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        ret[i][j] = 0;
      } else {
        ret[i][j] = inf;
      }
    }
  }
  return ret;
}
vector<vector<long long>> power(vector<vector<long long>>& a, int b) {
  if (b == 0) return identity(a.size());
  vector<vector<long long>> tmp = power(a, b / 2);
  tmp = mul(tmp, tmp);
  if (b & 1) {
    tmp = mul(tmp, a);
  }
  return tmp;
}
long long c[15];
int fir[30], sec[30];
int x, k, n, q;
map<int, int> mp;
int until(int v) {
  int ori = v;
  for (int i = 0; i < q; i++) {
    if (fir[i] <= v && v <= sec[i]) {
      v = sec[i];
    }
  }
  if (ori == v) return v;
  return until(v);
}
int zonk(int v) {
  int ret = inf_int;
  for (int i = 0; i < q; i++) {
    if (v <= fir[i]) {
      ret = min(ret, fir[i]);
    }
  }
  if (ret == inf_int) ret = -1;
  return ret;
}
int id[1 << 8];
int mask[1 << 8];
vector<vector<long long>> transform(vector<vector<long long>> a, int from,
                                    int to) {
  int m = a[0].size();
  for (int i = from; i < to; i++) {
    vector<vector<long long>> ret(1, vector<long long>(m, inf));
    for (int j = 0; j < m; j++) {
      int now = mask[j];
      if ((now & 1) == 0) {
        int to = id[now / 2];
        ret[0][to] = min(ret[0][to], a[0][j]);
      } else {
        for (int d = 1; d <= k; d++) {
          if ((now & (1 << d)) == 0) {
            int to = id[((now | (1 << d)) ^ 1) / 2];
            ret[0][to] = min(ret[0][to], a[0][j] + c[d] + mp[i + d]);
          }
        }
      }
    }
    a = ret;
  }
  return a;
}
int main() {
  scanf("%d %d %d %d", &x, &k, &n, &q);
  for (int i = 1; i <= k; i++) {
    scanf("%lld", c + i);
  }
  for (int i = 0; i < q; i++) {
    int p, w;
    scanf("%d %d", &p, &w);
    mp[p] = w;
    fir[i] = max(1, p - k);
    sec[i] = min(n - k + 1, p + 1);
  }
  int pt = 0;
  memset(id, -1, sizeof(id));
  for (int i = 0; i < (1 << k); i++) {
    if (__builtin_popcount(i) != x) continue;
    mask[pt] = i;
    id[i] = pt++;
  }
  vector<vector<long long>> trans(pt, vector<long long>(pt, inf));
  for (int i = 0; i < pt; i++) {
    int now = mask[i];
    if ((now & 1) == 0) {
      int to = id[now / 2];
      trans[i][to] = 0;
    } else {
      for (int d = 1; d <= k; d++) {
        if ((now & (1 << d)) == 0) {
          int to = id[((now | (1 << d)) ^ 1) / 2];
          trans[i][to] = c[d];
        }
      }
    }
  }
  vector<vector<long long>> awal(1, vector<long long>(pt, inf));
  awal[0][0] = 0;
  int now = 1;
  int goal = n - k + 1;
  while (now != goal) {
    int til = zonk(now);
    if (til == -1) {
      vector<vector<long long>> t = power(trans, goal - now);
      awal = mul(awal, t);
      now = goal;
    } else if (til == now) {
      til = until(now);
      awal = transform(awal, now, til);
      now = til;
    } else {
      vector<vector<long long>> t = power(trans, til - now);
      awal = mul(awal, t);
      now = til;
    }
  }
  for (int i = 0; i < pt; i++) {
    int now = mask[i];
    for (int j = 0; j < k; j++) {
      if (now & (1 << j)) {
        for (int l = j + 1; l < k; l++) {
          if ((now & (1 << l)) == 0) {
            int to = id[now ^ (1 << j) ^ (1 << l)];
            awal[0][to] =
                min(awal[0][to], awal[0][i] + c[l - j] + mp[goal + l]);
          }
        }
        break;
      }
    }
  }
  cout << awal[0].back() << endl;
  return 0;
}