404697: GYM101611 H Hilarious Cooking
Description
All laws of physics appearing in this problem statement are fictitious. Any resemblance to the real world is purely coincidental.
To discuss problem proposals and select a proper problemset for an upcoming competition jury team has gathered at a magnificent palace in Moscow suburbs (typically called dacha). Chief judge is now struggling to prepare a roast beef barbecue using a recipe he just found in the Internet.
According to recipe a roast beef should be cooked for exactly n seconds. The total amount of heat received by beef should be equal to T. Formally, if we denote the temperature inside the barbecue during the i-th second as ti, the sum t1 + t2 + ... + tn should be equal to T. Moreover, there are m additional instructions, the i-th of them states that in order to achieve the perfect result the temperature inside the barbecue during the ai-th second should be equal to bi, i.e. tai should be bi.
However, the task is complicated by the fact that the barbecue that chief judge is using this time has some restrictions. First of all, the barbecue only allows ti to take non-negative integer values. Second, ti can't change too fast, i.e. the condition |ti - ti + 1| ≤ 1 should be satisfied for all i from 1 to n - 1.
There are no other restrictions, in particular it is allowed to start and finish with any temperature, i.e. the values t1 and tn can be arbitrary non-negative integers, unless the opposite is directly specified in the recipe. Your goal is to help chief judge and determine whether his task is even possible, or he should look for another recipe.
InputThe first line of the input contains three integers T, n and m (1 ≤ T ≤ 1018, 1 ≤ n ≤ 2·109, 1 ≤ m ≤ 100 000) — the total amount of heat that beef should receive, the exact number of seconds it should be cooked for, and the number of instructions in the recipe.
The next m lines contain the instructions in chronological order. The i-th instruction is defined by two integers ai and bi (1 ≤ ai ≤ n, 0 ≤ bi ≤ 109) stating that the temperature inside the barbecue should be equal to bi during the second ai. It is guaranteed that a1 < a2 < ... < am.
OutputIf there exists a sequence of non-negative t1, t2, ..., tn such that , |ti - ti + 1| ≤ 1 for all 1 ≤ i ≤ n - 1, and tai = bi for all i from 1 to m, print "Yes" (without quotes) in the only line of the output. Otherwise, print "No" (without quotes).
ExamplesInput3 3 1Output
2 1
YesInput
10 3 1Output
1 1
NoInput
13 5 2Output
2 2
4 2
YesNote
In the first sample, a possible solution is t1 = t2 = t3 = 1. In the third sample, a possible solution is t1 = 3, t2 = 2, t3 = 3, t4 = 2, t5 = 3.