PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000118. Ném kiếm tiêu diệt quái vật (Katana Thrower)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Ném kiếm tiêu diệt quái vật (Katana Thrower)

Katana Thrower

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

A monster has HH health. Sword ii can be swung any number of times for aia_i damage per swing, or thrown once for bib_i damage, after which it is lost. Find the minimum number of attacks to deal at least HH damage.

Input

The first line contains N,HN,H. Each of the following NN lines contains ai,bia_i,b_i.

Output

Print the minimum number of attacks.

Subtasks

  • Subtask 1 (20 points): 1≤N≤201\le N\le 20; 1≤H≤1091\le H\le10^9; 1≤ai≤bi≤1091\le a_i\le b_i\le10^9.
  • Subtask 2 (30 points): 1≤N≤12001\le N\le 1200; 1≤H≤1091\le H\le10^9; 1≤ai≤bi≤1091\le a_i\le b_i\le10^9.
  • Subtask 3 (50 points): 1≤N≤1000001\le N\le 100000; 1≤H≤1091\le H\le10^9; 1≤ai≤bi≤1091\le a_i\le b_i\le10^9.

Examples

Input

2 17
3 5
4 8

Output

3

Explanation

Swing the second sword once (4 damage), then throw it (8 damage), and throw the first sword (5 damage), dealing 1717 damage in three attacks.