The input consists of a number of cases. The first line of each case gives three integers M, N, and the modulus m (0 < M, N <= 1000, 0 < m <= 1000000000). The next M lines contain N characters each and specify the map. A '.' indicates that the robot can move into that grid point, and a '*' indicates a hazard. The final line gives four integers r1, c1, r2, c2 followed by a character d. The coordinates (r1, c1) specify the initial position of the robot, and (r2, c2) specify the destination. The character d is one of 'N', 'S', 'W', 'E' indicating the initial direction of the robot. It is assumed that the initial position and the destination are not hazards. The input is terminated when m = 0.