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

using i64 = int64_t;

i64 dp[3003][3003]={};

int main(){
    int n, t, s;
    cin >> n >> t >> s;
    vector<i64> a, b;
    for(int i=0;i<n;++i){
        i64 x, y;
        cin >> x >> y;
        a.push_back(x);
        b.push_back(y);
    }
    for(int j=0;j<=t;++j){
        for(int k=0;k<=n;++k){
            dp[j][k] = -1;
        }
    }
    dp[0][0] = 0;
    for(int i=0;i<=t;++i){
        for(int j=1;j<=n;++j){
            dp[i][j] = max(dp[i][j], dp[i][j-1]);
            if(i < s && i+b[j-1] > s){
                dp[s][j] = max(dp[s][j], dp[i][j-1]);
            }else if(i+b[j-1] <= t){
                dp[i+b[j-1]][j] = max(dp[i+b[j-1]][j], dp[i][j-1]+a[j-1]);
            }
        }
    }
    i64 ans = 0;
    for(int i=0;i<=t;++i)ans = max(ans, dp[i][n]);
    cout << ans << endl;

    return 0;
}

