#include <bits/stdc++.h>
using namespace std;
int n, a, b;
long long h[200005], d[200005];
int p[200005];
inline long long calc(int k) { return h[k] * (1LL << a) - d[k]; }
int cmp(int x, int y) { return h[x] - d[x] > h[y] - d[y]; }
long long add, tmp, res, sum;
void solve() {
  res = sum;
  sum = sum + add;
  for (int i = 0; i < n; i++) {
    if (i < b) {
      long long g = h[p[i]] - d[p[i]];
      if (g > 0) add -= g;
      sum = max(sum, res + add + h[p[i]] * (1LL << a) - d[p[i]]);
      if (g > 0) add += g;
    } else if (b > 0) {
      long long g = h[p[b - 1]] - d[p[b - 1]];
      if (g > 0) add -= g;
      sum = max(sum, res + add + h[p[i]] * (1LL << a) - d[p[i]]);
      if (g > 0) add += g;
    }
  }
  sum = max(sum, res + add);
  printf("%lld\n", sum);
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &h[i], &d[i]);
    p[i] = i, sum += d[i];
  }
  sort(p, p + n, cmp);
  for (int i = 0; i < min(n, b); i++) {
    if (h[p[i]] - d[p[i]] <= 0) {
      break;
    } else
      add += h[p[i]] - d[p[i]];
  }
  solve();
  return 0;
}
