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

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver2();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var N = items[0];
            var M = items[1];
            var X = items[2];
            var books = Enumerable.Range(0, N).Select(i => Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList()).ToList();

            var answer = int.MaxValue;
            foreach (var bit in Enumerable.Range(0, 1 << N))
            {
                var totalPrice = 0;
                var algoSums = Enumerable.Range(0, M).Select(elem => 0).ToArray();
                var chooseBooks = books.Where((elem, idx) => ((bit & (1 << idx)) != 0)).ToList();
                chooseBooks.ForEach(book =>
                {
                    totalPrice += book[0];
                    algoSums = algoSums.Zip(book.Where((elem, idx) => idx >= 1), (s, c) => s + c).ToArray();
                });

                if (algoSums.All(elem => elem >= X))
                {
                    answer = Math.Min(answer, totalPrice);
                }
            }

            Console.WriteLine(answer == int.MaxValue ? -1 : answer);
        }
    }

    class Solver2
    {
        public int N { get; set; }
        public int M { get; set; }
        public int X { get; set; }
        public List<List<int>> Books { get; set; }
        public int Answer { get; set; }

        private void dfs(int i, List<int> sum)
        {
            if (i == this.N)
            {
                if (sum.Where((elem, idx) => idx >= 1).All(elem => elem >= this.X))
                {
                    this.Answer = Math.Min(this.Answer, sum[0]);
                }
            }
            else
            {
                var book = this.Books[i];
                this.dfs(i + 1, sum.Zip(book, (s, b) => s + b).ToList());
                this.dfs(i + 1, sum);
            }
        }

        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            this.N = items[0];
            this.M = items[1];
            this.X = items[2];
            this.Books = Enumerable.Range(0, N).Select(i => Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList()).ToList();
            this.Answer = int.MaxValue;

            this.dfs(0, Enumerable.Range(0, M + 1).Select(elem => 0).ToList());
            Console.WriteLine(this.Answer == int.MaxValue ? -1 : this.Answer);
        }
    }

    class Solver3
    {
        public int N { get; set; }
        public int M { get; set; }
        public int X { get; set; }
        public List<List<int>> Books { get; set; }
        public int Answer { get; set; }
 
        private void dfs(int currentIndex, List<int> algoSum)
        {
            if (Enumerable.Range(1, this.M).All(i => algoSum[i] >= this.X))
            {
                // 達成
                this.Answer = Math.Min(this.Answer, algoSum[0]);
            }
            else if (currentIndex >= this.N - 1)
            {
                // 未達成で次の本無し
            }
            else
            {
                // 未達成で次の本有り
                var next = currentIndex + 1;
                foreach (var i in Enumerable.Range(next, N - next))
                {
                    var book = this.Books[i];
 
                    // (currentIndex + 1)～N冊目を読む
                    foreach (var elem in Enumerable.Range(0, this.M + 1))
                    {
                        algoSum[elem] += book[elem];
                    }
 
                    this.dfs(i, algoSum);
 
                    foreach (var elem in Enumerable.Range(0, this.M + 1))
                    {
                        algoSum[elem] -= book[elem];
                    }
                }
            }
        }
 
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            this.N = items[0];
            this.M = items[1];
            this.X = items[2];
            this.Books = Enumerable.Range(0, N).Select(i => Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList()).ToList();
            this.Answer = int.MaxValue;
            this.dfs(-1, Enumerable.Range(0, M + 1).Select(elem => 0).ToList());
 
            Console.WriteLine(this.Answer == int.MaxValue ? -1 : this.Answer);
        }
    }
}


Measured memory_bytes: 30824