#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## 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 *A _{i,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-2}C_{N-1} of them), and records all of the scores onto a piece of paper. He wants to find out what is the *K*th 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 *K*th largest value of a path.

## Limits

1 ≤ K ≤ ^{N+M-2}C_{N-1}, 0 ≤ A_{i,j} ≤ 10^{9}.

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

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 15 | 22 | 1s | 256MB | Minimum |

2 | 24 | 20 | 1s | 256MB | Minimum |

3 | 23 | 41 | 1s | 256MB | Minimum |

4 | 27 | 62 | 1s | 256MB | Minimum |

5 | 11 | 102 | 1s | 256MB | Minimum |

6 | 0 | 2 | 1s | 256MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o morepaths -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512