#include<iostream>
#include<climits>
#include<cassert>
#include<algorithm>
#include<cassert>
#include<map>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

const int N = 3010;

int dp[N][N];//i-th,time = max fun
int y[N];
int solve(int n,int s,int T,vector<int> &t,vector<int> &f){
  rep(i,N)rep(j,N)dp[i][j] = -1;

  if (t[0] <= s)dp[0][t[0]] = f[0];
  dp[0][0] = 0;
  REP(i,1,n){
    y[0] = -1;
    rep(j,T+1){
      dp[i][j] = dp[i-1][j];
      if (j-t[i] >= 0 && y[j-t[i]] != -1 && (s <= j-t[i] || j <= s)){
	dp[i][j] = max(dp[i][j] ,y[j-t[i]] + f[i]);
      }
      if (j)y[j] = max(y[j-1],dp[i-1][j]);
      else y[j] = dp[i-1][j];
    }
  }
  int ret = 0;
  rep(j,T+1)ret = max(ret,dp[n-1][j]);
  return ret;
}

int main(){
  int n,T,s;
  while(cin>>n>>T>>s){
    vector<int> f(n),t(n);
    rep(i,n)cin>>f[i]>>t[i];
    cout << solve(n,s,T,t,f) << endl;
  }
}