#include <bits/stdc++.h>
using namespace std;
const long long maxn = (long long)1e5 + 100;
const long long maxm = (long long)52;
const int LOGN = 22;
const long long INF = 1e15 + 10;
const long long MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-12;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long a, b;
  while (cin >> n >> a >> b) {
    vector<long long> hp(n), dm(n);
    for (int i = (0); i < ((n)); ++i) cin >> hp[i] >> dm[i];
    long long tot = accumulate((dm).begin(), (dm).end(), 0LL);
    if (b == 0) {
      cout << tot << endl;
      continue;
    }
    vector<pair<long long, long long> > diff(n);
    for (int i = (0); i < ((n)); ++i) {
      diff[i].first = hp[i] - dm[i];
      diff[i].second = i;
    }
    sort((diff).begin(), (diff).end());
    reverse((diff).begin(), (diff).end());
    int last = -1;
    set<int> vis;
    long long btot = 0;
    for (int i = (0); i < ((n)); ++i) {
      if (b && diff[i].first > 0) {
        --b;
        btot += diff[i].first;
        last = i;
        vis.insert(diff[i].second);
      }
    }
    long long mul = 1;
    for (int i = (0); i < ((a)); ++i) mul *= 2;
    long long ans = btot + tot;
    for (int i = (0); i < ((n)); ++i) {
      long long v = hp[i] * mul - dm[i];
      if (v < 0) continue;
      if (vis.count(i)) {
        long long tmp = btot - (hp[i] - dm[i]) + v + tot;
        (ans) = max((ans), (tmp));
      } else {
        if (b) {
          long long tmp = btot + v + tot;
          (ans) = max((ans), (tmp));
        } else {
          long long tmp = btot - diff[last].first + v + tot;
          (ans) = max((ans), (tmp));
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
