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 long long INF = (long long)1e18;
vector<int> pts, states;
map<int, int> w;
int x, k, n, q, sz;
int idx[256];
int c[10];
bool bit(int x, int p) { return x & (1 << p); }
int getw(int x) {
  auto it = w.find(x);
  if (it == w.end()) {
    return 0;
  }
  return it->second;
}
vector<long long> apply(vector<long long> a, vector<vector<long long> > b) {
  vector<long long> c(sz, INF);
  for (int i = 0; i < sz; ++i) {
    for (int j = 0; j < sz; ++j) {
      c[j] = min(c[j], a[i] + b[i][j]);
    }
  }
  return c;
}
vector<vector<long long> > mul(vector<vector<long long> > a,
                               vector<vector<long long> > b) {
  vector<vector<long long> > c(sz, vector<long long>(sz, INF));
  for (int i = 0; i < sz; ++i) {
    for (int j = 0; j < sz; ++j) {
      for (int k = 0; k < sz; ++k) {
        c[i][j] = min(c[i][j], a[i][k] + b[k][j]);
      }
    }
  }
  return c;
}
vector<vector<long long> > binPow(vector<vector<long long> > a, int b) {
  vector<vector<long long> > ret(sz, vector<long long>(sz, INF));
  for (int i = 0; i < sz; ++i) {
    ret[i][i] = 0;
  }
  while (b > 0) {
    if (b & 1) {
      ret = mul(ret, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return ret;
}
void solve() {
  scanf("%d %d %d %d", &x, &k, &n, &q);
  for (int i = 0; i < k; ++i) {
    scanf("%d", &c[i]);
  }
  pts.push_back(1);
  pts.push_back(n - x + 1);
  for (int i = 1; i <= q; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    w[a] = b;
    for (int j = max(1, a - k); j <= a; ++j) {
      pts.push_back(j);
    }
  }
  sort((pts).begin(), (pts).end());
  pts.resize(unique((pts).begin(), (pts).end()) - pts.begin());
  while (pts.back() > n - x + 1) {
    pts.pop_back();
  }
  for (int mask = 0; mask < (1 << k); ++mask) {
    if (__builtin_popcount(mask) == x) {
      idx[mask] = sz++;
      states.push_back(mask);
    }
  }
  vector<vector<long long> > go(sz, vector<long long>(sz));
  for (int i = 0; i < states.size(); ++i) {
    int mask = states[i];
    int nmask = mask / 2;
    vector<long long> dp(sz, INF);
    if (mask & 1) {
      for (int dis = 0; dis < k; ++dis) {
        if (!bit(nmask, dis)) {
          nmask += (1 << dis);
          dp[idx[nmask]] = min(dp[idx[nmask]], (long long)c[dis]);
          nmask -= (1 << dis);
        }
      }
    } else {
      dp[idx[nmask]] = 0;
    }
    for (int j = 0; j < sz; ++j) {
      go[i][j] = dp[j];
    }
  }
  vector<long long> dp(sz, INF);
  dp[0] = 0;
  for (int i = 0; i + 1 < (int)pts.size(); ++i) {
    int dif = pts[i + 1] - pts[i];
    if (dif <= 10) {
      for (int t = pts[i]; t < pts[i + 1]; ++t) {
        vector<long long> ndp(sz, INF);
        for (int j = 0; j < sz; ++j) {
          int mask = states[j];
          int nmask = mask / 2;
          if (mask & 1) {
            for (int dis = 0; dis < k; ++dis) {
              if (!bit(nmask, dis)) {
                nmask += (1 << dis);
                int dest = t + dis + 1;
                if (dest <= n) {
                  int cost = c[dis] + getw(dest);
                  ndp[idx[nmask]] = min(ndp[idx[nmask]], dp[j] + cost);
                }
                nmask -= (1 << dis);
              }
            }
          } else {
            ndp[idx[nmask]] = min(ndp[idx[nmask]], dp[j]);
          }
        }
        dp = ndp;
      }
    } else {
      dp = apply(dp, binPow(go, dif));
    }
  }
  printf("%lld\n", dp[0]);
}
int main() {
  int tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}