#GD0000011. Rồng (Dragons)

Rồng (Dragons)

Dragons

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A player starts with strength ss and must defeat nn dragons. Dragon ii has strength xix_i and reward yiy_i. The player wins a duel only if the current strength is strictly greater than xix_i; after winning, strength increases by yiy_i. Dragons may be fought in any order. Determine whether all dragons can be defeated.

Input

The first line contains s,ns,n. Each of the next nn lines contains xi,yix_i,y_i.

Output

Print YES if all dragons can be defeated, otherwise print NO.

Subtasks

General constraints:

  • 1≤s≤1041 \le s \le 10^4.

  • 1≤n≤1031 \le n \le 10^3.

  • 1≤xi≤1041 \le x_i \le 10^4.

  • 0≤yi≤1040 \le y_i \le 10^4.

  • Subtask 1 (20 points): n≤10n \le 10, xi,yi≤100x_i,y_i \le 100

  • Subtask 2 (30 points): n≤200n \le 200

  • Subtask 3 (50 points): No additional constraints.

Examples

Input

2 2
1 99
100 0

Output

YES

Explanation

Strength 2>12>1, so the first dragon is defeated and strength becomes 101101. Then 101>100101>100, so the second dragon is also defeated.