Collecting Apples

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Santi is playing a game with a grid of RR rows (from top to bottom) and CC columns (from left to right). The cell at the iith row and the jjth column is denoted by cell (i,j)(i, j). There are A_i,jA\_{i,j} apples on the (i,j)(i, j) cell.

Santi’s character, Nano, is initially on the (1,1)(1, 1) cell and would like to move to the (R,C)(R, C) cell. On each turn, Nano can only move one cell to the bottom or one cell to the right so that it is closer to the goal. Nano’s path to the goal can be represented as a string containing R+C2R + C - 2 characters, where R1R - 1 of those characters are ‘D’ and C1C - 1 of those characters are ‘R’. This means that Nano moves one cell to the bottom on the iith turn if the iith character is ‘D’ and Nano moves one cell to the right on the iith turn if the iith character is ‘R’.

Two paths are different if the string representation is different. We know that there are (R+C2R1)R+C-2 \choose R-1 different paths. A path XX is better than path YY if either the following is true:

  • Path XX collects more apples than YY. The number of apples that Nano collect in his path is the total number of apples in the cells passed by the path, including the (1,1)(1, 1) cell and the (R,C)(R, C) cell.
  • Path XX collects the same number of apples than YY, and the string representation of XX is lexicographically smaller than the string representation of YY.

Finding the best path is too boring for Santi, so she would like to find the KKth best path instead. In other words, she would like to find a path XX such that there are K1K - 1 paths that are better than XX, and there are (R+C2R1)K{R+C-2 \choose R-1} - K paths that are worse than XX.

For example, let R=2R = 2, C=3C = 3, K=3K = 3, A_1,1..3=1,2,3A\_{1,1..3} = \\{1, 2, 3\\}, and A_2,1..3=2,2,3A\_{2,1..3} = \\{2, 2, 3\\}. Therefore, there are three different paths to the goal, sorted in the decreasing wellness order.

  1. Path represented by string RRD. This path collects 1+2+3+3=91 + 2 + 3 + 3 = 9 apples.
  2. Path represented by string DRR. This path collects 1+2+2+3=81 + 2 + 2 + 3 = 8 apples.
  3. Path represented by string RDR. This path collects 1+2+2+3=81 + 2 + 2 + 3 = 8 apples.

Therefore, the 33rd best path is the path represented by string RDR.

입력

Input begins with a line containing three integers: RR CC KK (2 R,C30;1 K(R+C2R1)2 \le R, C \le 30; 1 \le K \le {R+C-2 \choose R-1}) representing the number of rows, the number of columns, and the index of the path that Santi would like to find, respectively. The next RR lines, each contains CC integers representing the number of apples on each cell. The jjth integer on the iith line is A_i,jA\_{i,j} (0A_i,j2000 \le A\_{i,j} \le 200).

출력

Output in a line a string representing the KKth best path to the goal.