Problem Description
Rar the Cat is solving a weird puzzle. He has a grid of N by M squares, each square (i, j) containing an integer Ai,j.
He starts off on the square on the top-left hand corner, and needs to get to the square at the bottom-right corner, by only moving either down or right at each step. He sums up the integers on all the squares he has been on, and that is deemed as the "score" of that path.
He traverses through all possible paths (there are N+M-2CN-1 of them), and records all of the scores onto a piece of paper. He wants to find out what is the Kth largest number on the piece of paper.
Input
The first line of input contains three integers, N, M and K.
The next N lines of input contain M integers each, describing the grid.
Output
The output should contain one integer, the Kth largest value of a path.
Limits
1 ≤ K ≤ N+M-2CN-1, 0 ≤ Ai,j ≤ 109.
Subtask 1 (15%): 1 ≤ N, M ≤ 10, 1 ≤ K ≤ 1000.
Subtask 2 (24%): 1 ≤ N, M ≤ 200, K = 1.
Subtask 3 (23%): 1 ≤ N, M ≤ 200, 1 ≤ K ≤ 2.
Subtask 4 (27%): 1 ≤ N, M, K ≤ 200.
Subtask 5 (11%): 1 ≤ N, M ≤ 500. 1 ≤ K ≤ 1000.
Subtask 6 (0%): Sample Testcases
Sample Testcase 1
Input
2 2 2
1 2
3 4
Output
7
Sample Testcase 2
Input
3 5 10
3 4 1 5 1
2 3 0 1 3
3 4 1 1 9
Output
21