Bessie has gone on a trip and is riding a roller coaster! Bessie loves riding roller coasters, but unfortunately she often gets dizzy.
The roller coaster is made up of several distinct sections, which Bessie rides in order. At the start of the ride, both Bessie's dizziness and fun are 0. For each section, Bessie can keep her eyes either open or closed, and she must hold that choice for the whole section.
If at any moment Bessie's dizziness rises above a certain limit, she gets sick. Write a program to find the maximum amount of fun Bessie can have without getting sick.
The input contains several test cases. Each test case begins with a line of three integers.
N K L
Each of the next $N$ lines contains two integers.
F D
The sections are given in order. The input ends with a line containing three 0s, which should not be processed.
For each test case, output a single integer on its own line: the maximum amount of fun Bessie can have without exceeding her dizziness limit.