# coding: utf-8 # Your code here! N,M,K=map(int,input().split()) l=[] def saiki(i,money,ans): if i==N: if money==0: print(0) exit() else: return money temp=l[i] for item in temp[::-1]: if money-item>=0: ans=min(saiki(i+1,money-item,ans),ans) else: pass return ans for _ in range(N): l.append(list(map(int,input().split()))) a=(saiki(0,K,10**18)) if a==10**18: print(-1) else: print(a)