Costin is the dictator of Costinland, a country located on a very small island in the middle of Pacific Ocean. One day, Costin started feeling depressed because his island was very small. In order to stop his own depression, he decided to conquer other countries, so that the territory of Costinland and his influence as a dictator will be even bigger! In order to do that, he needs an army! But no citizen of Costinland fits the dictator’s requirements… So what army would be better than an army of Costins? Thus, being the smartest person living in Costinland, he invented cloning on a Saturday evening. Being a very playful person (the most playful person in Costinland), he wanted to play with his clones while creating them.
For that, Costin chose a piece of land consisting of cells. There are types of cells: X
(if a Costin steps on this cell, he clones himself; one of the Costins goes right and the other one goes down), r
(if a Costin steps on this cell, he will go right, regardless of his initial direction), d
(if a Costin steps on this cell, he will go down, regardless of his initial direction), .
(if a Costin steps on this cell, he will not change his initial direction and will move to the next cell indicated by his direction).
Costin leaves from and wants to reach , along with all of the created clones. Costin is also very lazy (the laziest person in Costinland), so he asks you “nicely” to help him build such a matrix, such that exactly clones will reach . Clones cannot be “lost” on their way (read the constraints carefully).
Task
Given , help Costin generate such a (small) matrix that will bring to exactly Costins.
Input data
The first line contains one integer: .
Output data
The first line will contain to integers: (the size of the matrix). The following lines will contain characters, describing the matrix.
Restrictions
- The character situated on must be different from
.
, in order to give a direction to the first Costin. (It can beX
,d
orr
) - None of the Costins stops until he reaches .
- In order not to waste Costins or to lose them somehow during their path, the last line of the matrix will consist only of
r
and the last column will consist only ofd
. By exception, the character situated on will be.
(There is no need to give the Costins a direction since they reached their destination) - In order to get points, you need to generate a matrix with both of its sides smaller than or equal to , for the first subtask, and one with both of its sides smaller than or equal to , for the second subtask (more details below in the SCORING section).
Subtask | Score | Restrictions |
---|---|---|
1 | 20 points | |
2 | Another 80 points |
Scoring
Let be the contestant’s matrix size.
Subtask 1:
- If , you will receive of the points on that test case.
- If , you will receive of the points on that test case.
- If max{C,D}, you will receive of the points on that test case.
- If , you will receive of the points on that test case.
Subtask 2:
- If , you will receive of the points on that test case.
- If , you will receive of the points on that test case.
- If , you will receive of the points on that test case.
- If , you will receive of the points on that test case.
- If , you will receive of the points on that test case.
Compiler messages
- "The output does not fit the requirements": You will get this message if your matrix does not respect the constraints or the output data.
- "Matrix size too big": You will get this message if .
- "The matrix does not generate the required number of Costins": You will get this message if, in the end, there won’t be exactly Costins in ).
- If you don’t get any of these messages, you will receive a score according to the formulas from above and a message which specifies the size of your generated matrix for that test case.
Example
stdin
11
stdout
4 4
XXXd
.XXd
.XXd
rrr.