#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long a, b;
  cin >> a >> b;
  b = min(b, n);
  vector<pair<long long, long long> > creature(n);
  long long total_beg = 0;
  for (long long i = 0; i < n; i++) {
    cin >> creature[i].first >> creature[i].second;
    total_beg += creature[i].second;
  }
  vector<long long> poss(n);
  long long null = 0;
  for (long long i = 0; i < n; i++) {
    poss[i] = max(null, creature[i].first - creature[i].second);
  }
  sort(poss.begin(), poss.end());
  reverse(poss.begin(), poss.end());
  if (b == 0) {
    cout << total_beg << "\n";
    return 0;
  }
  long long total_plus = 0;
  for (long long i = 0; i + 1 < b; i++) {
    total_plus += poss[i];
  }
  long long max_total = total_plus + total_beg + poss[b - 1];
  for (long long i = 0; i < n; i++) {
    long long new_total = total_plus + total_beg;
    long long new_health = (1 << a) * creature[i].first;
    if (creature[i].first - creature[i].second > poss[b - 1]) {
      new_total +=
          min(-creature[i].first + creature[i].second, null) + poss[b - 1];
    }
    new_total += new_health - creature[i].second;
    max_total = max(max_total, new_total);
  }
  cout << max_total << "\n";
}
