#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
struct node {
  long long hp, dmg, abs;
  bool operator<(const node &rhs) const { return abs > rhs.abs; }
} p[N];
int main() {
  int a, n, b;
  scanf("%d%d%d", &n, &a, &b);
  long long sum = 0;
  long long x = 1;
  while (a--) x *= 2;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &p[i].hp, &p[i].dmg);
    p[i].abs = p[i].hp - p[i].dmg;
    sum += p[i].dmg;
  }
  sort(p + 1, p + 1 + n);
  int cnt = 0, mini = 0;
  for (int i = 1; i <= b; ++i) {
    if (p[i].abs > 0) {
      cnt++;
      sum += p[i].abs;
      mini = p[i].abs;
    } else
      break;
  }
  long long ans = sum;
  if (a) {
    if (b > cnt) {
      for (int i = 1; i <= n; ++i) {
        if (p[i].hp * x - p[i].dmg > 0)
          ans = max(ans, sum - max(0ll, p[i].abs) + p[i].hp * x - p[i].dmg);
      }
    } else if (b) {
      for (int i = 1; i <= cnt; ++i)
        ans = max(ans, sum - p[i].abs + p[i].hp * x - p[i].dmg);
      sum -= mini;
      for (int i = cnt + 1; i <= n; ++i)
        ans = max(ans, sum + p[i].hp * x - p[i].dmg);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
