Problem: Alice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of p players playing in p different positions. She also recognizes the importance of audience support, so she wants to select k people as part of the audience.

There are n people in Byteland. Alice needs to select exactly p players, one for each position, and exactly k members of the audience from this pool of n people. Her ultimate goal is to maximize the total strength of the club.

The i-th of the n persons has an integer a_{i} associated with him — the strength he adds to the club if he is selected as a member of the audience.

For each person i and for each position j, Alice knows s_{i, j} — the strength added by the i-th person to the club if he is selected to play in the j-th position.

Each person can be selected at most once as a player or a member of the audience. You have to choose exactly one player for each position.

Since Alice is busy, she needs you to help her find the maximum possible strength of the club that can be achieved by an optimal choice of players and the audience.

Input

The first line contains 3 integers n,p,k (2 ≤ n ≤ 10^{5}, 1 ≤ p ≤ 7, 1 ≤ k, p+k ≤ n).

The second line contains n integers a_{1},a_{2},…,a_{n}. (1 ≤ a_{i} ≤ 10^{9}).

The i-th of the next n lines contains p integers s_{i, 1}, s_{i, 2}, ..., s_{i, p}. (1 ≤ s_{i,j} ≤ 10^{9})

Output

Print a single integer {res} — the maximum possible strength of the club.

Examples

Input


4 1 2
1 16 10 3
18
19
13
15


Output


44


Input


6 2 3
78 93 9 17 13 78
80 97
30 52
26 17
56 68
60 36
84 55


Output


377


Input


3 2 1
500 498 564
100002 3
422332 2
232323 1


Output


422899

Note

In the first sample, we can select person 1 to play in the 1-st position and persons 2 and 3 as audience members. Then the total strength of the club will be equal to a_{2}+a_{3}+s_{1,1}.

Solution (in JAVA):

Solution:
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    public static class Task {

        class Edge {
            int to, f, cap, cost, rev;

            Edge(int v, int cap, int cost, int rev) {
                this.to = v;
                this.cap = cap;
                this.cost = cost;
                this.rev = rev;
            }
        }

        public List<Edge>[] createGraph(int n) {
            List<Edge>[] graph = new List[n];
            for (int i = 0; i < n; i++)
                graph[i] = new ArrayList<Edge>();
            return graph;
        }

        public void addEdge(List<Edge>[] graph, int s, int t, int cap, int cost) {
//            if (s >= 5)
//                System.err.println(inv.get(s) + " " + t + " " + cap + " " + cost);
            graph[s].add(new Edge(t, cap, cost, graph[t].size()));
            graph[t].add(new Edge(s, 0, -cost, graph[s].size() - 1));
        }

        public class MinCostMaxFlow {
            void bellmanFord(List<Edge>[] graph, int s, long[] dist, int[] prevnode, int[] prevedge, int[] curflow) {
                int n = graph.length;
                Arrays.fill(dist, 0, n, Long.MAX_VALUE);
                dist[s] = 0;
                curflow[s] = Integer.MAX_VALUE;
                boolean[] inqueue = new boolean[n];
                int[] q = new int[n];
                int qt = 0;
                q[qt++] = s;
                for (int qh = 0; (qh - qt) % n != 0; qh++) {
                    int u = q[qh % n];
                    inqueue[u] = false;
                    for (int i = 0; i < graph[u].size(); i++) {
                        Edge e = graph[u].get(i);
                        if (e.f >= e.cap)
                            continue;
                        int v = e.to;
                        long ndist = dist[u] + e.cost;
                        if (dist[v] > ndist) {
                            dist[v] = ndist;
                            prevnode[v] = u;
                            prevedge[v] = i;
                            curflow[v] = Math.min(curflow[u], e.cap - e.f);
                            if (!inqueue[v]) {
                                inqueue[v] = true;
                                q[qt++ % n] = v;
                            }
                        }
                    }
                }
            }

            public long minCostFlow(List<Edge>[] graph, int s, int t, int maxf) {
                int n = graph.length;
                long[] dist = new long[n];
                int[] curflow = new int[n];
                int[] prevedge = new int[n];
                int[] prevnode = new int[n];

                int flow = 0;
                long flowCost = 0;
                while (flow < maxf) {
                    bellmanFord(graph, s, dist, prevnode, prevedge, curflow);
                    if (dist[t] == Long.MAX_VALUE)
                        break;
                    int df = Math.min(curflow[t], maxf - flow);
                    flow += df;
                    for (int v = t; v != s; v = prevnode[v]) {
                        Edge e = graph[prevnode[v]].get(prevedge[v]);
                        e.f += df;
                        graph[v].get(e.rev).f -= df;
                        flowCost += (long) df * e.cost;
                    }
                }
                if (flow != maxf) throw new RuntimeException();
                return flowCost;
            }
        }
        MinCostMaxFlow mcmf = new MinCostMaxFlow();
        Map<Integer, Integer> indexToFlowIndex = new HashMap<>();
        Map<Integer, Integer> inv = new HashMap<>();
        int index;  // start: 0, end: 1, audience: 2, [p] for position
        int getFlowIndex(int pIndex) {
            if (!indexToFlowIndex.containsKey(pIndex)) {
                indexToFlowIndex.put(pIndex, index++);
                inv.put(index - 1, pIndex);
            }
            return indexToFlowIndex.get(pIndex);
        }

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int n, p, k;
            int[][] players;
            if (1 == 1)
            {
                n = sc.nextInt();
                p = sc.nextInt();
                k = sc.nextInt();
                players = new int[n][p + 2];
                for (int i = 0; i < n; i++) {
                    players[i][p] = sc.nextInt();
                }
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < p; j++) {
                        players[i][j] = sc.nextInt();
                    }
                }
            }
            else
            {
                Random rnd = new Random(10);
                n = 10;
                p = 7;
                k = 3;
                players = new int[n][p + 2];
                for (int i = 0; i < n; i++) {
                    players[i][p] = rnd.nextInt(1000000000) + 1;
//                    System.err.print(players[i][p] + " ");
                }
//                System.err.println();
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < p; j++) {
                        players[i][j] = rnd.nextInt(1000000000) + 1;
//                        System.err.print(players[i][j] + " ");
                    }
//                    System.err.println();
                }
            }
            for (int i = 0; i < n; i++) {
                players[i][p + 1] = i;
            }
            index = 3 + p;
            int N = 3 + p + p * p * 2 + p; // start, end,
            long oriCost = 0;
            Arrays.sort(players, new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    return o2[p] - o1[p];
                }
            });
            int[][] topK = Arrays.copyOf(players, k); // may not have p players!
            int[][] last = Arrays.copyOfRange(players, k, n);
            for (int i = 0; i < k; i++) {
                oriCost += topK[i][p];
            }
            List<Edge>[] graph = createGraph(N);
            for (int i = 0; i < p; i++) {
                int index = getFlowIndex(last[i][p + 1]);
                addEdge(graph, index, 2, 1, -last[i][p]);
            }
            Set<Integer> consideredTopK = new HashSet<>();
            for (int i = 0; i < p; i++) {
                final int fi = i;
                Arrays.sort(topK, new Comparator<int[]>() {
                    @Override
                    public int compare(int[] o1, int[] o2) {
                        int g1 = o1[fi] - o1[p];
                        int g2 = o2[fi] - o2[p];
                        return Integer.compare(g2, g1);
                    }
                });
                for (int j = 0; j < Math.min(p, k); j++) {
                    int index = getFlowIndex(topK[j][p + 1]);
                    if (!consideredTopK.contains(topK[j][p + 1])) {
                        consideredTopK.add(topK[j][p + 1]);
                        oriCost -= topK[j][p];
                        addEdge(graph, index, 2, 1, -topK[j][p]);
                    }
                    addEdge(graph, index, 3 + i, 1, -topK[j][i]);
                }
                Arrays.sort(last, new Comparator<int[]>() {
                    @Override
                    public int compare(int[] o1, int[] o2) {
                        return Integer.compare(o2[fi], o1[fi]);
                    }
                });
                for (int j = 0; j < p; j++) {
                    int index = getFlowIndex(last[j][p + 1]);
                    addEdge(graph, index, 3 + i, 1, -last[j][i]);
                }
            }
            if (index > N) throw new RuntimeException();
            for (int i = 3 + p; i < N; i++) {
                addEdge(graph, 0, i, 1, 0);
            }
            addEdge(graph, 2, 1, consideredTopK.size(), 0);
            for (int i = 3; i < 3 + p; i++) {
                addEdge(graph, i, 1, 1, 0);
            }
            long sol = oriCost - mcmf.minCostFlow(graph, 0, 1, p + consideredTopK.size());
//            if (sol != solve2(n, p, k, players)) {
//                System.err.println(oriCost);
//                System.err.println(sol);
//                System.err.println(solve2(n, p, k, players));
//                throw new RuntimeException();
//            }
            pw.println(sol);
        }
        public long solve2(int n, int p, int k, int[][] as) {
            Arrays.sort(as, new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    return o2[p] - o1[p];
                }
            });
            long[] dp = new long[1 << p];
            Arrays.fill(dp, Long.MIN_VALUE / 2);
            dp[0] = 0;
            for (int i = 0; i < n; i++) {
                long[] next = Arrays.copyOf(dp, dp.length);
                for (int j = 0; j < 1 << p; j++) {
                    for (int l = 0; l < p; l++) if (((1 << l) & j) == 0) {
                        next[j ^ (1 << l)] = Math.max(next[j ^ (1 << l)], dp[j] + as[i][l]);
                    }
                    if (i - Integer.bitCount(j) < k) {
                        next[j] = Math.max(next[j], dp[j] + as[i][p]);
                    }
                }
                dp = next;
            }
            return dp[(1 << p) - 1];
        }
    }

    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("input"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("input"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000);
        System.err.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}