A sequence is an arithmetic sequence if every two successive number has same difference. Suppose this is a sequence of numbers:
, , , …,
This is an arithmetic sequence if is same for each i from 1 to .
You are given first 3 terms of a sequence and the value of . If it is an arithmetic sequence you must print the -th term. Otherwise you must print “Error”.
In the first line there will be an integer () denoting number of test cases. Each of the case will contain 4 integers , , () and ().
In each line specify the case number and print the answer.
Input | Output |
---|---|
3 1 2 3 10 1 4 3 10 15 30 45 5 | Case 1: 10 Case 2: Error Case 3: 75 |