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 int maxn = 8;
const int maxt = 1 << 8;
int X, K;
vector<int> avi;
int id[maxt];
int onepos[maxt][maxn];
void _init(int onecnt, int len) {
  for (int msk = (0); msk < (int)((1 << len)); ++msk) {
    int cnt = 0;
    for (int i = (0); i < (int)(len); ++i) {
      if (msk & (1 << i)) {
        cnt++;
      }
    }
    if (cnt != onecnt) continue;
    avi.push_back(msk);
    id[msk] = avi.size() - 1;
    cnt = 0;
    for (int i = (0); i < (int)(len); ++i) {
      if (msk & (1 << i)) {
        onepos[msk][cnt++] = i;
      }
    }
  }
}
int C[10];
struct matrix {
  int row, col;
  long long val[101][101];
};
bool debug;
matrix operator*(const matrix &A, const matrix &B) {
  matrix E;
  E.row = A.row, E.col = B.col;
  memset(E.val, 0x3f, sizeof(E.val));
  for (int i = (0); i < (int)(E.row); ++i)
    for (int j = (0); j < (int)(E.col); ++j) {
      for (int k = (0); k < (int)(A.col); ++k) {
        E.val[i][j] = (E.val[i][j] < A.val[i][k] + B.val[k][j]
                           ? E.val[i][j]
                           : A.val[i][k] + B.val[k][j]);
      }
    }
  return E;
}
matrix quickpow(const matrix &A, int tim) {
  matrix str = A;
  matrix bse = A;
  tim--;
  while (tim) {
    if (tim & 1) bse = bse * str;
    tim >>= 1;
    str = str * str;
  }
  return bse;
}
matrix ord;
void _init() {
  ord.col = ord.row = avi.size();
  memset(ord.val, 0x3f, sizeof(ord.val));
  for (int i = (0); i < (int)(ord.row); ++i) {
    int msk = avi[i];
    if (msk & (1 << (K - 1))) {
      for (int j = (0); j < (int)(K - 1); ++j) {
        if (msk & (1 << j))
          ;
        else {
          int nmsk = (msk ^ (1 << (K - 1)) ^ (1 << j)) << 1;
          ord.val[i][id[nmsk]] =
              (ord.val[i][id[nmsk]] < C[K - j - 1] ? ord.val[i][id[nmsk]]
                                                   : C[K - j - 1]);
        }
      }
      int nmsk = ((msk ^ (1 << (K - 1))) << 1) ^ 1;
      ord.val[i][id[nmsk]] =
          (ord.val[i][id[nmsk]] < C[K] ? ord.val[i][id[nmsk]] : C[K]);
    } else {
      msk <<= 1;
      ord.val[i][id[msk]] = 0;
    }
  }
}
vector<pair<int, long long> > spe;
matrix buf;
void spe_change(int pos, int stone, int id) {
  int del = K - stone + pos;
  for (int i = (0); i < (int)(buf.row); ++i) {
    for (int j = (0); j < (int)(buf.col); ++j) {
      int fr = avi[i], to = avi[j];
      if (buf.val[i][j] == 0x3f3f3f3f) continue;
      if (!(fr & (1 << (K - 1))) || !(to & (1 << del))) continue;
      if (!del || !(fr & (1 << (del - 1)))) {
        buf.val[i][j] += spe[id].second;
      }
    }
  }
}
vector<pair<pair<int, int>, int> > ind;
matrix ans;
int main() {
  int n, q;
  scanf("%d%d%d%d", &X, &K, &n, &q);
  _init(X, K);
  for (int i = (1); i < (int)(K + 1); ++i) scanf("%d", C + i);
  _init();
  buf = ord;
  for (int i = (0); i < (int)(q); ++i) {
    int pos;
    long long val;
    scanf("%d%lld", &pos, &val);
    spe.push_back(make_pair(pos, val));
  }
  sort(spe.begin(), spe.end());
  for (int i = (0); i < (int)(spe.size()); ++i) {
    int x = spe[i].first;
    ind.push_back(make_pair(make_pair(max(x - K, 1), 1), i));
    ind.push_back(make_pair(make_pair(x, 0), i));
  }
  sort(ind.begin(), ind.end());
  ans.row = ans.col = avi.size();
  bool has = 0;
  int pos = 1;
  set<int> stones;
  stones.clear();
  for (int _ = (0); _ < (int)(ind.size()); ++_) {
    if (pos <
        (ind[_].first.first < n - X + 1 ? ind[_].first.first : n - X + 1)) {
      if (stones.empty()) {
        if (!has)
          ans =
              quickpow(ord, (ind[_].first.first < n - X + 1 ? ind[_].first.first
                                                            : n - X + 1) -
                                pos),
          has = 1;
        else
          ans = ans * quickpow(ord, (ind[_].first.first < n - X + 1
                                         ? ind[_].first.first
                                         : n - X + 1) -
                                        pos);
        pos = ind[_].first.first;
      } else {
        while (pos < ind[_].first.first) {
          buf = ord;
          for (set<int>::iterator it = stones.begin(); it != stones.end();
               it++) {
            spe_change(pos, spe[*it].first, (*it));
          }
          if (has)
            ans = ans * buf;
          else
            ans = buf, has = 1;
          pos++;
          if (pos == n - X + 1) break;
        }
      }
    }
    if (!ind[_].first.second) {
      stones.erase(ind[_].second);
    } else {
      stones.insert(ind[_].second);
    }
  }
  if (n - X + 1 - pos > 0) {
    if (has)
      ans = ans * quickpow(ord, n - X + 1 - pos);
    else
      ans = quickpow(ord, n - X + 1 - pos);
  }
  matrix beg;
  beg.row = 1;
  beg.col = avi.size();
  memset(beg.val, 0x3f, sizeof(beg.val));
  beg.val[0][avi.size() - 1] = 0;
  ans = beg * ans;
  printf("%lld\n", ans.val[0][avi.size() - 1]);
  return 0;
}