#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
#define mpp(t1, t2, t3, t4) mp(mp(t1, t2), mp(t3, t4))

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P, P> PP;

int dp[3005][3005];

int main() {
	int n, t, s;
	cin >> n >> t >> s;

	vector<P> v(n);
	rep(i, n) {
		cin >> v[i].first >> v[i].second;
	}

	memset(dp, 0, sizeof(dp));

	REP(i, 0, n) {
		rep(j, t + 1) {
			if(j - v[i].second < 0 || (j - v[i].second < s && s < j) ) {
				dp[i+1][j] = dp[i][j];
			} else {
				dp[i+1][j] = max(dp[i][j], dp[i][j-v[i].second] + v[i].first);
			}
		}
	}

	int ans = 0;
	rep(i, n + 1 ) {
		rep(j, t + 1) {
			ans = max(ans, dp[i][j]);
		}
	}

	cout << ans << endl;

	return 0;
}