#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, a, b;
long long res, x, y, ans = 0;
class Monster {
 public:
  long long hp, dmg;
  inline bool operator<(const Monster &oth) const {
    return (hp - dmg) > (oth.hp - oth.dmg);
  }
} p[maxn];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = (0); i < (n); ++i) {
    scanf("%lld%lld", &p[i].hp, &p[i].dmg);
    res += p[i].dmg;
  }
  sort(p, p + n);
  for (int i = (0); i < (n); ++i) {
    if (i < b - 1) x += max(0ll, p[i].hp - p[i].dmg);
    if (i < b) y += max(0ll, p[i].hp - p[i].dmg);
  }
  if (a && b) {
    for (int i = (0); i < (n); ++i) {
      if (i < b - 1)
        ans = max(ans, p[i].hp * (1 << a) - p[i].dmg + y -
                           max(0ll, p[i].hp - p[i].dmg));
      else
        ans = max(ans, p[i].hp * (1 << a) - p[i].dmg + x);
    }
  }
  ans = max(ans, y);
  ans += res;
  printf("%lld\n", ans);
  return 0;
}
