Problem E
Toys
Little Lark has a great collection of of toys. Although she
has plenty of toys she only likes to play with one at a time.
She decides which toy to play with by placing all the toys in a
circle around her, numbering them
Today Lark wants her father to join her while playing with the toys. Her father has of course a favorite toy among Lark’s selection of toys and would of course like that specific toy to be chosen. At which position should he place his favorite toy to make sure that is the toy they end up playing with?
Input
The input is a single line consisting of
Output
Output a line with the a single integer, the position the
father needs to place his favorite toy for it to be selected.
Lark will start counting at position
Limits
Sample Input 1 | Sample Output 1 |
---|---|
5 2 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
25 18 |
1 |