#K61102. Taco Calendar: First Day of Year Check

    ID: 31235 Type: Default 1000ms 256MiB

Taco Calendar: First Day of Year Check

Taco Calendar: First Day of Year Check

You are given a special calendar system where every year has a different number of days. Normally, a year has D days; however, every P-th year is an event year and has an additional E days (for a total of D+E days).

The first day of year 1 is day 1. For any year i (i ≥ 1), the number of days in that year is given by:

$$\text{days in year } i = \begin{cases} D+E, & \text{if } i \equiv 0 \pmod{P} \\ D, & \text{otherwise} \end{cases} $$

Thus, the first day of year i is:

1+j=1i1days in year j1 + \sum_{j=1}^{i-1} \text{days in year } j

Your task is: given four integers D, E, P, Y, determine whether the Y-th day (counting consecutively from day 1) is the first day of some year in this calendar.

Output YES if Y is the first day of a year, and NO otherwise.

inputFormat

The input is read from standard input and has the following format:

  • The first line contains an integer T, the number of test cases.
  • The next T lines each contain four integers: D, E, P, and Y, separated by spaces.

For each test case, you need to check whether day Y is the first day of a year in the given calendar system.

outputFormat

For each test case, output a single line containing either YES or NO based on whether the given day Y is the first day of a year.

The output should be written to standard output.

## sample
5
3 2 5 21
3 2 5 20
4 1 3 14
1 1 1 1
1 1 1 2
YES

NO YES YES NO

</p>