Problem2410--ABC265B-Explore

2410: ABC265B-Explore

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Problem Statement

Takahashi is exploring a cave in a video game.
The cave consists of NN rooms arranged in a row. The rooms are numbered Room 1,2,\ldots,N1,2,,N from the entrance.
Takahashi is initially in Room 11, and the time limit is TT.
For each 1 \leq i \leq N-11iN1, he may consume a time of A_iAi to move from Room ii to Room (i+1)(i+1). There is no other way to move between rooms. He cannot make a move that makes the time limit 00 or less.
There are MM bonus rooms in the cave. The ii-th bonus room is Room X_iXi; when he arrives at the room, the time limit increases by Y_iYi.
Can Takahashi reach Room NN?

Constraints

  • 2 \leq N \leq 10^52N105
  • 0 \leq M \leq N-20MN2
  • 1 \leq T \leq 10^91T109
  • 1 \leq A_i \leq 10^91Ai109
  • 1 < X_1 < \ldots < X_M < N1<X1<<XM<N
  • 1 \leq Y_i \leq 10^91Yi109
  • All values in input are integers.

Input

Input

Input is given from Standard Input in the following format:

NNMMTTA_1A1A_2A2\ldotsA_{N-1}AN1X_1X1Y_1Y1X_2X2Y_2Y2\vdotsX_MXMY_MYM

Output

Output

If Takahashi can reach Room NN, print Yes; otherwise, print No.

Sample Input Copy

4 1 10
5 7 5
2 10

Sample Output Copy

Yes

HINT

  • Takahashi is initially in Room 11, and the time limit is 1010.
  • He consumes a time of 55 to move to Room 22. Now the time limit is 55. Then, the time limit increases by 1010; it is now 1515.
  • He consumes a time of 77 to move to Room 33. Now the time limit is 88.
  • He consumes a time of 55 to move to Room 44. Now the time limit is 33.

Source/Category