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, cnt, dim, curr = 1;
int c[9];
map<int, int> s_nr, nr_s, w;
vector<int> subs;
long long dp[2][70];
long long na_pozycje[70][70];
struct mat {
  long long t[70][70];
};
mat G;
mat operator*(mat &a, mat &b) {
  mat res;
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < cnt; ++j) {
      res.t[i][j] = 1000000000000000007LL;
    }
  }
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < cnt; ++j) {
      for (int k = 0; k < cnt; ++k) {
        res.t[i][j] = min(res.t[i][j], a.t[i][k] + b.t[k][j]);
      }
    }
  }
  return res;
}
mat pot(mat a, int p) {
  mat res;
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < cnt; ++j) {
      res.t[i][j] = 1000000000000000007LL;
    }
  }
  for (int i = 0; i < cnt; ++i) {
    res.t[i][i] = 0;
  }
  for (int i = 0; i < 30; ++i) {
    if (p & (1 << i)) res = res * a;
    a = a * a;
  }
  return res;
}
void przejscie(int moge) {
  auto go = pot(G, moge);
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < cnt; ++j) {
      dp[dim ^ 1][j] = min(dp[dim ^ 1][j], dp[dim][i] + go.t[i][j]);
    }
  }
  for (int i = 0; i < cnt; ++i) {
    dp[dim][i] = 1000000000000000007LL;
  }
  dim ^= 1;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> x >> k >> n >> q;
  for (int i = 1; i <= k; ++i) {
    cin >> c[i];
  }
  for (int i = 1; i <= q; ++i) {
    int p, wp;
    cin >> p >> wp;
    w[p] = wp;
  }
  for (int s = 0; s < 1 << k; ++s) {
    if (__builtin_popcount(s) == x) {
      s_nr[s] = cnt;
      nr_s[cnt++] = s;
      subs.push_back(s);
    }
  }
  for (int i = 0; i < cnt; ++i) {
    for (int j = 0; j < cnt; ++j) {
      G.t[i][j] = 1000000000000000007LL;
    }
  }
  for (auto maska : subs) {
    if (maska & 1) {
      for (int i = 0; i < k; ++i) {
        int nowa = maska >> 1;
        if (!(nowa & (1 << i))) {
          nowa |= 1 << i;
          na_pozycje[s_nr[maska]][s_nr[nowa]] = i;
          G.t[s_nr[maska]][s_nr[nowa]] = c[i + 1];
        }
      }
    } else {
      int nowa = maska >> 1;
      na_pozycje[s_nr[maska]][s_nr[nowa]] = -1000000007;
      G.t[s_nr[maska]][s_nr[nowa]] = 0;
    }
  }
  int start = 0;
  for (int i = 0; i < x; ++i) {
    start |= (1 << i);
  }
  for (int i = 0; i < cnt; ++i) {
    dp[dim][i] = 1000000000000000007LL;
    dp[dim ^ 1][i] = 1000000000000000007LL;
  }
  dp[dim][s_nr[start]] = 0;
  for (int q = 2; q <= n - x + 1; ++q) {
    int moge = 0;
    if (w.lower_bound(q) == w.end())
      moge = n - x + 1 - q;
    else
      moge = max(0, (*w.lower_bound(q)).first - k - q);
    if (moge) przejscie(moge);
    q += moge;
    for (int i = 0; i < cnt; ++i) {
      for (int j = 0; j < cnt; ++j) {
        if (w.find(q + na_pozycje[i][j]) == w.end())
          dp[dim ^ 1][j] = min(dp[dim ^ 1][j], dp[dim][i] + G.t[i][j]);
        else
          dp[dim ^ 1][j] = min(
              dp[dim ^ 1][j], dp[dim][i] + G.t[i][j] + w[q + na_pozycje[i][j]]);
      }
    }
    for (int i = 0; i < cnt; ++i) {
      dp[dim][i] = 1000000000000000007LL;
    }
    dim ^= 1;
  }
  cout << dp[dim][s_nr[start]];
}