public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder out = new StringBuilder();
		while (in.hasNext()) {
			n = in.nextInt();
			x = in.nextInt();
			t = in.nextInt();
			k = in.nextInt();
			if (n + x + t + k == 0)
				break;
			n++; // Me
			f = new int[k];
			c = new int[k];
			for (int i = 0; i < k; i++) {
				c[i] = in.nextInt();
				for (int j = 1; j <= n; j++)
					f[i] += in.nextInt();
			}
			dp = new int[n * x + 1][k][n * 2 + 1];
			for (int i = 0; i <= n * x; i++)
				for (int j = 0; j < k; j++)
					Arrays.fill(dp[i][j], -1);
			int best = solve(n * (x - t), 0, 0);
			out.append(String.format(Locale.US, "%.2f\n", (best * 1.0) / n));
		}
		System.out.print(out);
	}