Spiral
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Numbers from 1 to n^2
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 (1 ≤ i, j ≤ n ≤ 100).
Output
Print the number that has the coordinates i, j.
Examples
Input #1
Answer #1
Submissions 6K
Acceptance rate 52%