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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;

/*
 */
public class c {

	static int[] map;
	static int[] rev;
	static int x, k, n, q;
	static int numMasks;
	static int endMask = 0;
	static int[] ps;
	static long[] cs, ws;
	static long[][] mat, ident;
    static long[][][] pows;
	static long oo = (long) 1e18;
	static TreeMap<Integer, Long> ts;
	static HashMap<Integer, Long>[] memo;

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        x = in.nextInt();
        k = in.nextInt();
        n = in.nextInt();
        q = in.nextInt();
        
        cs = new long[k + 1];
        map = new int[4 << k];
        rev = new int[4 << k];
        Arrays.fill(map, -1);
        int curId = 0;
        for (int mask = 0; mask < (1 << k); mask++) {
        	if (Integer.bitCount(mask) == x) {
        		map[mask] = curId++;
        		rev[map[mask]] = mask;
        	}
        }
        numMasks = curId;
        endMask = (1 << x) - 1;
        
        for (int i = 1; i <= k; i++)
        	cs[i] = in.nextLong();
        buildMats();
        
        memo = new HashMap[numMasks];
        for (int i = 0; i < numMasks; i++)
        	memo[i] = new HashMap<>();
        
        ts = new TreeMap<>();
        ps = new int[q];
        ws = new long[q];
        ts.put(n, 0L);
        for (int i = 0; i < q; i++) {
        	ps[i] = in.nextInt();
        	ws[i] = in.nextLong();
        	ts.put(ps[i], ws[i]);
        }
        
        out.println(go(map[endMask], x));
        out.close();
    }
   
    static long go(int start, int pos) {
        int mask = rev[start];
        int truePos = pos - Integer.numberOfTrailingZeros(mask);
        if (truePos > n)
            return oo;
        if (truePos == n && (mask >>> Integer.numberOfTrailingZeros(mask)) == endMask)
            return 0;
    	Long tmpVal = memo[start].get(pos);
    	if (tmpVal != null)
    		return tmpVal;
    	int last = pos - Integer.numberOfTrailingZeros(Integer.highestOneBit(mask));
    	int stone = ts.ceilingKey(last);
    	long res = oo;
    	if (pos < stone - 10) {
            long[] tmp = vecExp(start, stone - 10 - pos);
            for (int i = 0; i < numMasks; i++)
                if (tmp[i] != oo)
                    res = Math.min(res, tmp[i] + go(i, stone - 10));
    	} else {
            for (int jump = 0; jump <= k; jump++) {
                int newMask = getNextMask(mask, jump);
                if (newMask == -1) continue;
                int stoneLoc = last + jump;
                long cost = cs[jump] + go(map[newMask], pos + 1);
                if (jump > 0 && ts.get(stoneLoc) != null)
                    cost += ts.get(stoneLoc);
                res = Math.min(res, cost);
    		}
    	}
    	memo[start].put(pos, res);
    	return res;
    }
    
    static int getNextMask(int m0, int jump) {
        int mask = m0 << 1;
        int left = Integer.highestOneBit(mask);
        int others = mask ^ left;
        int newLeft = left >>> jump;
        if (newLeft == 0) return -1;
        if ((newLeft & others) != 0) return -1;
        int newMask = others | newLeft;
        if (map[newMask] == -1) return -1;
        return newMask;
    }
    
    static long[] vecExp(int start, int pow) {
        long[] res = new long[numMasks];
        long[] tmp = new long[numMasks];
        Arrays.fill(res, oo);
        res[start] = 0;
        for (int bit = 0; bit < 30; bit++) {
            if (((1 << bit) & pow) == 0) continue;
            long[][] mat = pows[bit];
            Arrays.fill(tmp, oo);
            for (int i = 0; i < numMasks; i++)
                for (int j = 0; j < numMasks; j++)
                    tmp[j] = Math.min(tmp[j], res[i] + mat[i][j]);
            long[] tmp2 = res;
            res = tmp;
            tmp = tmp2;
        }
        return res;
    }
    
    static long[][] mult(long[][] a, long[][] b) {
        long[][] res = new long[numMasks][numMasks];
        for (long[] c : res)
            Arrays.fill(c, oo);
        for (int i = 0; i < numMasks; i++)
            for (int j = 0; j < numMasks; j++)
                for (int k = 0; k < numMasks; k++)
                    res[i][k] = Math.min(res[i][k], a[i][j] + b[j][k]);
        return res;
    }
    
    static long[][] exp(int pow) {
        if (pow == 1)
            return mat;
        if (pow == 0)
            return ident;
        long[][] res = exp(pow / 2);
        res = mult(res, res);
        if ((pow & 1) == 1)
            res = mult(res, mat);
        return res;
    }
    
    static void buildMats() {
    	mat = new long[numMasks][numMasks];
    	for (long[] a : mat)
    		Arrays.fill(a, oo);
        ident = new long[numMasks][numMasks];
        for (long[] a : ident)
            Arrays.fill(a, oo);
        for (int i = 0; i < numMasks; i++)
            ident[i][i] = 0;
    	for (int m0 = 0; m0 < map.length; m0 ++) {
    		if (map[m0] == -1) continue;
    		int i0 = map[m0];
            int mask = m0 << 1;
            int left = Integer.highestOneBit(mask);
            int others = mask ^ left;
    		for (int jump = 0; jump <= k; jump++) {
                int newLeft = left >>> jump;
                if (newLeft == 0) continue;
                if ((newLeft & others) != 0) continue;
                int newMask = others | newLeft;
                int i1 = map[newMask];
                if (i1 == -1) continue;
                mat[i0][i1] = Math.min(mat[i0][i1], cs[jump]);
			}
    	}
        pows = new long[30][][];
        pows[0] = mat;
        for (int i = 1; i < 30; i++)
            pows[i] = mult(pows[i - 1], pows[i - 1]);
    }

    static Random rand = new Random();
    static void sort(int[] a) {
        lsbRadixSort(a, true);
    }
    static void sort(long[] a) {
        int n = a.length;
        for (int i = a.length - 1; i > 0; i--) {
            int j = rand.nextInt(i + 1);
            long tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
        Arrays.sort(a);
    }
    static void sort(double[] a) {
        int n = a.length;
        for (int i = a.length - 1; i > 0; i--) {
            int j = rand.nextInt(i + 1);
            double tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
        Arrays.sort(a);
    }
    static void lsbRadixSort(int[] a, boolean signed) {
        int s = 0, n = a.length;
        int[] p = new int[257], b = new int[n];
        int sb = 1 << 31;
        if(signed) for(int i=0;i<n;i++)  a[i] ^= sb;
        while (s < 32) {
            Arrays.fill(p, 0);
            for (int i = 0; i < n; i++)
                p[((a[i] >>> s) & 255)+1]++;
            for(int i=2;i<256;i++)
                p[i] += p[i-1];
            for (int i = 0; i < n; i++)
                b[p[(a[i] >>> s) & 255]++] = a[i];
            int[] tmp = b;  b = a;  a = tmp;
            s += 8;
        }
        if(signed) for(int i=0;i<n;i++)  a[i] ^= sb;
    }
    static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
    static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    static long[] eEuclid(long a, long b) {
        if (b == 0) return new long[] { a, 1, 0 };
        long[] ans = eEuclid(b, a % b);
        long temp = ans[1] - ans[2] * (a / b);
        ans[1] = ans[2];  ans[2] = temp;
        return ans;
    }
    static long modInverse(long a, long m) {
        return ((eEuclid(a, m)[1] % m) + m) % m;
    }
    static class IntList {
        static int[] EMPTY = {};
        int[] a = EMPTY;
        int n = 0;
        void add(int v) {
            if (n >= a.length)
                a = Arrays.copyOf(a, (n << 2) + 8);
            a[n++] = v;
        }
        int get(int idx) {
            return a[idx];
        }
        int size() {
            return n;
        }
    }
    static class DisjointSet {
        int[] s;
	
        public DisjointSet(int n) {
            Arrays.fill(s = new int[n], -1);
        }	
        public int find(int i) {
            return s[i] < 0 ? i : (s[i] = find(s[i]));
        }	
        public boolean union(int a, int b) {
            if ((a = find(a)) == (b = find(b))) return false;
            if(s[a] == s[b]) s[a]--;
            if(s[a] <= s[b]) s[b] = a; else s[a] = b;
            return true;
        }
    }
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream i) {
            br = new BufferedReader(new InputStreamReader(i));
            st = new StringTokenizer("");
        }
        public String next() throws IOException {
            if(st.hasMoreTokens())
                return st.nextToken();
            else
                st = new StringTokenizer(br.readLine());
            return next();
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        public int[] nextOffsetIntArray(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextInt() - 1;
            return arr;
        }
        public int[] nextIntArray(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextInt();
            return arr;
        }
        public int[][] nextIntArray(int n, int m) throws IOException {
            int[][] arr = new int[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextInt();
            return arr;
        }
        public long[] nextLongArray(int n) throws IOException {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextLong();
            return arr;
        }
        public long[][] nextLongArray(int n, int m) throws IOException {
            long[][] arr = new long[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextLong();
            return arr;
        }
        public double[] nextDoubleArray(int n) throws IOException {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextDouble();
            return arr;
        }
        public double[][] nextDoubleArray(int n, int m) throws IOException {
            double[][] arr = new double[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextDouble();
            return arr;
        }
        public char[][] nextCharArray(int n, int m) throws IOException {
            char[][] arr = new char[n][];
            for (int i = 0; i < n; i++)
                arr[i] = next().toCharArray();
            return arr;
        }
    }
}