Problem Statement:
A Compiler Mystery: We are given a for loop of type:


for (variable = A; variable != B; variable += C)
         statement;


I.e., a loop which starts by setting variable to value A, and while variable is not equal to B repeats statement followed by increasing the variable by C. We want to know how many times does the statement get executed for particular values of A, B and C assuming that all arithmetic is calculated in a k - bit unsigned integer type (i.e. with values (0 ≤ X < 2K) modulo 2K.


Input Format:
The input will start with an integer T which is the number of test cases where (1 ≤ T ≤ 1, 000). Each test cases is described by a single line with four integers A, B, C, K separated by a single space where K is the number of bits of the control variable of the loop (1 ≤ K ≤ 32), and A, B,  and C (0 ≤ A, B, C < 2K) are the parameters of the loop.


Output Format:
For each test case you should output "Case X: Y" where X is the case number and Y is the number of iterations of the for statement or "Case X: FOREVER" if the loop doesn't terminate.


Sample Input:
4 3 5 0 16 3 3 0 32 6 2 2 4 0 3 2 2


Sample Output:
Case 1: FOREVER Case 2: 0 Case 3: 6 Case 4: FOREVER





Added by: hossamyosef
Added at: 2014-11-11 15:32:29 UTC
Time Limit: 2 seconds
Partial score: No
Source:ACM Jordanian Collegiate Programming Contest 2014