import java.util.*; public class Main { static int[][] costs; static int[][] dp; static int n; static int m; public static void main (String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); int k = sc.nextInt(); costs = new int[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { costs[i][j] = sc.nextInt(); } } dp = new int[n][k + 1]; for (int[] arr : dp) { Arrays.fill(arr, -1); } int ans = dfw(n - 1, k); if (ans >= Integer.MAX_VALUE / 10) { System.out.println(-1); } else { System.out.println(ans); } } static int dfw(int idx, int cost) { if (cost < 0) { return Integer.MAX_VALUE / 10; } if (idx < 0) { return cost; } if (dp[idx][cost] == -1) { int min = Integer.MAX_VALUE / 10; for (int i = 0; i < m; i++) { min = Math.min(min, dfw(idx - 1, cost - costs[idx][i])); } dp[idx][cost] = min; } return dp[idx][cost]; } }