import numpy as np



_,*_t=[list(map(int,i.split())) for i in open(0)]

n=_[0]

m=_[1]

x=_[2]

table=np.array(_t)

value=9000000





def boolAchieve(nums):

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

    if nums[i]<x:

      return False

  return True





tmp=np.sum(table,axis=0)

if not boolAchieve(tmp):

  print((-1))

  exit()





for i in range(1,2 ** n):

  #numpyで書いてみた

  slist=np.right_shift(i,np.arange(n))

  blist=np.bitwise_and(slist,1).tolist()

  selects=list(map(bool,blist))

  #元のコード

  #selects=[bool((i >> j) & 1) for j in range(n)]



  picks=np.sum(table[selects,:],axis=0)

  if not boolAchieve(picks):

    continue

  value=min(value,picks[0])



  

print(value)
import itertools

import numpy as np



_,*_t=[list(map(int,i.split())) for i in open(0)]

n=_[0]

m=_[1]

x=_[2]

table=np.array(_t)

patterns=list(itertools.product([False,True], repeat=n))

value=9000000





def boolAchieve(nums):

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

    if nums[i]<x:

      return False

  return True





tmp=np.sum(table,axis=0)

if not boolAchieve(tmp):

  print((-1))

  exit()





for i in range(1,2 ** n):

  selects=patterns[i]

  picks=np.sum(table[selects,:],axis=0)

  if not boolAchieve(picks):

    continue

  value=min(value,picks[0])



  

print(value)
import numpy as np

_, *_t = [list(map(int, i.split())) for i in open(0)]
n = _[0]
m = _[1]
x = _[2]
table = np.array(_t)
value = 9000000


def boolAchieve(nums):
    for i in range(1, m + 1):
        if nums[i] < x:
            return False
    return True


tmp = np.sum(table, axis=0)
if not boolAchieve(tmp):
    print((-1))
    exit()
for i in range(1, 2**n):
    # numpyで書いてみた
    slist = np.right_shift(i, np.arange(n))
    blist = np.bitwise_and(slist, 1).tolist()
    selects = list(map(bool, blist))
    # 元のコード
    # selects=[bool((i >> j) & 1) for j in range(n)]
    picks = np.sum(table[selects, :], axis=0)
    if not boolAchieve(picks):
        continue
    value = min(value, picks[0])
print(value)

import itertools
import numpy as np

_, *_t = [list(map(int, i.split())) for i in open(0)]
n = _[0]
m = _[1]
x = _[2]
table = np.array(_t)
patterns = list(itertools.product([False, True], repeat=n))
value = 9000000


def boolAchieve(nums):
    for i in range(1, m + 1):
        if nums[i] < x:
            return False
    return True


tmp = np.sum(table, axis=0)
if not boolAchieve(tmp):
    print((-1))
    exit()
for i in range(1, 2**n):
    selects = patterns[i]
    picks = np.sum(table[selects, :], axis=0)
    if not boolAchieve(picks):
        continue
    value = min(value, picks[0])
print(value)

+import itertools +patterns = list(itertools.product([False, True], repeat=n)) -    # numpyで書いてみた -    slist = np.right_shift(i, np.arange(n)) -    blist = np.bitwise_and(slist, 1).tolist() -    selects = list(map(bool, blist)) -    # 元のコード -    # selects=[bool((i >> j) & 1) for j in range(n)] +    selects = patterns[i]