#include <bits/stdc++.h>
using namespace std;
long long r[200005], c[200005];
pair<long, long> d[200005];
bool f[200005];
int main() {
  long n, a, b;
  cin >> n >> a >> b;
  b = min(b, n);
  long long s = 0;
  long long m = 0;
  for (long i = 0; i < n; i++) {
    scanf("%lld", &r[i]);
    scanf("%lld", &c[i]);
  }
  for (long i = 0; i < n; i++) {
    s += c[i];
    d[i].first = max(0LL, r[i] - c[i]);
    d[i].second = i;
  }
  m = 0;
  sort(d, d + n);
  memset(f, 0, sizeof(f));
  for (long i = 0; i < b; ++i) {
    s += d[n - 1 - i].first;
    if (d[n - 1 - i].first) f[d[n - 1 - i].second] = 1;
  }
  if (b) {
    for (long i = 0; i < n; i++) {
      m = max(m,
              -(!f[i] * (d[n - b].first)) + (r[i] << a) - (f[i] ? r[i] : c[i]));
    }
  }
  cout << m + s << endl;
  return 0;
}
