In a two-dimensional raster graphic image, each small square element is called a pixel. Each pixel is assigned a color, which is represented by a specific number.
Suppose we have an image with width and height pixels. Number the rows of pixels from bottom to top, from to , and within each row, number the pixels from left to right, from to . Thus, a pixel at coordinates is the -th pixel in the -th row.
When saving the image to a file, it is common to store the colors of all pixels in the first row from left to right, then in the second row, and so on. The first number in the file is the color of the pixel at coordinates , and the last number is at (W, H).
For large images, sometimes it is necessary to work with only a part of the image on the screen. Therefore, it is important to be able to determine where in the file to find the information for a given pixel.
Write a program that, given the coordinates of a pixel, finds the position in the file where its color is stored, or, given the position in the file, finds the corresponding pixel's coordinates.
The first line contains two integers and representing the width and height of the image (1 \leq W, H \leq 10000). The second line contains one integer indicating the query type ( — from coordinates to position, — from position to coordinates). The third line contains:
if d = 1, two integers and (1 \leq x \leq W, 1 \leq y \leq H) — the coordinates of the pixel;
if d = 2, one integer (1 \leq n \leq WH) — the position in the file.
If d = 1, output one integer — the position in the file, where the color of the pixel is stored. If d = 2, output two integers and — the coordinates of the corresponding pixel.
Example 1