using System.Collections.Generic;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System;

    namespace cysharp_test
    {
        class Program
        {
            static void Main (string[] args)
            {
                new Program ().solve ();
            }

            void solve ()
            {
                int[] nmx = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();
                //zentansaku?????
                N = nmx[0];
                M = nmx[1];
                X = nmx[2];

                costs = new int[N];
                levels = new int[N][];
                for (int i = 0; i < N; i++) levels[i] = new int[M];

                for (int i = 0; i < N; i++)
                {
                    var input = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();
                    costs[i] = input[0];
                    for (int j = 0; j < M; j++) levels[i][j] = input[j + 1];
                }
                search (0, new int[M], 0);
                if (scores.Count > 0) Console.WriteLine (scores.Min ());
                else Console.WriteLine ("-1");
                Console.ReadKey ();
            }

            void search (int nextC, int[] level, int cost)
            {
                if (nextC >= N)
                {
                    if (level.Count (v => v < X) == 0)
                    {
                        scores.Add (cost);
                    }
                }
                else
                {
                    search (nextC + 1, level, cost);
                var newlevel = new int[M];
                for (int i = 0; i < M; i++) newlevel[i] = level[i] + levels[nextC][i];
                    search (nextC + 1, newlevel, cost + costs[nextC]);
                }
            }
            List<int> scores = new List<int> ();
            int N, M, X;
            int[] costs;
            int[][] levels;

        }
        struct Vector2
        {
            public Vector2 (long x, long y)
            {
                this.x = x;
                this.y = y;
            }

            public long x, y;

            public static Vector2 operator + (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x + b.x, a.y + b.y);
            }

            public static Vector2 operator - (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x - b.x, a.y - b.y);
            }

            public static Vector2 operator * (Vector2 a, long scala)
            {
                return new Vector2 (a.x * scala, a.y + scala);
            }

            public static bool operator == (Vector2 a, Vector2 b)
            {
                return (a.x == b.x) && (a.y == b.y);
            }

            public static bool operator != (Vector2 a, Vector2 b)
            {
                return !(a.x == b.x) && (a.y == b.y);
            }

            public override int GetHashCode ()
            {
                return (int) (x + y);
            }

            public override bool Equals (object obj)
            {
                if (!(obj == null) && obj is Vector2)
                {
                    return (this == (Vector2) obj);
                }
                else return false;
            }

            public override string ToString ()
            {
                return ("(" + x + "," + y + ")");
            }
        }
    }

Measured memory_bytes: 20056