Given a word and a positive integer key, use an encryption method to encrypt it according to the key and shift specified.
Example:
if the word is ''apple" and the value of key is 3 and shift is 2 then the new encrypted word is
Original : a b c d e f g h i j k l m n o p ...
key=3
Cipher : d e f g h i j k l m n ...
apple -> dssoh
Shift 1: hdsso
Shift 2: ohdss
Output: ohdss
INPUT
apple
3
2
OUTPUT:
ohdss
You need to calculate the result of the given equation and write the answer using matches. Tell how many matches are require to write the answer. Equation: ax+bx+c = answer
Input
• The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
• The first and only line of each test case contains four space-separated integers a, b, c and x
Output
• For each case, print only one integer which required matches need to write the answer.
Sample:
Input:
2
1 1 1 3
10 1 1 2
Output:
3
10