#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

unsigned int dp[3002][3002];
int main() {
	memset(dp, 0, sizeof(dp));
	int N, T; cin >> N >> T;
	int S; cin >> S;
	vector<pair<int, int>>ps;
	for (int i = 0; i < N; ++i) {
		int A, B; cin >> A >> B;
		ps.emplace_back(A, B);
	}
	for (int i = 0; i < N; ++i) {
		for (int t = 0; t <= T; ++t) {
			const int nextt = t + ps[i].second;
			if (nextt <= T) {
				if (!(t <S&&nextt > S)) {
					dp[i + 1][nextt] = max(dp[i + 1][nextt], dp[i][t] + ps[i].first);
				}
			}
			dp[i + 1][t] = max(dp[i + 1][t], dp[i][t]);
			dp[i][t + 1] = max(dp[i][t + 1], dp[i][t]);
		}
	}
	cout << dp[N][T] << endl;
	return 0;
}