#include <bits/stdc++.h>
using namespace std;
int n, a, b;
struct node {
  long long int hp, dmg;
  bool operator<(const node &b) const { return hp - dmg > b.hp - b.dmg; }
} c[200005];
long long int pre[200005], ini = 0, ans = 0;
int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (b > n) b = n;
  for (int i = 1; i <= n; i++)
    scanf("%lld%lld", &c[i].hp, &c[i].dmg), ini += c[i].dmg;
  if (b == 0) return printf("%lld", ini), 0;
  sort(c + 1, c + n + 1);
  for (int i = 1; i <= n; i++)
    if (c[i].hp > c[i].dmg)
      pre[i] = pre[i - 1] + c[i].hp - c[i].dmg;
    else
      pre[i] = pre[i - 1];
  ans = ini + pre[b];
  if (a == 0) return printf("%lld", ans), 0;
  for (int i = 1; i <= n; i++) {
    long long int hp = c[i].hp * (1 << a);
    long long int t;
    if (hp > c[i].dmg) {
      t = ini + hp - c[i].dmg;
      if (b >= i)
        t += pre[i - 1] + pre[b] - pre[i];
      else
        t += pre[b - 1];
      ans = max(ans, t);
    }
  }
  printf("%lld", ans);
  return 0;
}
