Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 300300 points
Problem Statement
Takahashi is standing at the coordinate 00 on a number line.
He will now perform NN jumps. In the ii-th jump (1 \leq i \leq N)(1≤i≤N), he moves a_iai or b_ibi in the positive direction.
Is it possible for him to be at the coordinate XX after NN jumps?
Constraints
-
1 \leq N \leq 1001≤N≤100
-
1 \leq a_i \lt b_i \leq 100 \, (1 \leq i \leq N)1≤ai<bi≤100(1≤i≤N)
-
1 \leq X \leq 100001≤X≤10000
-
All values in input are integers.
Input
Input is given from Standard Input in the following format:
NNXXa_1a1b_1b1\vdots⋮a_NaNb_NbN
Output
If it is possible for Takahashi to be at the coordinate XX after NN jumps, print Yes; otherwise, print No.