#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const long long MAX = 2e9 + 7;
const long long mod = 1e9 + 7;
const long long maxn = 2e5 + 7;
long long n, a, b;
struct node {
  long long hp, dmg, x, v;
} s[maxn];
bool cmp(node a, node b) { return a.x > b.x; }
int main() {
  long long cnt = 1;
  long long sum = 0, id = 0;
  scanf("%lld%lld%lld", &n, &a, &b);
  while (a--) cnt *= 2;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &s[i].hp, &s[i].dmg);
    s[i].x = max(0ll, s[i].hp - s[i].dmg);
    s[i].v = s[i].hp * cnt - s[i].dmg;
    sum += s[i].dmg;
  }
  sort(s + 1, s + 1 + n, cmp);
  b = min(b, n);
  cnt = 0;
  long long ans = 0;
  if (b > 0) {
    for (int i = 1; i <= b; i++) cnt += s[i].x;
    for (int i = 1; i <= b; i++) ans = max(ans, cnt - s[i].x + s[i].v);
    for (int i = b + 1; i <= n; i++) ans = max(ans, cnt - s[b].x + s[i].v);
  }
  printf("%lld\n", sum + ans);
  return 0;
}
