// --------------------------------------------------
// Let's entry "square869120Contest #1" !
//
// Link : https://s8pc-1.contest.atcoder.jp/
// --------------------------------------------------

#include <vector>
#include <iostream>
#include <algorithm>

#pragma warning(disable : 4996)

using namespace std;

int main()
{
	int N, M, S;

	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &S);

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

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
		scanf("%d", &B[i]);
	}

	vector<vector<int> > dp(N + 1, vector<int>(M + 1, 0));

	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= M; j++)
		{
			dp[i][j] = dp[i - 1][j];

			if (j - B[i - 1] >= 0 && !(j - B[i - 1] < S && S < j))
			{
				dp[i][j] = max(dp[i][j], dp[i - 1][j - B[i - 1]] + A[i - 1]);
			}
		}
	}

	printf("%d\n", *max_element(dp[N].begin(), dp[N].end()));

	return 0;
}