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

namespace Atcoder
{
    public static class Program
    {
        public static List<string> input;
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            string result = null;
            List<List<long>> sankoushoList = new List<List<long>>();

            input = ReadTexts();
            int sankoushocnt = input[0].ToInt();
            int algorithmcnt = input[1].ToInt();
            int target = input[2].ToInt();

            for (int i = 0; i < sankoushocnt; i++)
            {
                input = ReadTexts();
                var a = new List<long>();

                for (int j = 0; j < algorithmcnt + 1; j++)
                {
                    a.Add(input[j].ToLong());
                }

                sankoushoList.Add(a);
            }

            var test = new List<List<List<long>>>();
            for (int i = 1; i < sankoushocnt + 1; i++)
            {
                foreach (var item in Combination.Enumerate<List<long>>(sankoushoList, i, false))
                {
                    test.Add(item);
                }
            }

            var ok = new List<List<List<long>>>();
            foreach (var item in test)
            {
                bool flg = true;
                for (int i = 0; i < algorithmcnt; i++)
                {
                    if (target > item.Sum(x => x[i+1]))
                    {
                        flg = false;
                        break;
                    }
                }
                if (flg)
                {
                    ok.Add(item);
                }
            }

            if (!ok.Any())
            {
                return -1;
            }

            return ok.Min(x => x.Sum(y => y[0]));
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }

        #endregion
    }

    public static class CastExtention
    {
        public static long ToLong(this string a) { return long.Parse(a); }
        public static int ToInt(this string a) { return int.Parse(a); }
    }

    public static class Combination
    {
        public static IEnumerable<List<T>> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition)
        {
            if (k == 1)
            {
                foreach (var item in items)
                    yield return new List<T> { item };
                yield break;
            }
            foreach (var item in items)
            {
                var leftside = new List<T> { item };

                // item よりも前のものを除く （順列と組み合わせの違い)
                // 重複を許さないので、unusedから item そのものも取り除く
                var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

                foreach (var rightside in Enumerate(unused, k - 1, withRepetition))
                {
                    yield return leftside.Concat(rightside).ToList();
                }
            }
        }
    }
}



Measured memory_bytes: 41448