#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 10;
int n, a, b, ord[N];
long long hp[N], dmg[N], ans, m;
bool in[N];
bool cmp(int i, int j) { return hp[i] - dmg[i] > hp[j] - dmg[j]; }
int main() {
  scanf("%d%d %d", &n, &a, &b);
  for (int i = 1; i <= n; i++)
    scanf("%lld %lld", &hp[i], &dmg[i]), ans += dmg[i];
  m = 1;
  for (int i = 1; i <= a; i++) m *= 2;
  for (int i = 1; i <= n; i++) ord[i] = i;
  sort(ord + 1, ord + n + 1, cmp);
  int last = 0;
  for (int i = 1; i <= b && i <= n && hp[ord[i]] - dmg[ord[i]] > 0; i++)
    in[ord[i]] = 1, ans += hp[ord[i]] - dmg[ord[i]], last = i;
  long long v = 0;
  for (int i = 1; i <= n; i++) {
    if (in[i]) {
      if (v < hp[i] * (m - 1)) v = hp[i] * (m - 1);
    } else {
      if (b) {
        if (last == b) {
          if (v < (hp[i] * m - dmg[i]) - (hp[ord[last]] - dmg[ord[last]])) {
            v = (hp[i] * m - dmg[i]) - (hp[ord[last]] - dmg[ord[last]]);
          }
        } else {
          if (v < hp[i] * m - dmg[i]) v = hp[i] * m - dmg[i];
        }
      }
    }
  }
  printf("%lld\n", ans + v);
  return 0;
}
