#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
const int MAXN = 2e5 + 7;
int n, a, b;
pair<long long int, long long int> cre[MAXN];
long long int pre[MAXN];
void solve() {
  ____();
  cin >> n >> a >> b;
  b = min(n, b);
  for (int i = 1; i <= n; i++) cin >> cre[i].first >> cre[i].second;
  sort(cre + 1, cre + 1 + n,
       [&](pair<long long int, long long int> &a,
           pair<long long int, long long int> &b) {
         return a.first - a.second > b.first - b.second;
       });
  for (int i = 1; i <= n; i++)
    pre[i] = pre[i - 1] + max(0ll, cre[i].first - cre[i].second);
  long long int sum = 0, ret = 0;
  for (int i = 1; i <= n; i++) sum += cre[i].second;
  ret = sum + pre[b];
  sum += pre[b];
  for (int i = 1; i <= b; i++) {
    long long int ts = sum - max(0ll, cre[i].first - cre[i].second);
    ts -= cre[i].second;
    ret = max(ret, ts + (cre[i].first << a));
  }
  if (b) {
    for (int i = b + 1; i <= n; i++) {
      long long int ts = sum - max(0ll, cre[b].first - cre[b].second);
      ts -= cre[i].second;
      ret = max(ret, ts + (cre[i].first << a));
    }
  }
  cout << ret << endl;
}
int main() {
  solve();
  return 0;
}
