The input consists of multiple instances. Each instance is a line of three numbers a, b, c, separated by a space. a is the size of the beehive, b is a cell number, and c is the number of cells away. The input ends if all numbers are zero. There will be no more than 100 instances, and the size of beehive is between 2 and 50 inclusive.