/*
 * exp.X - Practicum, Spring 2009
 *
 * Anatole Paine and Emma Carlson
 *
 * May 12, 2009
 */

#include <algorithm>
#include <cstddef>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

using namespace std;

// Constants from the problem.
const int MAX_N = 50000;
const int MAX_L = 10000000;
const int MAX_P = 10000000;

struct Station
{
   int dist;
   int fuel;
};

/*
 * Function: Boolean comparison function to allow us to sort the vector of
 * stops. Sorts first by distance, then by amount of fuel.
 */
bool compareStations(Station left, Station right)
{
   if (left.dist < right.dist)
       return true;
   else if (left.dist == right.dist)
       return left.fuel > right.fuel;
   else
       return false;
}

/*
 * Function: Greedy algorithm. Iterates over the number of stops taken until
 * it is possible for the cows to reach the town.
 */
int greedy(vector<Station> stations, const int distance, const int fuel)
{
   // Given our starting fuel, we want to go as far as possible.
   int farIndex = 0;

   for (int i = farIndex; i < stations.size(); ++i)
   {
       if (stations[i].dist > fuel)
       {
           farIndex = i - 1;
           break;
       }
   }

   // If farIndex ends up being -1, then we can reach exactly 0 stops,
   // so it's impossible.
   if (farIndex == -1)
       return -1;

   // Now we want to see what the fewest number of stops we can make is.
   int maxDistance = fuel;
   int numStops = 0;
   while (maxDistance < distance)
   {
       // Some temporary variables.
       int tempMax = maxDistance;
       int bestStation = 0;

       // We need to know the index of the farthest station we can reach.
       while (farIndex < stations.size() &&
              stations[farIndex].dist <= maxDistance)
       {
           ++farIndex;
       }

       /*
        * Look at all the fuel stops we can reach so far, and add the one with
        * the most fuel to our trip. The addition and subtraction of
        * stations[i].dist here are redundant, but are left here for
        * mathematical clarity.
        */
       for (int i = 0; i < farIndex; ++i)
       {
           int remainingFuel = maxDistance - stations[i].dist + stations[i].fuel;
           if (remainingFuel + stations[i].dist > tempMax)
           {
               tempMax = remainingFuel + stations[i].dist;
               bestStation = i;
           }
       }

       /* Debug statements.
       cerr << "Added station " << bestStation << ": [" << stations[bestStation].dist;
       cerr << ", " << stations[bestStation].fuel << "]" << endl;
       */

       stations[bestStation].fuel = 0;
       maxDistance = tempMax;

       /* Debug.
       cerr << "maxDistance is now " << maxDistance << endl;
       */

       // Now we increment the number of stops, and quit if it's impossible.
       ++numStops;
       if (numStops > stations.size())
           return -1;
   }

   return numStops;
}

/*
 * Function: The main driver for the program. This handles all of the ugly
 * input stuff, turns the input into useful data, and then runs the algorithm
 * on that data.
 */
int main() // We don't care about command-line stuff.
{
   try
   {
       // Get N, L, and P.
       string firstLine;
       getline(cin, firstLine);
       stringstream first(firstLine);
       int N = 0;
       int L = 0;
       int P = 0;
       first >> N >> L >> P;

       /*
        * We need to make sure that we avoid going outside the limits set by
        * the problem. Note that none of these are program-crashing problems,
        * but we'll quit anyway for safety.
        */
       if (N > MAX_N || L > MAX_L || P > MAX_P)
       {
           cerr << "N, L, or P too large!" << endl;
           exit(1);
       }

       // If P > L, then we never have to make a stop, so we can just print 0
       // and exit.
       if (P > L)
       {
           cout << 0 << endl;
           exit(0);
       }

       // Initalize the data structure holding our stations
       vector<Station> stations(N);

       /*
        * For the next N lines, get a pair of numbers. Note that while doing
        * this, we subtract the given distance for the fuel stop from the total
        * distance to find the distance from the truck, which is more useful.
        */
       for(int i = 0; i < N; ++i)
       {
           // Initialize D_i and F_i to -1 for error checking purposes.
           int d = -1;
           int f = -1;

           // Get D_i and F_i, and pair them.
           cin >> d >> f;
           Station stop = {L - d, f};

           /* Debug.
           cerr << "Added a stop: [" << L - d << ", " << f << "]" << endl;
           */

           // Add the station to our vector.
           stations.push_back(stop);
       }

       /* Debug.
       cerr << "Added stations, about to sort." << endl;
       */

       /*
        * Now, we can finally do some computation. First, however, we want to
        * sort our vector of stations, as this makes it easier to find the
        * optimal answer.
        */
       sort(stations.begin(), stations.end(), compareStations);
       cout << greedy(stations, L, P) << endl;
   }
   catch(const exception& e)
   {
       cerr << "Something went wrong:" << e.what() << endl;
       return(1);
   }

   return 0;
}