using System;
using System.Linq;
using System.Collections.Generic;

namespace cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var pg = new Program();
            pg.Execute();
            //pg.Test();

        }
        private void Test()
        {

        }

        private void Execute()
        {
            var (N, M, X) = ReadLinesLongList3<int>();

            var input = new List<List<long>>();

            var skilList = new List<long>(M);
            skilList = Enumerable.Repeat((long)1,M).ToList();
            for (int i = 0; i < N; i++)
            {
                input.Add(ReadLinesLongList.ToList());
            }

            var priceSum = new List<int>();

            foreach (var target in BitFullSearch(N))
            {
                var skilExp = Enumerable.Repeat(0, M + 1).ToList();
                for (int i = 0; i < N; i++)
                {
                    if (target[i])
                    {
                        for (int j = 0; j < M + 1; j++)
                        {
                            skilExp[j] += (int)input[i][j];
                        }
                    }
                }
                if(skilExp.Skip(1).All(e => e >= X)){
                    priceSum.Add(skilExp.First());
                }

            }

            OutputResult(priceSum.Any() ? priceSum.Min() : -1);

        }

        public static IEnumerable<bool[]> BitFullSearch(int n)
        {
            if (n <= 0)
            {
                yield return new bool[] { };
                yield break;
            }

            for (int i = 0; i < Math.Pow(2, n); i++)
            {
                var array = new bool[n];
                for (int j = 0; j < n; j++)
                {
                    var targetBit = (i >> j) & 1;
                    if (targetBit == 1) array[j] = true;
                }

                yield return array;
            }
        }

        private void OutputResult<T>(T result)
         where T : struct
        {
            Console.WriteLine(result);
        }

        private void OutputList<TItem, TList>(TList result)
            where TList : IEnumerable<TItem>
        {
            result.ToList().ForEach(e => Console.WriteLine(e));
        }

        static long ReadLineLong => long.Parse(Console.ReadLine());
        static string ReadLineString => Console.ReadLine();
        static IEnumerable<long> ReadLinesLongList => Console.ReadLine().Split(' ').Select(i => long.Parse(i));
        static IEnumerable<string> ReadLinesStringList => Console.ReadLine().Split(' ');

        public static (T, T) ReadLinesLongList2<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T)Convert.ChangeType(input.ElementAt(0), typeof(T)), (T)Convert.ChangeType(input.ElementAt(1), typeof(T)));
        }

        public static (T, T, T) ReadLinesLongList3<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T)Convert.ChangeType(input.ElementAt(0), typeof(T)), (T)Convert.ChangeType(input.ElementAt(1), typeof(T)), (T)Convert.ChangeType(input.ElementAt(2), typeof(T)));
        }

        public static (T, T, T, T) ReadLinesLongList4<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T)Convert.ChangeType(input.ElementAt(0), typeof(T)), (T)Convert.ChangeType(input.ElementAt(1), typeof(T)), (T)Convert.ChangeType(input.ElementAt(2), typeof(T)), (T)Convert.ChangeType(input.ElementAt(3), typeof(T)));
        }

        public static List<long> ReadLineNTimes()
        {
            var input = new List<long>();
            var N = long.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++)
            {
                input.Add(long.Parse(Console.ReadLine()));
            }
            return input;
        }

        public static List<long> ReadLineNTimes(long N)
        {
            var input = new List<long>();
            for (int i = 0; i < N; i++)
            {
                input.Add(long.Parse(Console.ReadLine()));
            }
            return input;
        }

        public static List<string> ReadLineNTimesString()
        {
            var input = new List<string>();
            var N = long.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++)
            {
                input.Add(Console.ReadLine());
            }
            return input;
        }

        private int SolveDynamicProgramming(int n)
        {
            var inputList = new List<int>() { 7, -6, 9 };
            var dpList = new List<int>() { 0 };
            for (int i = 0; i < n; ++i)
            {
                dpList.Add(Math.Max(dpList[i], dpList[i] + inputList[i]));
            }

            return dpList[n];
        }

        private int SolveDynamicProgrammingForKnapsack(int n, int weight, List<int> valueList, List<int> weightList)
        {
            var dpList = new List<List<int>>();

            for (int i = 0; i < n + 1; ++i)
            {
                dpList.Add(Enumerable.Repeat(0, weight + 1).ToList());
            }

            for (int i = 0; i < n; ++i)
            {
                for (int w = 0; w <= weight; ++w)
                {
                    if (w >= weightList[i])
                    {
                        dpList[i + 1][w] = Math.Max(dpList[i][w - weightList[i]] + valueList[i], dpList[i][w]);
                    }
                    else
                    {
                        dpList[i + 1][w] = dpList[i][w];
                    }
                }
            }

            return dpList[n][weight];
        }

        public static int Gcd(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }

    }
}


Measured memory_bytes: 29768