#include <bits/stdc++.h>
using namespace std;
long long cr[200005][2];
vector<pair<long long, int>> diff;
bool sw[200005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b, lastB = -1, spl1 = -1;
  long long sum = 0;
  cin >> n >> a >> b;
  diff.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> cr[i][0] >> cr[i][1];
    diff[i] = {cr[i][0] - cr[i][1], i};
  }
  sort(diff.begin(), diff.end());
  reverse(diff.begin(), diff.end());
  for (int i = 0; i < n; i++) {
    if (b && diff[i].first > 0) {
      sum += cr[diff[i].second][0];
      b--;
      sw[diff[i].second] = 1;
      lastB = diff[i].second;
    } else {
      sum += cr[diff[i].second][1];
    }
  }
  long long tmpS = sum;
  if (b) {
    for (int i = 0; i < n; i++)
      sum = max(sum,
                tmpS + ((1 << a) * cr[i][0]) - (sw[i] ? cr[i][0] : cr[i][1]));
  } else if (lastB != -1) {
    for (int i = 0; i < n; i++)
      sum = max(sum, (sw[i] ? tmpS : tmpS - cr[lastB][0] + cr[lastB][1]) +
                         ((1 << a) * cr[i][0]) - (sw[i] ? cr[i][0] : cr[i][1]));
  }
  cout << sum << endl;
}
