#include <bits/stdc++.h>
using namespace std;

int dp[3001][3001];

int main()
{
	int n, t, s;
	scanf("%d %d %d", &n, &t, &s);
	for (int i = 1; i <= n; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		
		for (int j = 1; j <= t; j++){
			if ((j - b < s ^ s < j) && j - b >= 0){
				dp[i][j] = max(dp[i][j], dp[i - 1][j - b] + a);
			}
			dp[i][j] = max(dp[i][j], dp[i][j - 1]);
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
		}
	}
	
	int maxi = 0;
	for (int i = 0; i <= n; i++){
		for (int j = 0; j <= t; j++){
			maxi = max(maxi, dp[i][j]);
		}
	}
	
	printf("%d\n", maxi);
	
	return 0;
}