#include<bits/stdc++.h>
//#define int long long
#define PB push_back
#define MP make_pair
#define F first
#define S second
using namespace std;

int n, t, s, a[3010], b[3010];
int dp[3010][3010];

signed main()
{
	cin >> n >> t >> s;
	for(int i = 1; i <= n; i++){
		cin >> a[i] >> b[i];
	}
	
	for(int i = 1; i <= t; i++){
		for(int j = 1; j <= n; j++){
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if(0 <= i - b[j] && i <= s || s <= i - b[j]){
				dp[i][j] = max(dp[i][j], dp[i - b[j]][j - 1] + a[j]);
			}
		}
	}
	
	cout << dp[t][n] << endl;
	return 0;
}