eolymp
bolt
Try our new interface for solving problems
Problems

Spiral

Spiral

prb85 Numbers from 1 to n2 are written in a square matrix of size n x n in a spiral starting from the top left cell in a clockwise direction, as shown in the figure. Find a number which is located in the i-th row and j-th column.

Input

Three natural numbers n, i, j (1i, jn100).

Output

Print the number that has the coordinates i, j.

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