#include <set>
#include <cstdio>
#include <algorithm>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;


int main(){
  int n = getInt();
  int t = getInt();
  int s = getInt();

  vector<int> a(n);
  vector<int> b(n);

  REP(i,n){
    a[i] = getInt();
    b[i] = getInt();
  }

  vector<int> now(t + 1, -1);

  now[0] = 0;
  REP(i,n){
    vector<int> next = now;

    REP(j,t) if(now[j] >= 0){
      int end = j + b[i];

      if(j < s) next[s] = max(next[s], now[j]);

      if(end <= t && !(j < s && s < end)){
        next[end] = max(next[end], now[j] + a[i]);
      }
    }

    now.swap(next);
  }

  printf("%d\n", *max_element(now.begin(), now.end()));

  return 0;
}