#include<bits/stdc++.h>  
using namespace std;
typedef pair< int, int > Pi;

int dp[3001][3001];

int main(){
  int N, T, S, A[3000], B[3000];
  cin >> N >> T >> S;
  for(int i = 0; i < N; i++){
    cin >> A[i] >> B[i];
  }

  for(int i = 0; i < N; i++){
    for(int j = 0; j <= T; j++){
      dp[i + 1][j] = max( dp[i + 1][j], dp[i][j]);
      if(j > 0) dp[i + 1][j] = max( dp[i + 1][j], dp[i + 1][j - 1]);
      if(j - B[i] >= 0 && (j <= S || j - B[i] >= S)){
        dp[i + 1][j] = max( dp[i + 1][j], dp[i][j - B[i]] + A[i]);
      }
    };
  }
  cout << dp[N][T] << endl;
}