#include <bits/stdc++.h>
using namespace std;
long long dp[300000][30];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  vector<long long> hp(n), dmg(n);
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> hp[i] >> dmg[i];
    sum += dmg[i];
  }
  if (b == 0) {
    cout << sum;
    return 0;
  }
  long long mult = 1 << a;
  vector<pair<long long, long long> > gain;
  for (long long i = 0; i < n; i++) {
    if (hp[i] > dmg[i]) {
      gain.push_back({hp[i] - dmg[i], i});
    }
  }
  sort(gain.rbegin(), gain.rend());
  vector<long long> mark(n, 0);
  if (b > gain.size()) b = gain.size() + 1;
  for (long long i = 0; i < b - 1; i++) {
    sum += gain[i].first;
    mark[gain[i].second] = 1;
  }
  long long mxsum = sum;
  for (long long i = 0; i < n; i++) {
    long long add = 0;
    if (mark[i]) {
      if (!(b == gain.size() + 1)) add += gain[b - 1].first;
      add -= hp[i] - dmg[i];
    }
    if (mult * hp[i] > dmg[i]) add += mult * hp[i] - dmg[i];
    mxsum = max(mxsum, sum + add);
  }
  cout << mxsum;
  return 0;
}
