12083 - CS_2018_MID2-4   

Description

You want to stimulate shooting route in a room. You know the boundary of room, the start point of a shooting object, and the direction of shooting. When the object hitting the boundary, it would reflect with 45 degrees. Your mission is to show the route of the shooting object.

 

Input

The first line has three numbers, CF and H, which respectively means the length of the ceiling, the length of the floor, and the height between the ceilings and floors.

The second line has a number S, which means the start point of shooting object. It's noted that the location below the ceiling is 1, and the location below that is 2, and so on.

  • 1 ≤ C, F ≤ 20
  • 2 ≤ H ≤ 20
  • 1 ≤ S ≤ H

The third line has a character 'u' or 'd'. It  corresponds to the initial direction of shooting.

  • u: upper-right in 45 degree
  • d: lower-right in 45 degree

There are only one case for each testcase

Output

Draw the map and the route of the shooting object.
The route of shooting object is marked as '*', which appears until the object is out of boundaries.

You need to use a (H+2)*(max{C, F, the horizontal length of the route of shooting}) array to print out the result

Remember there is '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss