You must make a circular tour of a set of cities. The cities are numbered 1, 2, 3, and so on. The numbering fixes the direction of travel: from city 1 you go to city 2, from city 2 to city 3, and so on, and from the highest-numbered city you return to city 1. You may begin the tour at any city, visit every city exactly once, and finish back where you started.
Each city has a refueling station that holds a fixed amount of fuel. The total fuel across all stations exactly equals the total fuel needed to complete the whole loop. You start with an empty tank at your chosen station, and when you pull back into that station after finishing the loop your tank is exactly empty. Assume the tank is large enough to hold any amount of fuel.
Determine every city that can serve as a starting point so that you never run out of fuel before returning to it.
The input contains several test cases. Each test case is given on three lines:
All fuel amounts are positive integers (in imperial gallons). The sum of the fuel supplies fits in a signed 32-bit integer. Every test case has at least 2 and at most 100000 cities. A line containing a single 0 for the number of cities marks the end of the input and is not processed.
For each test case, print exactly one line. Start the line with Case k:, where k is the test-case number counting from 1, and then list every city that works as a starting point, in increasing order, separated by single spaces. The mathematician L. Lovász proved that at least one valid starting city always exists.