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 n, k, x, q;
long long path[72][72], cost[10];
vector<pair<int, int> > specials;
map<vector<int>, int> pos_to_num;
vector<int> track, position[72];
int pos_counter;
long long odp;
struct matrix {
  long long t[72][72];
  matrix() {
    for (int i = 0; i < 72; i++) {
      for (int j = 0; j < 72; j++) {
        t[i][j] = -1000000000000000000LL;
      }
    }
  }
};
matrix operator*(const matrix &a, const matrix &b) {
  matrix c;
  for (int i = 1; i < 72; i++) {
    for (int j = 1; j < 72; j++) {
      for (int z = 1; z < 72; z++) {
        if (a.t[i][z] != -1000000000000000000LL &&
            b.t[z][j] != -1000000000000000000LL) {
          if (c.t[i][j] == -1000000000000000000LL)
            c.t[i][j] = a.t[i][z] + b.t[z][j];
          else
            c.t[i][j] = min(c.t[i][j], a.t[i][z] + b.t[z][j]);
        }
      }
    }
  }
  return c;
}
matrix base, identity, m;
void put_in() {
  cin >> x >> k >> n >> q;
  for (int i = 1; i <= k; i++) {
    cin >> cost[i];
  }
  for (int i = 1; i <= q; i++) {
    int a, b;
    cin >> a >> b;
    if (a <= x || a >= n - x + 1)
      odp += b;
    else
      specials.push_back(make_pair(a, b));
  }
  sort(specials.begin(), specials.end());
}
void gene_pos(int len, int used) {
  if (x - used > k - len + 1) return;
  if (len == k && used == x) {
    pos_counter++;
    position[pos_counter] = track;
    pos_to_num[track] = pos_counter;
    return;
  }
  if (len == k) return;
  if (used < x) {
    track.push_back(1);
    gene_pos(len + 1, used + 1);
    track.pop_back();
  }
  track.push_back(0);
  gene_pos(len + 1, used);
  track.pop_back();
}
void define_positions() {
  track.push_back(1);
  gene_pos(1, 1);
  track.pop_back();
  track.push_back(0);
  gene_pos(1, 0);
}
void paths() {
  for (int i = 0; i <= pos_counter; i++) {
    for (int j = 0; j <= pos_counter; j++) {
      path[i][j] = -1000000000000000000LL;
    }
  }
  vector<int> pom, pom2;
  for (int i = 1; i <= pos_counter; i++) {
    pom = position[i];
    pom.push_back(0);
    if (pom[0] == 0) {
      pom2.clear();
      for (int j = 1; j < pom.size(); j++) {
        pom2.push_back(pom[j]);
      }
      int jump_to = pos_to_num[pom2];
      path[i][jump_to] = 0;
    } else {
      pom[0] = 0;
      for (int j = 1; j <= k; j++) {
        if (pom[j] == 0) {
          pom[j] = 1;
          pom2.clear();
          for (int z = 1; z < pom.size(); z++) {
            pom2.push_back(pom[z]);
          }
          pom[j] = 0;
          int jump_to = pos_to_num[pom2];
          path[i][jump_to] = cost[j];
        }
      }
    }
  }
}
void make_base_matrix() {
  for (int i = 1; i <= pos_counter; i++) {
    for (int j = 1; j <= pos_counter; j++) {
      base.t[i][j] = path[j][i];
    }
  }
  for (int i = 1; i <= pos_counter; i++) {
    identity.t[i][i] = 0;
  }
  m.t[1][1] = 0;
}
matrix q_power(const matrix &a, int power) {
  if (power == 0) return identity;
  if (power == 1) return a;
  if (power % 2 == 1) {
    return a * q_power(a, power - 1);
  } else {
    matrix b = q_power(a, power / 2);
    return b * b;
  }
}
void go() {
  int curr_pos = 1, dist;
  for (int i = 0; i < specials.size(); i++) {
    dist = specials[i].first - curr_pos;
    m = q_power(base, dist) * m;
    for (int j = 1; j <= pos_counter; j++) {
      if (position[j][0] == 1) {
        if (m.t[j][1] != -1000000000000000000LL)
          m.t[j][1] += specials[i].second;
      } else
        break;
    }
    curr_pos = specials[i].first;
  }
  dist = (n - x + 1) - curr_pos;
  m = q_power(base, dist) * m;
  odp += m.t[1][1];
  cout << odp;
}
int main() {
  put_in();
  define_positions();
  paths();
  make_base_matrix();
  go();
}