#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define Tl 7010
int dp[Tl],cop[Tl],n,t,s;
int main(){
  cin>>n>>t>>s;
  lol(i,Tl)dp[i]=0;
  lol(u,n){
    int a,b;cin>>a>>b;
    lol(i,Tl)cop[i]=dp[i];
    for(int i=t;i>=0;i--){
      if(i<s&&s<i+b)cop[s+b]=max(cop[s+b],dp[i]+a);
      else cop[i+b]=max(cop[i+b],dp[i]+a);
    }
    lol(i,Tl)dp[i]=cop[i];
  }
  int ans=0;
  lol(i,t+1)ans=max(ans,dp[i]);
  cout<<ans<<endl;
  return 0;
}