#include <bits/stdc++.h>
using namespace std;
struct state_t
{
int cookies, S, T;
state_t( int s ) : cookies( 0 ), S( s ), T( 0 )
{
}
int ceil_time_units( int x ) const
{
return ( x + S - 1 ) / S;
}
int min_time( int C )
{
return T + ceil_time_units( C - cookies );
}
int delta( int cost ) const
{
int t = 0; if ( cost > cookies ) t = ceil_time_units( cost - cookies ); return t;
}
void update_time( int delta )
{
T += delta, cookies += delta * S;
}
void buy( int cost, int production )
{
cookies -= cost, S += production;
}
};
struct factory_t
{
int cost, production; bool bought;
factory_t()
{
cin >> cost >> production, bought = false;
}
void buy( state_t &x )
{
x.buy( cost, production ), bought = true;
}
void backtrack( state_t &x )
{
x.buy( -cost, -production ), bought = false;
}
};
struct factories_t: vector< factory_t >
{
int C;
int min_time( state_t x )
{
int t_min = x.min_time( C );
for( int i = 0, n = size(); i < n; i++ )
if ( not at( i ).bought )
{
int delta = x.delta( at( i ).cost );
if ( delta > 0 )
x.update_time( delta );
at( i ).buy( x ), t_min = min( t_min, min_time( x ) ), at( i ).backtrack( x );
if ( delta > 0 )
x.update_time( -delta );
}
return t_min;
}
};
int main()
{
ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );
int N, S; factories_t factories; cin >> N >> factories.C >> S, factories.resize( N );
state_t initial_state( S );
cout << factories.min_time( initial_state );
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IHN0YXRlX3QKewogICAgaW50IGNvb2tpZXMsIFMsIFQ7CgogICAgc3RhdGVfdCggaW50IHMgKSA6IGNvb2tpZXMoIDAgKSwgUyggcyApLCBUKCAwICkKICAgIHsKICAgIH0KCiAgICBpbnQgY2VpbF90aW1lX3VuaXRzKCBpbnQgeCApIGNvbnN0CiAgICB7CiAgICAgICAgcmV0dXJuICggeCArIFMgLSAxICkgLyBTOwogICAgfQoKICAgIGludCBtaW5fdGltZSggaW50IEMgKQogICAgewogICAgICAgIHJldHVybiBUICsgY2VpbF90aW1lX3VuaXRzKCBDIC0gY29va2llcyApOwogICAgfQoKICAgIGludCBkZWx0YSggaW50IGNvc3QgKSBjb25zdAogICAgewogICAgICAgIGludCB0ID0gMDsgaWYgKCBjb3N0ID4gY29va2llcyApIHQgPSBjZWlsX3RpbWVfdW5pdHMoIGNvc3QgLSBjb29raWVzICk7IHJldHVybiB0OwogICAgfQoKICAgIHZvaWQgdXBkYXRlX3RpbWUoIGludCBkZWx0YSApCiAgICB7CiAgICAgICAgVCArPSBkZWx0YSwgY29va2llcyArPSBkZWx0YSAqIFM7CiAgICB9CgogICAgdm9pZCBidXkoIGludCBjb3N0LCBpbnQgcHJvZHVjdGlvbiApCiAgICB7CiAgICAgICAgY29va2llcyAtPSBjb3N0LCBTICs9IHByb2R1Y3Rpb247CiAgICB9Cn07CgpzdHJ1Y3QgZmFjdG9yeV90CnsKICAgIGludCBjb3N0LCBwcm9kdWN0aW9uOyBib29sIGJvdWdodDsKCiAgICBmYWN0b3J5X3QoKQogICAgewogICAgICAgIGNpbiA+PiBjb3N0ID4+IHByb2R1Y3Rpb24sIGJvdWdodCA9IGZhbHNlOwogICAgfQoKICAgIHZvaWQgYnV5KCBzdGF0ZV90ICZ4ICkKICAgIHsKICAgICAgICB4LmJ1eSggIGNvc3QsICBwcm9kdWN0aW9uICksIGJvdWdodCA9IHRydWU7CiAgICB9CgogICAgdm9pZCBiYWNrdHJhY2soIHN0YXRlX3QgJnggKQogICAgewogICAgICAgIHguYnV5KCAtY29zdCwgLXByb2R1Y3Rpb24gKSwgYm91Z2h0ID0gZmFsc2U7CiAgICB9Cn07CgpzdHJ1Y3QgZmFjdG9yaWVzX3Q6IHZlY3RvcjwgZmFjdG9yeV90ID4KewogICAgaW50IEM7CgogICAgaW50IG1pbl90aW1lKCBzdGF0ZV90IHggKQogICAgewogICAgICAgIGludCB0X21pbiA9IHgubWluX3RpbWUoIEMgKTsKCiAgICAgICAgZm9yKCBpbnQgaSA9IDAsIG4gPSBzaXplKCk7IGkgPCBuOyBpKysgKQogICAgICAgICAgICBpZiAoIG5vdCBhdCggaSApLmJvdWdodCApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGludCBkZWx0YSA9IHguZGVsdGEoIGF0KCBpICkuY29zdCApOwoKICAgICAgICAgICAgICAgIGlmICggZGVsdGEgPiAwICkKICAgICAgICAgICAgICAgICAgICB4LnVwZGF0ZV90aW1lKCBkZWx0YSApOwoKICAgICAgICAgICAgICAgIGF0KCBpICkuYnV5KCB4ICksIHRfbWluID0gbWluKCB0X21pbiwgbWluX3RpbWUoIHggKSApLCBhdCggaSApLmJhY2t0cmFjayggeCApOwoKICAgICAgICAgICAgICAgIGlmICggZGVsdGEgPiAwICkKICAgICAgICAgICAgICAgICAgICB4LnVwZGF0ZV90aW1lKCAtZGVsdGEgKTsKICAgICAgICAgICAgfQoKICAgICAgICByZXR1cm4gdF9taW47CiAgICB9Cn07CgppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oIGZhbHNlICksIGNpbi50aWUoIG51bGxwdHIgKSwgY291dC50aWUoIG51bGxwdHIgKTsKCiAgICBpbnQgTiwgUzsgZmFjdG9yaWVzX3QgZmFjdG9yaWVzOyBjaW4gPj4gTiA+PiBmYWN0b3JpZXMuQyA+PiBTLCBmYWN0b3JpZXMucmVzaXplKCBOICk7CgogICAgc3RhdGVfdCBpbml0aWFsX3N0YXRlKCBTICk7CgogICAgY291dCA8PCBmYWN0b3JpZXMubWluX3RpbWUoIGluaXRpYWxfc3RhdGUgKTsKfQo=