#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, mod = 1e9 + 7, inf = 0x3f3f3f3f;
int n, m, k, t, a, b;
long long sum[maxn], delta = 1;
struct node {
  long long x, y;
  bool operator<(const node& p) const { return x - y > p.x - p.y; }
} p[maxn];
int main() {
  int i, j;
  scanf("%d%d%d", &n, &a, &b);
  for (i = 1; i <= a; i++) delta *= 2;
  for (i = 1; i <= n; i++) scanf("%lld%lld", &p[i].x, &p[i].y);
  int mx = 0;
  long long ans = 0;
  sort(p + 1, p + n + 1);
  for (i = 1; i <= min(n, b); i++) {
    if (p[i].x - p[i].y <= 0) break;
    ans += p[i].x - p[i].y;
    sum[i] = sum[i - 1] + p[i].x - p[i].y;
    mx = i;
  }
  for (i = 1; i <= n; i++) ans += p[i].y;
  if (!b || !a) {
    printf("%lld\n", ans);
    return 0;
  }
  long long tmp = 0;
  for (i = 1; i <= n; i++) {
    long long now = delta * p[i].x - p[i].y;
    now += sum[mx];
    if (i <= mx) {
      if (mx < b && mx + 1 <= n && p[mx + 1].x - p[mx + 1].y > 0)
        now += p[mx + 1].x - p[mx + 1].y;
      now -= sum[i] - sum[i - 1];
    } else {
      if (mx == b) now -= sum[mx] - sum[mx - 1];
    }
    tmp = max(tmp, now);
  }
  long long ret = tmp;
  for (i = 1; i <= n; i++) ret += p[i].y;
  printf("%lld\n", max(ret, ans));
  return 0;
}
