import numpy as np

from itertools import combinations_with_replacement



N,M,X = list(map(int,input().split()))

CA = []

for i in range(N):

  CA.append(list(map(int,input().split())))



OK = True

CA = np.array(CA)

sums = np.sum(CA,axis=0)

for i in range(1,M+1):

  if sums[i] < X:

    OK = False

    break



if OK == False:

  print((-1))

else:

  # As = []

  # for A in combinations_with_replacement(range(0, N), r=M):

  #   As.append(tuple(set(A)))

  # As = list(map(list, set(As)))

  min_ = sums[0]

  hoge = []

  kouho = list(range(1,N+1))

  for i in combinations_with_replacement(kouho, N):

    hoge.append(list(set(i)))

  hoge = list(map(list, set(map(tuple, hoge))))

  for i in hoge:

    mini_CA = []

    for j in i:

      mini_CA.append(CA[j-1])

    mini_CA = np.array(mini_CA)

    OK2 = True

    sums = np.sum(mini_CA,axis=0)

    for k in range(1,M+1):

      if sums[k] < X:

        OK2 = False

        break

    if OK2 == True and sums[0] < min_:

      min_ = sums[0]

  print(min_)
import numpy as np

from itertools import combinations_with_replacement



N,M,X = list(map(int,input().split()))

CA = []

for i in range(N):

  CA.append(list(map(int,input().split())))



OK = True

CA = np.array(CA)

sums = np.sum(CA,axis=0)

for i in range(1,M+1):

  if sums[i] < X:

    OK = False

    break



if OK == False:

  print((-1))

else:

  As = []

  for A in combinations_with_replacement(list(range(0, N)),N):

    As.append(tuple(set(A)))

  As = list(map(list, set(As)))

  min_ = sums[0]

  for i in As:

    mini_CA = []

    for j in i:

      mini_CA.append(CA[j-1])

    mini_CA = np.array(mini_CA)

    OK2 = True

    sums = np.sum(mini_CA,axis=0)

    for k in range(1,M+1):

      if sums[k] < X:

        OK2 = False

        break

    if OK2 == True and sums[0] < min_:

      min_ = sums[0]

  print(min_)

import numpy as np
from itertools import combinations_with_replacement

N, M, X = list(map(int, input().split()))
CA = []
for i in range(N):
    CA.append(list(map(int, input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA, axis=0)
for i in range(1, M + 1):
    if sums[i] < X:
        OK = False
        break
if OK == False:
    print((-1))
else:
    # As = []
    # for A in combinations_with_replacement(range(0, N), r=M):
    #   As.append(tuple(set(A)))
    # As = list(map(list, set(As)))
    min_ = sums[0]
    hoge = []
    kouho = list(range(1, N + 1))
    for i in combinations_with_replacement(kouho, N):
        hoge.append(list(set(i)))
    hoge = list(map(list, set(map(tuple, hoge))))
    for i in hoge:
        mini_CA = []
        for j in i:
            mini_CA.append(CA[j - 1])
        mini_CA = np.array(mini_CA)
        OK2 = True
        sums = np.sum(mini_CA, axis=0)
        for k in range(1, M + 1):
            if sums[k] < X:
                OK2 = False
                break
        if OK2 == True and sums[0] < min_:
            min_ = sums[0]
    print(min_)

import numpy as np
from itertools import combinations_with_replacement

N, M, X = list(map(int, input().split()))
CA = []
for i in range(N):
    CA.append(list(map(int, input().split())))
OK = True
CA = np.array(CA)
sums = np.sum(CA, axis=0)
for i in range(1, M + 1):
    if sums[i] < X:
        OK = False
        break
if OK == False:
    print((-1))
else:
    As = []
    for A in combinations_with_replacement(list(range(0, N)), N):
        As.append(tuple(set(A)))
    As = list(map(list, set(As)))
    min_ = sums[0]
    for i in As:
        mini_CA = []
        for j in i:
            mini_CA.append(CA[j - 1])
        mini_CA = np.array(mini_CA)
        OK2 = True
        sums = np.sum(mini_CA, axis=0)
        for k in range(1, M + 1):
            if sums[k] < X:
                OK2 = False
                break
        if OK2 == True and sums[0] < min_:
            min_ = sums[0]
    print(min_)

-    # As = [] -    # for A in combinations_with_replacement(range(0, N), r=M): -    #   As.append(tuple(set(A))) -    # As = list(map(list, set(As))) +    As = [] +    for A in combinations_with_replacement(list(range(0, N)), N): +        As.append(tuple(set(A))) +    As = list(map(list, set(As))) -    hoge = [] -    kouho = list(range(1, N + 1)) -    for i in combinations_with_replacement(kouho, N): -        hoge.append(list(set(i))) -    hoge = list(map(list, set(map(tuple, hoge)))) -    for i in hoge: +    for i in As: