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

const int INF = -1e9;
int maximumTotalWeight(int k, int n, int m, vector<pair<int,int>>& clusters) {
    // Initialize the dp array with size [k+1][n+1][m+1]
    // dp[i][x][y] represents the maximum total weight when considering the first i clusters,
    // with x elements chosen for group 1 and y elements chosen for group 2
    vector<vector<vector<int>>> dp(k+1, vector<vector<int>>(n+1, vector<int>(m + 1, INF)));

    dp[0][0][0] = 0; // Base case: no clusters considered, no elements chosen, total weight is 0

    // Iterate through all clusters
    for(int i = 1; i <= k; i++) {
        int weightOfFirstGroup = clusters[i - 1].first;
        int weightOfSecondGroup = clusters[i - 1].second;

        for(int x = 0; x <= n; x++) {
            for(int y = 0; y <= m; y++) {
                // Case 1: Do not choose this cluster
                dp[i][x][y] = dp[i-1][x][y];

                // Case 2: Choose this cluster for group 1
                if(x > 0) {
                    dp[i][x][y] = max(dp[i][x][y], dp[i-1][x-1][y] + weightOfFirstGroup);
                }

                // Case 3: Choose this cluster for group 2
                if(y > 0) {
                    dp[i][x][y] = max(dp[i][x][y], dp[i-1][x][y-1] + weightOfSecondGroup);
                }
            }
        }
    }

    return dp[k][n][m];
}

int main() {
	int k, n, m; cin >> k >> n >> m;
	vector<pair<int,int>> clusters(k);
	for(auto& x : clusters) cin >> x.first >> x.second;
	
	cout << maximumTotalWeight(k, n, m, clusters);
	
	return 0;
}