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;
long long mod = 1000000007;
long long inf = mod * mod;
bool inline iset(int n, int idx) { return n & (1 << idx); }
int c[10];
int N = 0;
long long tmp[70][70];
long long ans[70][70];
long long M[70][70];
long long MC[27][70][70];
vector<int> states;
int mp[1 << 8];
void mat_mul(long long a[70][70], long long b[70][70], long long c[70][70]) {
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (N); ++j) {
      tmp[i][j] = inf;
      for (int k = 0; k < (N); ++k)
        tmp[i][j] = min(tmp[i][j], a[i][k] + b[k][j]);
    }
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (N); ++j) c[i][j] = tmp[i][j];
}
inline void min_(long long& a, long long b) { a = min(a, b); }
void jump(vector<long long>& v, int n) {
  for (int i = 0; n; ++i, n >>= 1)
    if (n & 1) {
      for (int j = 0; j < (N); ++j) {
        tmp[0][j] = inf;
        for (int j1 = 0; j1 < (N); ++j1) min_(tmp[0][j], v[j1] + MC[i][j][j1]);
      }
      for (int j = 0; j < (N); ++j) v[j] = tmp[0][j];
    }
}
map<int, int> Q;
int k;
void move(vector<long long>& v, int n) {
  for (int i = 0; i < (N); ++i) tmp[0][i] = inf;
  for (int i = 0; i < (N); ++i)
    if (!iset(states[i], k - 1))
      min_(tmp[0][mp[states[i] << 1]], v[i]);
    else
      for (int j = 1; j <= k; ++j)
        if (j == k || !iset(states[i], k - 1 - j)) {
          int newState = (states[i] << 1) ^ (1 << k);
          newState |= (1 << (k - j));
          min_(tmp[0][mp[newState]],
               v[i] + c[j] + (Q.find(n + j) != Q.end() ? Q[n + j] : 0));
        }
  for (int i = 0; i < (N); ++i) v[i] = tmp[0][i];
}
int main() {
  int x, n, q;
  scanf("%d%d", &x, &k);
  scanf("%d%d", &n, &q);
  for (int i = 0; i < (k); ++i) scanf("%d", &c[i + 1]);
  vector<std::pair<int, int> > Qq(q);
  for (int i = 0; i < (q); ++i) {
    scanf("%d%d", &Qq[i].first, &Qq[i].second);
    Q[Qq[i].first] = Qq[i].second;
  }
  for (int mask = 0; mask < ((1 << k)); ++mask)
    if (__builtin_popcount(mask) == x) states.push_back(mask);
  N = states.size();
  assert(N <= 70);
  for (int i = 0; i < (N); ++i) mp[states[i]] = i;
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (N); ++j) M[i][j] = inf;
  for (int i = 0; i < (N); ++i) {
    if (iset(states[i], k - 1)) {
      for (int j = 1; j <= k; ++j)
        if (j == k || !iset(states[i], k - 1 - j)) {
          int newState = (states[i] << 1) ^ (1 << k);
          newState |= (1 << (k - j));
          M[mp[newState]][i] = c[j];
        }
    } else {
      M[mp[states[i] << 1]][i] = 0;
    }
  }
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (N); ++j) MC[0][i][j] = M[i][j];
  for (int i = 0; i < (26); ++i) mat_mul(MC[i], MC[i], MC[i + 1]);
  int inS = 0;
  for (int i = 0; i < (x); ++i) inS |= (1 << (k - 1 - i));
  vector<long long> I(N, inf);
  I[mp[inS]] = 0;
  sort(Qq.begin(), Qq.end());
  int w = 1, j = 0;
  while (w <= n - x) {
    while (j < q && Qq[j].first <= w) ++j;
    if (j >= q) {
      jump(I, n - x - w + 1);
      w = n - x + 1;
    } else {
      if (w < Qq[j].first - k) {
        jump(I, Qq[j].first - k - w);
        w = Qq[j].first - k;
      } else {
        while (w <= n - x && w < Qq[j].first) move(I, w++);
      }
    }
  }
  printf("%lld\n", I[mp[inS]]);
  return 0;
}