#include <bits/stdc++.h>
using ll = long long;
using namespace std;
struct PrE {
  struct Item {
    int h, d;
  };
  void main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<Item> v(n);
    for (int i = 0; i < n; ++i) cin >> v[i].h >> v[i].d;
    sort(v.rbegin(), v.rend(),
         [](Item a, Item b) { return a.h - a.d < b.h - b.d; });
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
      if (i < b && v[i].h > v[i].d) {
        sum += v[i].h;
      } else {
        sum += v[i].d;
      }
    }
    ll ans = sum;
    if (!a || !b) return static_cast<void>(cout << ans);
    for (int i = 0; i < n; ++i) {
      ll x = v[i].h;
      for (int j = 0; j < a; ++j) x *= 2;
      if (i < b && v[i].h > v[i].d) {
        ll tmp = sum - v[i].h + x;
        ans = max(tmp, ans);
      } else if (i < b) {
        ll tmp = sum - v[i].d + x;
        ans = max(tmp, ans);
      } else {
        ll tmp = sum - v[i].d + x;
        if (v[b - 1].h > v[b - 1].d) tmp = tmp - v[b - 1].h + v[b - 1].d;
        ans = max(tmp, ans);
      }
    }
    cout << ans;
  }
};
int main() {
  PrE pr;
  pr.main();
}
