Many of you have heard the story of Turing's bicycle. The sprocket on the crank had a broken prong, and the chain had one bent link. Whenever the bent link met the broken prong, the chain would fall off, so Turing (being who he was) could predict exactly when it would happen — how many pedal strokes away it was — and hop off just in time to ease the pedals past the bad coupling by hand.
Your job is to compute how many revolutions it takes for this to first happen. You are given the number of prongs on the front sprocket, the number of links on the chain, the starting position of the broken prong and the starting position of the bent link.
The prong at the top of the sprocket is at location 0, the next one forward is location 1, and so on up to prong s - 1. (Prong s - 1 is the next prong to move to the top as Turing pedals.) Link locations are similar: the link at the top of the sprocket is location 0, then forward up to c - 1. The chain falls off exactly when the broken prong and the bent link are both at location 0 at the same time.
Each test case is one line of the form s c p l, where s is the number of prongs on the front sprocket (1 < s < 100), c is the number of links in the chain (200 > c > s), p is the initial position of the broken prong, and l is the initial position of the bent link. The line 0 0 0 0 follows the last test case.
The broken prong and the bent link will never both start at position 0.
For each test case, output a single line. If the chain first fails after r m/s revolutions, print
Case n: r m/s
or, if it can never happen, print
Case n: Never
Here r is the number of whole revolutions of the sprocket and m/s is the remaining fraction of a revolution, so the total is r + m/s revolutions. The denominator of the fraction is always the number of prongs on the sprocket, and the fraction is not necessarily in lowest terms. Always print the values of r and m, even when they are 0.