using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        readonly struct Book
        {
            public int Cost { get; }
            public ImmutableArray<int> Scores { get; }

            public Book(int cost, ImmutableArray<int> scores)
            {
                Cost = cost;
                Scores = scores;
            }
        }

        static void Main(string[] args)
        {
            ReadInt(out var n, out var m, out var x);

            Book[] books = new Book[n];
            for (int i = 0; i < books.Length; i++)
            {
                var elem = ReadIntArray();
                books[i] = new Book(elem[0], elem.Skip(1).ToImmutableArray());
            }

            int ans = int.MaxValue;
            for (int bit = 0; bit < (1 << n); bit++)
            {
                int[] scores = new int[m];
                int cost = 0;

                for (int i = 0; i < books.Length; i++)
                {
                    if ((bit & (1 << i)) != 0)
                    {
                        for (int j = 0; j < books[i].Scores.Length; j++)
                        {
                            scores[j] += books[i].Scores[j];
                        }

                        cost += books[i].Cost;
                    }
                }

                if (scores.All(s => s >= x))
                {
                    ans = Min(ans, cost);
                }
            }

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

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static string YesNo(bool condition) => condition ? "Yes" : "No";
        static string YESNO(bool condition) => condition ? "YES" : "NO";

        #endregion
    }
}

Measured memory_bytes: 29356