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>
long long Pw(long long a, long long b, long long p) {
  long long v = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) v = v * a % p;
  return v;
}
using namespace std;
long long d[32][266][266], g[266], f[266];
int n, m, len, Q, id, cnt, nv, stop, x, y, z, to[266], a[266], c[12];
map<int, int> mp;
struct P {
  int x, z;
} q[30];
bool cmp(P a, P b) { return a.x < b.x; }
void ins(int x, int y, int z) {
  x = to[x];
  y = to[y];
  if (!x || !y) return;
  d[0][x][y] = z;
}
int main() {
  scanf("%d", &n);
  scanf("%d", &len);
  scanf("%d", &m);
  scanf("%d", &Q);
  for (int i = 1; i <= len; i++) scanf("%d", &c[i]);
  for (int i = 1; i <= Q; i++)
    scanf("%d", &q[i].x), scanf("%d", &q[i].z), mp[q[i].x] = q[i].z;
  sort(q + 1, q + Q + 1, cmp);
  for (int i = 0; i < 1 << len; i++) {
    cnt = 0;
    for (int j = 0; j < len; j++)
      if (i >> j & 1) cnt++;
    if (cnt == n) to[i] = ++id, a[id] = i;
  }
  for (int k = 0; k <= 30; k++)
    for (int i = 1; i <= id; i++)
      for (int j = 1; j <= id; j++) d[k][i][j] = 1e18;
  for (int i = 1; i <= (1 << len) - 1; i++) {
    if (i % 2 == 0)
      ins(i, i >> 1, 0);
    else {
      for (int j = 0; j < len; j++)
        if (!(i >> (j + 1) & 1)) ins(i, (i >> 1) + (1 << j), c[j + 1]);
    }
  }
  for (int l = 1; l <= 30; l++)
    for (int k = 1; k <= id; k++)
      for (int i = 1; i <= id; i++)
        for (int j = 1; j <= id; j++)
          d[l][i][j] = min(d[l][i][j], d[l - 1][i][k] + d[l - 1][k][j]);
  nv = 1;
  for (int i = 1; i <= id; i++) f[i] = 1e18;
  f[to[(1 << n) - 1]] = 0;
  for (int qi = 1; qi <= Q; qi++) {
    stop = q[qi].x - len;
    if (stop > nv) {
      x = stop - nv;
      for (int l = 30; ~l; l--)
        if (x >> l & 1) {
          for (int i = 1; i <= id; i++) g[i] = 1e18;
          for (int i = 1; i <= id; i++)
            for (int j = 1; j <= id; j++) g[j] = min(g[j], f[i] + d[l][i][j]);
          for (int i = 1; i <= id; i++) f[i] = g[i];
        }
      nv = stop;
    }
    for (; nv <= q[qi].x && nv <= m - n; nv++) {
      for (int i = 1; i <= id; i++) g[i] = 1e18;
      for (int i = 1; i <= id; i++) {
        x = a[i];
        if (x % 2 == 0) {
          g[to[x >> 1]] = min(g[to[x >> 1]], f[i]);
        } else {
          for (int j = 0; j < len; j++)
            if (!(x >> (j + 1) & 1)) {
              y = to[(x >> 1) + (1 << j)];
              if (!mp[nv + j + 1])
                z = c[j + 1];
              else
                z = c[j + 1] + mp[nv + j + 1];
              if (y) g[y] = min(g[y], f[i] + z);
            }
        }
      }
      for (int i = 1; i <= id; i++) f[i] = g[i];
    }
  }
  x = (m - n + 1) - nv;
  for (int l = 30; ~l; l--)
    if (x >> l & 1) {
      for (int i = 1; i <= id; i++) g[i] = 1e18;
      for (int i = 1; i <= id; i++)
        for (int j = 1; j <= id; j++) g[j] = min(g[j], f[i] + d[l][i][j]);
      for (int i = 1; i <= id; i++) f[i] = g[i];
    }
  printf("%lld", f[to[(1 << n) - 1]]);
}