10168 - Shooting star   

Description

Given the boundaries, the start point of a shooting object, and the direction of shooting, you have to show the route of the shooting object.

If the object hit the boundary, it would reflect with 45 degree.

You are asked to use 2-D arries to solve this problem.

Input

The first line has three numbers, C, F(5<=C, F<=20) and H(2<=H<=20), 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(1<=S<=H), 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.

The third line has a character 'u' or 'd'. If you get ‘u’, the initial direction of shooting is upper-right in 45 degree. If you get 'd', it means lower-right in 45 degree.

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 route of shooting}) array to print out the result

(for example, the sample output is printed from a 5*10 array)

Remember there is '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss