#include <bits/stdc++.h>
using namespace std;
bool compare(vector<long long> &A, vector<long long> &B) {
  if (A[0] - A[1] > B[0] - B[1]) return true;
  return false;
}
int main() {
  long long(n), (a), (b);
  scanf("%lld%lld%lld", &(n), &(a), &(b));
  ;
  vector<vector<long long>> A, B;
  long long sum = 0;
  for (long long i = 0; i < (n); i++) {
    long long(a), (b);
    scanf("%lld%lld", &(a), &(b));
    ;
    if (a > b)
      B.push_back(vector<long long>{a, b});
    else
      A.push_back(vector<long long>{a, b});
    sum += b;
  }
  if (b == 0) {
    printf("%lld\n", sum);
    return 0;
  }
  long long val = 1;
  while (a--) val *= 2;
  sort((B).begin(), (B).end(), compare);
  while (B.size() > b) {
    A.push_back(B[B.size() - 1]);
    B.pop_back();
  }
  long long store = 0;
  for (long long i = 0; i < (B.size()); i++) {
    sum += B[i][0] - B[i][1];
    if (B.size() == b && i == b - 1) store = B[i][1] - B[i][0];
  }
  long long ans = sum;
  for (long long i = 0; i < (B.size()); i++) {
    long long temp = sum;
    temp -= B[i][0];
    temp += B[i][0] * val;
    ans = max(ans, temp);
  }
  for (long long i = 0; i < (A.size()); i++) {
    long long temp = sum + store;
    temp -= A[i][1];
    temp += A[i][0] * val;
    ans = max(ans, temp);
  }
  printf("%lld\n", ans);
  return 0;
}
