#include <bits/stdc++.h>
using namespace std;
struct creature {
  long long hp, dmg;
  long long div;
  bool operator<(const creature& rhs) const { return div > rhs.div; }
};
int n, a, b;
creature in[200050];
long long ans = 0;
int it, use;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> in[i].hp >> in[i].dmg;
    in[i].div = in[i].hp - in[i].dmg;
  }
  sort(in, in + n);
  use = b;
  for (int i = 0; i < n; ++i) {
    if (use && in[i].hp > in[i].dmg) {
      in[i].dmg = in[i].hp;
      --use;
    }
    ans += in[i].dmg;
  }
  it = b - use;
  int icur = it - 1;
  in[n] = {0, 0, 0};
  long long dx = 0;
  if (b && a)
    for (int i = 0; i < n; ++i) {
      long long tmp = (in[i].hp << a) - in[i].dmg;
      if (use)
        dx = dx > tmp ? dx : tmp;
      else if (i < it)
        dx = tmp > dx ? tmp : dx;
      else
        dx = (tmp - in[icur].div > dx) ? tmp - in[icur].div : dx;
    }
  cout << ans + dx;
  return 0;
}
