CF1256A.Payment Without Change

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Payment Without Change

You have aa coins of value nn and bb coins of value 11. You always pay in exact change, so you want to know if there exist such xx and yy that if you take xx (0xa0 \le x \le a) coins of value nn and yy (0yb0 \le y \le b) coins of value 11, then the total value of taken coins will be SS.

You have to answer qq independent test cases.

Input

The first line of the input contains one integer qq (1q1041 \le q \le 10^4) — the number of test cases. Then qq test cases follow.

The only line of the test case contains four integers aa, bb, nn and SS (1a,b,n,S1091 \le a, b, n, S \le 10^9) — the number of coins of value nn, the number of coins of value 11, the value nn and the required total value.

Output

For the ii-th test case print the answer on it — YES (without quotes) if there exist such xx and yy that if you take xx coins of value nn and yy coins of value 11, then the total value of taken coins will be SS, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

Samples

4
1 2 3 4
1 2 3 6
5 2 6 27
3 3 5 18
YES
NO
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验