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;
int x, K, n, q;
int state[205], pos[305], tot;
long long dp[2][205], cost[35];
struct matrix {
  long long f[105][105];
  matrix() { memset(f, 0, sizeof(f)); }
  friend matrix operator*(const matrix &a, const matrix &b) {
    matrix c;
    for (int i = 1; i <= tot; ++i) {
      for (int j = 1; j <= tot; ++j) {
        c.f[i][j] = 1000000000000000000LL;
      }
    }
    for (int i = 1; i <= tot; ++i) {
      for (int j = 1; j <= tot; ++j) {
        for (int k = 1; k <= tot; ++k) {
          c.f[i][j] = min(a.f[i][k] + b.f[k][j], c.f[i][j]);
        }
      }
    }
    return c;
  }
} A, B, C;
struct node {
  int p, val;
} qry[35], nq[35];
int cnt;
bool cmp(node a, node b) { return a.p < b.p; }
void movestep(int num) {
  B = A;
  for (int i = 1; i <= tot; ++i) {
    for (int j = 1; j <= tot; ++j) {
      C.f[i][j] = 1000000000000000000LL;
      if (i == j) C.f[i][j] = 0;
    }
  }
  while (num) {
    if (num & 1) {
      C = B * C;
    }
    B = B * B;
    num >>= 1;
  }
}
void update(long long &x, const long long &y) { x = min(x, y); }
int main() {
  scanf("%d%d%d%d", &x, &K, &n, &q);
  for (int i = 1; i <= K; ++i) scanf("%lld", &cost[i]);
  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) {
      state[++tot] = i;
      pos[i] = tot;
    }
  }
  for (int i = 1; i <= tot; i++) {
    for (int j = 1; j <= tot; j++) {
      A.f[i][j] = 1000000000000000000LL;
    }
    if (state[i] & 1) {
      for (int h = 1; h <= K; ++h) {
        if (!(state[i] & (1 << h))) {
          int trans = state[i] | (1 << h);
          trans >>= 1;
          A.f[i][pos[trans]] = cost[h];
        }
      }
    } else {
      A.f[i][pos[state[i] >> 1]] = 0;
    }
  }
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &qry[i].p, &qry[i].val);
  }
  sort(qry + 1, qry + q + 1, cmp);
  int now = 1, cur = 1;
  for (int i = 1; i <= tot; ++i) {
    dp[now][i] = 1000000000000000000LL;
    if (state[i] == (1 << x) - 1) {
      dp[now][i] = 0;
    }
  }
  for (int i = 1; i <= q; ++i) {
    int t = i;
    while (t < q && qry[t + 1].p - K <= qry[t].p) ++t;
    if (cur < qry[i].p - K) {
      if (qry[i].p - K - cur > 0) {
        movestep(qry[i].p - K - cur);
        for (int j = 1; j <= tot; ++j) dp[now ^ 1][j] = 1000000000000000000LL;
        for (int j = 1; j <= tot; ++j) {
          for (int h = 1; h <= tot; ++h) {
            update(dp[now ^ 1][j], dp[now][h] + C.f[h][j]);
          }
        }
        now ^= 1;
        cur = qry[i].p - K;
      }
    }
    while (cur < qry[t].p && cur < n - x + 1) {
      for (int h = 1; h <= tot; ++h) dp[now ^ 1][h] = 1000000000000000000LL;
      for (int h = 1; h <= tot; ++h) {
        if (!(state[h] & 1)) {
          update(dp[now ^ 1][pos[state[h] >> 1]], dp[now][h]);
          continue;
        }
        for (int l = 1; l <= K; ++l) {
          int S = state[h];
          if (!((S >> l) & 1))
            S |= 1 << l;
          else
            continue;
          S >>= 1;
          long long delta = cost[l];
          for (int c = 1; c <= q; ++c) {
            if (cur + l == qry[c].p) delta += qry[c].val;
          }
          update(dp[now ^ 1][pos[S]], dp[now][h] + delta);
        }
      }
      now = now ^ 1;
      ++cur;
    }
    cur = qry[t].p;
    i = t;
  }
  if (cur < n - x + 1) {
    movestep(n - x + 1 - cur);
    for (int j = 1; j <= tot; ++j) dp[now ^ 1][j] = 1000000000000000000LL;
    for (int j = 1; j <= tot; ++j) {
      for (int h = 1; h <= tot; ++h) {
        update(dp[now ^ 1][j], dp[now][h] + C.f[h][j]);
      }
    }
    now ^= 1;
  }
  printf("%lld\n", dp[now][pos[(1 << x) - 1]]);
  return 0;
}