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 INF = 2e9;
const long long LINF = 1e18 + 48;
const int magic = 348;
const int MOD = 998244353;
const double eps = 1e-10;
const double pi = acos(-1);
struct fastio {
  static const int S = 1e7;
  char rbuf[S + 48], wbuf[S + 48];
  int rpos, wpos, len;
  fastio() { rpos = len = wpos = 0; }
  inline char Getchar() {
    if (rpos == len) rpos = 0, len = fread(rbuf, 1, S, stdin);
    if (!len) return EOF;
    return rbuf[rpos++];
  }
  template <class T>
  inline void Get(T &first) {
    char ch;
    bool f;
    T res;
    while (!isdigit(ch = Getchar()) && ch != '-') {
    }
    if (ch == '-')
      f = false, res = 0;
    else
      f = true, res = ch - '0';
    while (isdigit(ch = Getchar())) res = res * 10 + ch - '0';
    first = (f ? res : -res);
  }
  inline void getstring(char *s) {
    char ch;
    while ((ch = Getchar()) <= 32) {
    }
    for (; ch > 32; ch = Getchar()) *++s = ch;
    *(s + 1) = '\0';
  }
  inline void flush() {
    fwrite(wbuf, 1, wpos, stdout);
    fflush(stdout);
    wpos = 0;
  }
  inline void Writechar(char ch) {
    if (wpos == S) flush();
    wbuf[wpos++] = ch;
  }
  template <class T>
  inline void Print(T first) {
    char s[20];
    int pt = 0;
    if (first == 0)
      s[++pt] = '0';
    else {
      if (first < 0) Writechar('-'), first = -first;
      while (first) s[++pt] = '0' + first % 10, first /= 10;
    }
    while (pt) Writechar(s[pt--]);
    Writechar('\n');
  }
  inline void printstring(char *s) {
    int pt = 1;
    while (s[pt] != '\0') Writechar(s[pt++]);
  }
} io;
int first, k, n, q;
int C[10];
int vMask[348], tot;
pair<int, int> spe[48];
map<int, int> Mp;
struct Matrix {
  long long b[278][278];
  inline void clear() {
    for (register int i = 1; i <= tot; i++)
      for (register int j = 1; j <= tot; j++) b[i][j] = LINF;
  }
  inline void init_I() {
    clear();
    for (register int i = 1; i <= tot; i++) b[i][i] = 0;
  }
  inline Matrix operator*(Matrix ma) {
    Matrix res;
    res.clear();
    for (register int i = 1; i <= tot; i++)
      for (register int j = 1; j <= tot; j++)
        for (register int k = 1; k <= tot; k++)
          res.b[i][j] = min(res.b[i][j], b[i][k] + ma.b[k][j]);
    return res;
  }
  inline Matrix operator^(Matrix ma) {
    Matrix res;
    res.clear();
    for (register int j = 1; j <= tot; j++)
      for (register int k = 1; k <= tot; k++)
        res.b[1][j] = min(res.b[1][j], b[1][k] + ma.b[k][j]);
    return res;
  }
} sta, Trans, trans;
inline Matrix quick_pow(Matrix first, int second) {
  Matrix res;
  res.init_I();
  while (second) {
    if (second & 1) res = res * first, second--;
    first = first * first;
    second >>= 1;
  }
  return res;
}
inline pair<int, int> identify(int Mask) {
  pair<int, int> res = make_pair(0, 0);
  for (register int i = 1; i <= k + 1; i++)
    if (Mask & (1 << (i - 1))) {
      if (res.first == 0)
        res.first = i;
      else
        res.second = i;
    }
  return res;
}
inline int lastdigit(int Mask) {
  register int i;
  for (i = 1; !(Mask & (1 << (i - 1))); i++) {
  }
  return i;
}
int main() {
  io.Get(first);
  io.Get(k);
  io.Get(n);
  io.Get(q);
  int i, j, r, c;
  for (i = 1; i <= k; i++) io.Get(C[i]);
  for (register int Mask = 1; Mask <= (1 << k) - 1; Mask++)
    if (__builtin_popcount(Mask) == first) vMask[++tot] = Mask;
  for (i = 1; i <= q; i++)
    io.Get(spe[i].first), io.Get(spe[i].second),
        Mp[spe[i].first] = spe[i].second;
  sort(spe + 1, spe + q + 1);
  spe[++q] = make_pair(n + 1, 0);
  int cp = first, sMask;
  for (sMask = 1;
       sMask <= tot && vMask[sMask] != ((1 << first) - 1) << (k - first);
       sMask++) {
  }
  sta.clear();
  sta.b[1][sMask] = 0;
  Trans.clear();
  for (i = 1; i <= tot; i++)
    for (j = 1; j <= tot; j++) {
      int delta = (vMask[i] ^ (vMask[j] << 1));
      if (__builtin_popcount(delta) == 0)
        Trans.b[i][j] = 0;
      else if (__builtin_popcount(delta) == 2 &&
               lastdigit(vMask[i]) == lastdigit(delta)) {
        pair<int, int> pos = identify(delta);
        Trans.b[i][j] = C[pos.second - pos.first];
      }
    }
  for (i = 1; i <= q; i++) {
    if (cp < spe[i].first - 1) {
      sta = sta ^ quick_pow(Trans, spe[i].first - 1 - cp);
      cp = spe[i].first - 1;
    }
    if (cp == n) break;
    int tar = min(spe[i + 1].first - 1, spe[i].first + k + 1);
    for (j = cp + 1; j <= tar; j++) {
      trans.clear();
      for (r = 1; r <= tot; r++)
        for (c = 1; c <= tot; c++) {
          int delta = (vMask[r] ^ (vMask[c] << 1));
          if (__builtin_popcount(delta) == 0)
            trans.b[r][c] = 0;
          else if (__builtin_popcount(delta) == 2 &&
                   (lastdigit(vMask[r]) == lastdigit(delta))) {
            pair<int, int> pos = identify(delta);
            trans.b[r][c] = C[pos.second - pos.first];
            int rpos = (j - k + 1 + pos.second - 1 - 1);
            trans.b[r][c] += Mp[rpos];
          }
        }
      sta = sta ^ trans;
    }
    cp = tar;
  }
  int eMask;
  long long ans = LINF;
  for (eMask = 1;
       eMask <= tot && vMask[eMask] != (((1 << first) - 1) << (k - first));
       eMask++) {
  }
  ans = min(ans, sta.b[1][eMask]);
  for (i = n + 1; i <= n + k - first; i++) {
    trans.clear();
    for (r = 1; r <= tot; r++)
      for (c = 1; c <= tot; c++) {
        int delta = (vMask[r] ^ (vMask[c] << 1));
        if (__builtin_popcount(delta) == 0)
          trans.b[r][c] = 0;
        else if (__builtin_popcount(delta) == 2 &&
                 (lastdigit(vMask[r]) == lastdigit(delta))) {
          pair<int, int> pos = identify(delta);
          trans.b[r][c] = C[pos.second - pos.first];
          int rpos = (i - k + 1 + pos.second - 1 - 1);
          trans.b[r][c] += Mp[rpos];
        }
      }
    sta = sta ^ trans;
    for (eMask = 1; eMask <= tot && vMask[eMask] != (((1 << first) - 1)
                                                     << (k - first - (i - n)));
         eMask++) {
    }
    ans = min(ans, sta.b[1][eMask]);
  }
  io.Print(ans);
  io.flush();
  return 0;
}