#include <bits/stdc++.h>

using namespace std;

int dp[3010][3010];

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

  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= t; j++) {
      if (j < b[i]) {
        dp[i + 1][j] = dp[i][j];
      } else if (j - b[i] < s && s < j) {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - 1]);
      } else {
        dp[i + 1][j] = max(dp[i][j], max(dp[i + 1][j - 1], dp[i][j - b[i]] + a[i]));
      }
    }
  }

  cout << dp[n][t] << endl;

  return 0;
}
