Consider integer numbers from 0 to n - 1 written down along the circle in such a way that the distance between any two neighbouring numbers is equal (note that 0 and n - 1 are neighbouring, too).
Given n
and firstNumber
/first_number
, find the number which is written in the radially opposite position to firstNumber.
For n = 10 and firstNumber = 2, the output should be
CircleOfNumbers.circleOfNumbers(n, firstNumber) == 7
-
[input]
integern
A positive even integer.
Constraints: 4 ? n ? 1000.
-
[input]
integerfirstNumber
/first_number
Constraints: 0 ? firstNumber ? n - 1
-
[output]
an integer