#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int hp[N], dmg[N], p[N];
bool cmp(int a, int b) { return hp[a] - dmg[a] > hp[b] - dmg[b]; }
bool vis[N];
int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &hp[i], &dmg[i]);
    p[i] = i;
  }
  sort(p + 1, p + 1 + n, cmp);
  long long sum = 0, ans, la = 0, cb = 0;
  bool flag = false;
  for (int i = 1; i <= n; i++) {
    if (i > b || hp[p[i]] <= dmg[p[i]]) {
      if (!flag) flag = true, la = hp[p[i - 1]] - dmg[p[i - 1]], cb = i - 1;
    }
    if (!flag)
      sum += hp[p[i]], vis[p[i]] = true;
    else
      sum += dmg[p[i]];
  }
  ans = sum;
  if (a && b) {
    for (int i = 1; i <= n; i++) {
      long long tmp = hp[i];
      for (int j = 1; j <= a; j++) tmp = tmp * 2;
      tmp += sum;
      if (vis[i]) {
        tmp -= hp[i];
      } else {
        tmp -= dmg[i];
        if (cb == b) tmp -= la;
      }
      ans = max(ans, tmp);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
