#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N, T, S;
int cost[3001];
int fun[3001];
int dp[3001];
int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N  >> T >> S;
	for (int i = 1; i <= N; i++)cin >> fun[i] >> cost[i];
	for (int i = 1; i <= N; i++) {
		for (int j = T; j >= cost[i]; j--) {
			if (j - cost[i] >= S || j <= S)dp[j] = max(dp[j], dp[j - cost[i]] + fun[i]);
		}
	}
	for (int i = 1; i <= T; i++)ans = max(ans, dp[i]);
	cout << ans << endl;
	return 0;
}