#include <iostream>
using namespace std;

int N,T,S;
int A[3010],B[3010];
int dp[3010][3010] = {};
int main(){
	cin >> N >> T >> S;
	for(int i=1;i<=N;i++){
		cin >> A[i] >> B[i];
	}
	int ans = 0;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=T;j++){
			if(j-B[i]<0 || (j-B[i]<S && S<j)) dp[i][j] = dp[i-1][j];
			else dp[i][j] = max(dp[i-1][j],dp[i-1][j-B[i]]+A[i]);
			ans = max(ans,dp[i][j]);
		}
	}
/*	for(int i=1;i<=N;i++){
		for(int j=1;j<=T;j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
*/	cout << ans << endl;
}
