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 lim, K, N, x, Q;
map<long long, long long> M;
long long Aux[75][75];
long long State[260], Res[75][75], Sol[75][75], Z[75][75], X[75][75],
    Place[75][75];
long long C[10];
long long Possible[75];
long long cnt, Move[75][75];
pair<long long, long long> Special[30];
const long long INF = 100000000000000000;
void Read() {
  scanf("%I64d%I64d%I64d%I64d", &x, &K, &N, &Q);
  for (long long i = 1; i <= K; i++) scanf("%I64d", &C[i]);
  lim = (1 << K);
  for (int i = 1; i <= Q; i++) {
    scanf("%I64d%I64d", &Special[i].first, &Special[i].second);
    M[Special[i].first] = Special[i].second;
  }
  sort(Special + 1, Special + Q + 1);
}
void precalcStates() {
  for (long long i = 0; i < lim; i++) {
    long long c = 0;
    for (long long j = 0; j < K; j++)
      if (i & (1 << j)) ++c;
    if (c == x) {
      ++cnt;
      State[i] = cnt;
      Possible[cnt] = i;
    }
  }
}
void copy(long long A[][75], long long B[][75]) {
  for (long long i = 1; i <= cnt; i++)
    for (long long j = 1; j <= cnt; j++) A[i][j] = B[i][j];
}
void mul(long long A[][75], long long B[][75], long long R[][75]) {
  for (long long i = 1; i <= cnt; i++)
    for (long long j = 1; j <= cnt; j++) {
      R[i][j] = INF;
      for (long long k = 1; k <= cnt; k++)
        R[i][j] = min(R[i][j], A[i][k] + B[k][j]);
    }
}
void initMove() {
  for (int i = 1; i <= cnt; i++)
    for (int j = 1; j <= cnt; j++) {
      Move[i][j] = INF;
    }
  for (int i = 1; i <= cnt; i++) {
    if ((Possible[i] & (1 << (K - 1))) == 0) {
      int conf = State[Possible[i] * 2];
      Move[i][conf] = 0;
      Place[i][conf] = 0;
    } else {
      for (int j = 1; j <= K; j++) {
        int conf = Possible[i] - (1 << (K - 1));
        conf *= 2;
        if ((conf & (1 << (K - j))) != 0) continue;
        conf += (1 << (K - j));
        conf = State[conf];
        Move[i][conf] = C[j];
        Place[i][conf] = j;
      }
    }
  }
}
void init(long long A[][75]) {
  for (int i = 1; i <= cnt; i++)
    for (int j = 1; j <= cnt; j++) {
      A[i][j] = INF;
      if (i == j) A[i][j] = 0;
    }
}
void powerLog(long long A[][75], int p) {
  init(Sol);
  while (p) {
    if (p % 2 == 1) {
      mul(Sol, A, Aux);
      copy(Sol, Aux);
    }
    p /= 2;
    copy(Z, A);
    mul(A, Z, Aux);
    copy(A, Aux);
  }
  copy(A, Sol);
}
void Step(long long A[][75], int pos) {
  copy(Aux, A);
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= cnt; j++) {
      A[i][j] = INF;
      for (int k = 1; k <= cnt; k++) {
        long long val = Aux[i][k] + Move[k][j];
        if (Place[k][j] != 0) val += M[pos + Place[k][j]];
        A[i][j] = min(A[i][j], val);
      }
    }
  }
}
void Solve() {
  int pos = 0;
  Special[Q + 1] = make_pair(N + 1, 0);
  ++Q;
  initMove();
  init(Res);
  Special[0].first = 1;
  long long curr = 1, last = 0;
  while (pos < Q && last < N - K + 1) {
    if (pos > 0)
      for (int i = max(last, Special[pos].first - K);
           i < min(Special[pos].first, N - K + 1); i++) {
        Step(Res, i);
      }
    last = min(Special[pos].first, N - K + 1);
    int diff = Special[pos + 1].first - (Special[pos].first + K - 1) - 1;
    if (diff >= 1) {
      copy(X, Move);
      powerLog(X, diff);
      mul(Res, X, Aux);
      copy(Res, Aux);
    }
    pos++;
  }
  int state = 0, state2 = 0;
  for (int i = 1; i <= K; i++) {
    state *= 2;
    state2 *= 2;
    if (i <= x) state++;
    if (i >= K - x + 1) state2++;
  }
  state = State[state];
  long long Min = INF;
  Min = Res[state][State[state2]];
  for (int i = N - K + 1; i < N - x + 1; i++) {
    Step(Res, i);
    state2 *= 2;
    Min = min(Min, Res[state][State[state2]]);
  }
  printf("%I64d\n", Min);
}
int main() {
  Read();
  precalcStates();
  Solve();
  return 0;
}