#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, t, s;
	cin >> n >> t>> s;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	vector<vector<int> > dp(t+1, vector<int>(n+1, 0));
	int si = 1;
	for (int i = 0; i <= t; i++) {
		int jou = s;
		if (i <= s) {
			jou = 0;
		}
		for (int j = 0; j < n; j++) {
			if (i - b[j] >= jou) {
				dp[i][j + 1] = max(dp[i - b[j]][j]+a[j], dp[i][j]);
			}
			else {
				dp[i][j + 1] = dp[i][j];
			}
			if (i >= 1) {
				dp[i][j + 1] = max(dp[i][j + 1], dp[i - 1][j + 1]);
			}
		}
	}
	int ans =0;
	for (int i = 0; i <= n; i++) {
		ans = max(dp[t][i], ans);
	}
	cout << ans << endl;
	cin >> n;
	return 0;
}

