N, M, X = map(int, input().split())
ans = -1
arr = []
# 理解度Xを超えるような組み合わせをすべて列挙し、そのうちの最小金額を出力する
for _ in range(N):
    arr.append(list(map(int, input().split())))

for i1 in range(2):
    for i2 in range(2):
        for i3 in range(2):
            for i4 in range(2):
                for i5 in range(2):
                    for i6 in range(2):
                        for i7 in range(2):
                            for i8 in range(2):
                                for i9 in range(2):
                                    for i10 in range(2):
                                        for i11 in range(2):
                                            for i12 in range(2):
                                                tmp_min = 0
                                                tmp_arr = [0] * M
                                                arr_cnt = 0
                                                N_cnt = 0
                                                while N > N_cnt:
                                                    if N_cnt == 0 and bool(i1):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 1 and bool(i2):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 2 and bool(i3):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 3 and bool(i4):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 4 and bool(i5):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 5 and bool(i6):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 6 and bool(i7):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 7 and bool(i8):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 8 and bool(i9):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 9 and bool(i10):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 10 and bool(i11):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    if N_cnt == 11 and bool(i12):
                                                        tmp_min += arr[arr_cnt][0]
                                                        for i in range(M):
                                                            tmp_arr[i] += arr[arr_cnt][
                                                                i + 1
                                                            ]

                                                    arr_cnt += 1
                                                    N_cnt += 1
                                                if min(tmp_arr) >= X:
                                                    if ans == -1:
                                                        ans = tmp_min
                                                    else:
                                                        ans = min(tmp_min, ans)

print(ans)


Measured memory_bytes: 74336