Tom is a barber in a small town. He owns a little store, several apprentices and good credit for his high quality service. However, as his customers become more and more, he got some problems.
Let's look at the procedure of the haircut at first. Customers are served to change clothes for haircut; after having the hair washed, start the haircut; wash the hair again after that, get the hair dried, change the clothes back and then pay. In Tom's store, he does every haircut, dry work and cash job by himself and leaves the changing clothes and washing hair to his apprentices. Assume each action takes 1 unit time, as shown in Fig. 1.
There are several test cases in the input.
The following lines describe test cases. Each line for one case is given in such format:
(n1, n2, ... nk ) 0 < ni <= 20, 0 < k <= 20
It gives the time when customers come. ni represents the interval time of each sequential customer. The parenthesis means that the customer will come periodically.
For example, assuming the first customer at time 1, if the customers arrive at 1, 3, 5, 7, 9, 11, 13, ... the representation is (2). The representation (1,3,7) represents that the customers will come at time 1, 2, 5, 12, 13, 16, 23, 24, 27, 34...
The example shown in Fig. 5 the description corresponds to the representation (1), and of course more customers will come in time 4, 5, 6, 7...
A line containing "(0)" ends the input.
Your task is to decide whether there is a solution to add FINITE wait units into the haircut procedure to eliminate the collision in the pipeline and enable all the customers to be served as soon as he comes. If it can be solved, print "Yes", otherwise "No", each in one line.
For example, for the input (1), you can add 2 wait units as shown in Fig. 5 above to solve the situation of 3 customers, but when more and more customers come, you can't satisfy everyone except adding more and more wait units. There is not an end. So the answer is "No". For the input (2,3,7), you may add 4 wait units into the procedure to satisfy the pipeline, as explained in Fig. 6. So the answer is "Yes".
(1) (2,3,7) (0)
No Yes