eolymp
bolt
Try our new interface for solving problems

Snake

Write a program that prints an integer located at line x and column y of matrix n × m that is filled like a snake:

prb2667.gif

Input

Given the integers n, m, x, y (1xn50, 1ym50). Here n is number of matrix lines, m is number of matrix columns, x and y are the numbers of row and column of element to print.

Output

Print the element of line x and column y.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 2 3 1
Output example #1
4