#465. Number Game

Number Game

【题目描述】

There are three integers A,BA,B and CC written on the blackboard.

You can perform the following two operations as many times as you like:

  1. Change BB to ABA−B .
  2. Change CC to BCB−C.

Please note that each time you don't need to perform all two operations. You can choose one type of operation to perform.

You are given an integer xx. Answer whether you can change CC into xx using these operations.

You need to answer TT queries independently.

【输入】

image

【输出】

For each test case, output "Yes" if C can become x, and "No" otherwise (without quotes).

【输入样例】

3 
2 4 3 1 
2 4 3 2 
4 2 2 0

【输出样例】

Yes
No
Yes

【说明】

Please note that A,B,C,xA,B,C,x could be negative.