#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N,T,S;
	scanf("%d %d %d",&N,&T,&S);

	int dp[T+1];
	for(int i = 0; i <= T; i++)dp[i] = 0;

	int value,cost;

	for(int i = 0; i < N; i++){
		scanf("%d %d",&value,&cost);

		for(int time = T; time-cost >= 0; time--){
			if(time-cost < S && S < time){
				//Do nothing
			}else{
				dp[time] = max(dp[time],dp[time-cost]+value);
			}
		}

		for(int time = 1; time <= T; time++){
			dp[time] = max(dp[time],dp[time-1]);
		}
	}

	printf("%d\n",dp[T]);

	return 0;
}