#include <bits/stdc++.h>

using namespace std;

#define rep(i,x) for(int i=0;i<x;++i)

const int inf = 1e9+10;

int dp[3010];

signed main()
{
    int N, T, S; cin >> N >> T >> S;

    vector<int> A(N), B(N);

    rep(i, N) {
        cin >> A[i] >> B[i];
    }

    rep(i, N) {
        for (int j = T - B[i]; j >= 0; --j) {
            if (j < S && S < j + B[i]) continue;
            dp[j + B[i]] = max(dp[j + B[i]], dp[j] + A[i]);
        }
    }

    int ans = 0;

    rep(i, T+1) ans = max(ans, dp[i]);

    cout << ans << endl;
}