class Solution: def numberOfChild(self, n: int, k: int) -> int: circleback = (n - 1) * 2 k %= circleback if k < n: return k return circleback - k