import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int N = in.i();
        int M = in.i();
        int X = in.i();
        int[][] A = new int[N][];
        for (int i = 0; i < N; i++) {
            A[i] = in.ii(M + 1);
        }
        int TOTAL = 1 << N;
        int[] a = new int[M];
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < TOTAL; i++) {
            for (int j = 0; j < a.length; j++) {
                a[j] = 0;
            }
            int t = 0;
            for (int j = 0; j < A.length; j++) {
                boolean flag = (i >> j & 1) == 1;
                if (flag) {
                    for (int h = 0; h < a.length; h++) {
                        a[h] += A[j][h + 1];
                    }
                    t += A[j][0];
                }
            }
            boolean possible = true;
            for (int j = 0; j < a.length; j++) {
                if (a[j] < X) {
                    possible = false;
                    break;
                }
            }
            if (possible && t < ans) {
                ans = t;
            }
        }
        if (ans == Integer.MAX_VALUE) {
            ans = -1;
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
}


Measured memory_bytes: 33524