#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const int M = 25;
struct node {
  long long hp, dmg;
} f[N];
struct val {
  long long w;
  int id;
} c[N];
int n, a, b;
long long ans, sum, now, last;
int pos[N];
bool cmp(val a, val b) { return a.w > b.w; }
int main() {
  int i;
  scanf("%d%d%d", &n, &a, &b);
  for (i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &f[i].hp, &f[i].dmg);
    ans += f[i].dmg;
  }
  for (i = 1; i <= n; i++) {
    c[i].w = max(0ll, f[i].hp - f[i].dmg);
    c[i].id = i;
  }
  if (!b) {
    printf("%I64d\n", ans);
    return 0;
  }
  sort(c + 1, c + 1 + n, cmp);
  for (i = 1; i <= n; i++) pos[c[i].id] = i;
  for (i = 1; i <= b; i++) sum += c[i].w;
  last = ans;
  for (i = 1; i <= n; i++) {
    now = max(0ll, (f[i].hp << a) - f[i].dmg);
    if (pos[i] <= b)
      now -= c[pos[i]].w;
    else
      now -= c[b].w;
    ans = max(ans, last + sum + now);
  }
  printf("%I64d\n", ans);
  return 0;
}
