#include<iostream>
#include<cstdio>
#define max(a,b) (a)>(b)?(a):(b)
using namespace std;
int a[3005][2];
int dp[3005][3005];
int main(){
	int n,t,t2;
	int i,j,k;
	cin>>n>>t>>t2;
	for(i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1];
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=t;j++){
			if(j<a[i-1][1] || (j-a[i-1][1]<t2 && t2<j)){
				dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
				continue;
			}
			dp[i][j]=max(max(dp[i][j-1],dp[i-1][j]),dp[i-1][j-a[i-1][1]]+a[i-1][0]);
		}
	}
	cout<<dp[n][t]<<endl;
	return 0;
}