#include <iostream>
#include <algorithm>
using namespace std;
int N, T, S, A[3009], B[3009], dp[3009];
int main() {
	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 = T; j >= B[i]; j--) {
			if (j - B[i] < S && S < j) continue;
			dp[j] = max(dp[j], dp[j - B[i]] + A[i]);
		}
	}
	cout << *max_element(dp, dp + T + 1) << endl;
	return 0;
}