Prob Nim

Sample Input

Sample Output