#P2006. 赵神牛的游戏

赵神牛的游戏

Description

In DNF, Zhao Shenniu has a "Dizaozhe" character. He has a total of kk mana points and there are mm skills. Each skill costs aia_i mana and deals bib_i damage. The boss has nn health points. Please determine which skill he should cast to kill the boss.

Of course, Zhao Shenniu is not very skilled; in one game he only uses one skill, but any chosen skill can be cast an unlimited number of times.

Input Format

The first line contains three integers, representing k,m,nk, m, n.

Then follow mm lines. The (i+1)(i + 1)-th line contains two integers: the mana cost aia_i and the damage bib_i.

Output Format

Output a single line: the indices of the skills that can kill the boss. If there are multiple, output them in increasing order, separated by a single space. If no skill can kill the boss, output -1.

100 3 5000
20 1000
90 1
110 10000

1

50 4 10
60 100
70 1000
80 1000
90 0

-1

Hint

Constraints

For all test points, it holds that:

  • 0<n,m3×1040 < n, m \le 3 \times 10^4.
  • 0k3×1040 \le k \le 3 \times 10^4.
  • 0ai,bi21474836470 \le a_i, b_i \le 2147483647.

Translated by ChatGPT 5