#include <bits/stdc++.h>
using namespace std;
const int maxn = 200009;
const int Maxmask = 1953124 + 10;
const int Mod = 1000000007;
struct Node {
  long long hp, dmg;
} f[maxn];
bool cmp(Node a, Node b) {
  if (a.hp - a.dmg == b.hp - b.dmg) {
    return a.hp > b.hp;
  }
  return a.hp - a.dmg > b.hp - b.dmg;
}
int n, a, b;
int main() {
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  for (int i = 0; i < n; i++)
    scanf("%I64d", &f[i].hp), scanf("%I64d", &f[i].dmg);
  sort(f, f + n, cmp);
  long long sum = 0, ans = 0;
  for (int i = 0; i < b; i++) sum += max(f[i].hp, f[i].dmg);
  for (int i = b; i < n; i++) sum += f[i].dmg;
  ans = sum;
  for (int i = 0; i < b; i++)
    ans = max(ans, sum - max(f[i].hp, f[i].dmg) + (f[i].hp << a));
  if (b != 0) {
    long long tmp = sum - max(f[b - 1].hp, f[b - 1].dmg) + f[b - 1].dmg;
    for (int i = b; i < n; i++) {
      ans = max(ans, tmp - f[i].dmg + (f[i].hp << a));
    }
  }
  printf("%I64d\n", ans);
}
