#include <bits/stdc++.h>
using namespace std;
int n, A, B, t;
long long Ans, Sum, Num;
struct xcw {
  long long hp, dam;
  bool operator<(const xcw b) const { return (hp - dam) > (b.hp - b.dam); }
} a[200005];
long long read() {
  long long ret = 0;
  char ch = getchar();
  bool f = 1;
  for (; !isdigit(ch); ch = getchar()) f ^= !(ch ^ '-');
  for (; isdigit(ch); ch = getchar()) ret = ret * 10 + ch - '0';
  return ret;
}
int main() {
  n = read(), A = read(), B = read();
  for (int i = 1; i <= n; i++) a[i] = (xcw){read(), read()}, Num += a[i].dam;
  if (!B) {
    cout << Num << endl;
    return 0;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= B; i++) Sum += max(0LL, a[i].hp - a[i].dam);
  for (int i = 1; i <= B; i++)
    Ans = max(Ans,
              Sum - max(0LL, a[i].hp - a[i].dam) - a[i].dam + (a[i].hp << A));
  for (int i = B + 1; i <= n; i++)
    Ans = max(Ans,
              Sum - max(0LL, a[B].hp - a[B].dam) - a[i].dam + (a[i].hp << A));
  cout << Ans + Num << endl;
  return 0;
}
