#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  long long x = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
  return x;
}
const int Maxn = 2 * 1e5 + 5;
long long N, A, B, SumAttack, Ans, Hp[Maxn], At[Maxn];
struct M {
  long long x, id;
} A_H[Maxn];
int cmp(M x, M y) { return x.x > y.x; }
int main() {
  N = read(), A = read(), B = read();
  for (int i = 1; i <= N; i++) {
    Hp[i] = read();
    At[i] = read();
    SumAttack += At[i];
  }
  if (!B) return printf("%lld", SumAttack), 0;
  for (int i = 1; i <= N; i++) A_H[i].x = Hp[i] - At[i], A_H[i].id = i;
  sort(A_H + 1, A_H + N + 1, cmp);
  int Mix = 0;
  for (int i = 1; i <= B; i++) {
    if (A_H[i].x < 0) break;
    SumAttack += A_H[i].x;
    Mix = i;
  }
  Ans = SumAttack;
  if (!A) return printf("%lld", Ans), 0;
  for (int i = 1; i <= N; i++) {
    if (A_H[i].x > 0 && i <= B)
      Ans =
          max(Ans, SumAttack + (Hp[A_H[i].id] << A) - A_H[i].x - At[A_H[i].id]);
    else
      Ans = max(Ans, SumAttack + (Hp[A_H[i].id] << A) - At[A_H[i].id] -
                         (Mix == B ? A_H[Mix].x : 0));
  }
  printf("%lld", Ans);
  return 0;
}
