
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
using namespace std;

int n, t, s;
int a[3456], b[3456];

int memo[3456][3456];
//(1indexed)i??????????±???°??§????????§????????????j
const int INF = INT_MAX / 4;
int dp(int i, int j)
{
	if (j < 0)return -INF;
	if (i == 0)return 0;
	if (memo[i][j] >= 0)return memo[i][j];
	int ans = dp(i, j - 1);
	if (!(j - b[i - 1] < s && s < j))
	{
		ans = max(ans, dp(i - 1, j - b[i - 1]) + a[i - 1]);
	}
	ans = max(ans, dp(i - 1, j));
	return memo[i][j] = ans;
}

int main(void)
{
	memset(memo, 0xff, sizeof(memo));
	scanf("%d %d %d", &n, &t, &s);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d %d", a + i, b + i);
	}
	printf("%d\n", dp(n, t));
	return 0;
}