#include <bits/stdc++.h>
const long long N = 1e6 + 10;
const long long mod = 1e9 + 7;
long long dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
using namespace std;
struct node {
  long long l, r, id;
} h[N];
set<pair<long long, long long> > s;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  srand(time(0));
  long long n, a, b;
  cin >> n >> a >> b;
  long long ans = 0;
  for (long long i = 1; i <= n; i++)
    cin >> h[i].l >> h[i].r, h[i].id = h[i].l - h[i].r, ans += h[i].r;
  if (b == 0) return cout << ans, 0;
  sort(h + 1, h + 1 + n, [](node a, node b) { return a.id > b.id; });
  for (long long i = 1; i <= b; i++)
    if (h[i].id < 0)
      break;
    else
      ans += h[i].id;
  long long t = ans, tt = ans;
  for (long long i = 1; i <= n; i++) {
    t = ans;
    if (i <= b) {
      t += max(h[i].l << a, h[i].r) - h[i].r;
      t -= max(0LL, h[i].id);
    } else {
      t += max(h[i].l << a, h[i].r) - h[i].r;
      t -= max(0LL, h[b].id);
    }
    tt = max(tt, t);
  }
  cout << tt << endl;
  return 0;
}
