In our Jesephus game, we start with n people numbered 1 to n around a circle, and we eliminated every k remaining person until only one survives. For example, here's the starting configuration for n = 10, k = 2, The elimination order is 2, 4, 6, 8, 10, 3, 7, 1, 9. So 5 survives.The problem: determine the survivor's number , J(n, k).
输入解释
There are multiple cases, end with EOF each case have two integer, n, k. (1<= n <= 10^12, 1 <= k <= 1000)