Universal Cup Judging System

Universal Cup

Time Limit: 1 s Memory Limit: 512 MB Total points: 100
Statistics

This is the easy version of this problem. The only difference between the easy and hard versions is the limit on the number of moves in your solution.

Yuki lives on a grid with $n+1$ rows and $n$ columns. The rows are numbered $1$ to $n+1$ from top to bottom, and the columns are numbered $1$ to $n$ from left to right. Let $(i,j)$ denote the cell at row $i$ and column $j$.

There are $n-1$ obstacles on the grid, and their distribution satisfies the following conditions:

  • There are no obstacles in row $1$ and row $n+1$.

  • For all $2\le i\le n$, there is exactly one obstacle in row $i$.

  • For all $1\le j\le n$, there is at most one obstacle in column $j$.

Initially, Yuki is at $(1,1)$. She has heard that a group of kangaroos lives in row $n+1$, so she wants to go to row $n+1$ to see the scenery.

To achieve her goal, Yuki can perform several moves. In each move, she chooses one of the four directions (up, down, left, right) and moves one cell in that direction. Specifically, if the target cell is outside the grid or contains an obstacle, the move is not executed.

Unfortunately, Yuki only knows the rules for the obstacle distribution, not the specific locations of the obstacles. Therefore, she wants you to help her specify the sequence of moves such that for any valid obstacle distribution, Yuki reaches row $n+1$ at some point (she only needs to have reached row $n+1$ at least once; she does not need to remain there after all moves are completed).

Since Yuki is not in a hurry, the number of moves in your solution must not exceed $30\cdot n$.

Input

A single line contains a positive integer $n$ ($2\le n\le 10^3$).

Output

The first line output an integer $k$ ($1\le k\le30\cdot n$), representing the number of moves in your solution.

The second line output a string $s$ of length $k$, where $s_i$ represents the direction of Yuki’s $i$-th move:

  • If $s_i=\texttt{U}$, Yuki moves up.

  • If $s_i=\texttt{D}$, Yuki moves down.

  • If $s_i=\texttt{L}$, Yuki moves left.

  • If $s_i=\texttt{R}$, Yuki moves right.

Examples

Input 1

2

Output 1

4
DRDD

Input 2

3

Output 2

17
DDDUUURDDDUUURDDD

Note

For the first example:

  • Let gray cells represent obstacles and white cells represent empty cells. The following image shows all possible obstacle distributions satisfying the requirements:
problem_17353_3540e2b0dea0e6bdac38a8284e6a991a.png
  • For the first obstacle distribution, Yuki’s path is $(1,1)\to(1,1)\to(1,2)\to(2,2)\to(3,2)$.

  • For the second obstacle distribution, Yuki’s path is $(1,1)\to(2,1)\to(2,1)\to(3,1)\to(3,1)$.

  • For every valid obstacle distribution, Yuki reaches row $n+1$, so the sample output is correct.

For the second example:

  • Let gray cells represent obstacles and white cells represent empty cells. The following image shows all possible obstacle distributions satisfying the requirements:
problem_17353_4f3a19c4b58ee0b25c1c95d22ab7a444.png
  • It is easy to prove that for any of these obstacle distributions, following the moves given in the sample output, Yuki will reach row $n+1$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.