Dice
시간 제한2초메모리 제한1024 MB
주어진 굴림마다 n개의 f면체 주사위를 굴려 나온 눈의 합에 m을 더해 보고된 합을 만들 수 있는지 판정한다.
문제
Khodislav is playing a tabletop role-playing game. He has finally chosen his weapons to deal with a monster and casts the crushing strike. To do this, he rolls dice, calculates the sum of numbers on their faces, and says it aloud to the game master.
Rolling a group of identical dice is characterized by three numbers , , and , where is the number of the dice, is the number of faces on each die, and is the modifier. The faces carry all numbers from through , and each and any face can be rolled; all rolls are independent. For instance, if , , , to define the sum, the player must roll three eight-faced dice, sum up the results, and add five: this is usually written as .
The game master wants to check if Khodislav could get the sum he has reported after rolling the dice.
입력
The first line of the input file contains a single integer --- the number of strikes () cast by Khodislav. The following lines describe the strikes, one per line. First comes an integer --- the sum reported by Khodislav. It is followed by three integers: , and describing the group of dice (, , , ).
출력
For each strike in a separate line, in the same order as in the input file, print YES, if the sum was achievable, and NO otherwise.