#include <bits/stdc++.h>
using namespace std;
const int inf=1e9;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
int ans=-inf;
int N,T,S;
int dp[3005][6005];
int A[3005];
int B[3005];
int main(void)
{
  cin >> N >> T >> S;
  for(int i=0;i<=3000;i++)
    {
      for(int j=0;j<=6000;j++)
	{
	  if(i!=0) dp[i][j]=-inf;
	  else dp[i][j]=0;
	}
    }
  for(int i=1;i<=N;i++)
    {
      cin >> A[i] >> B[i];
    }
  for(int i=1;i<=N;i++)
    {
      for(int Time=0;Time<=T;Time++)
	{
	  dp[i][Time]=max(dp[i-1][Time],dp[i][Time]);
	  if(Time<S && Time+B[i]>S) continue;
	  dp[i][Time+B[i]]=max(dp[i-1][Time]+A[i],dp[i-1][Time+B[i]]);
	}
    }
  for(int Time=0;Time<=T;Time++)
    {
      ans=max(ans,dp[N][Time]);
      //cout << "Time " << Time << " Finished & Value is " <<dp[N][Time] << endl;
    }
  cout << ans << endl;
  return 0;
}

