#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first - a.second > b.first - b.second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  b = min(b, n);
  vector<pair<long long, long long>> vp(n);
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    vp[i] = {x, y};
  }
  sort(vp.begin(), vp.end(), cmp);
  long long mul = 1 << a;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += vp[i].second;
  }
  if (b == 0) {
    cout << ans;
    return 0;
  }
  for (int i = 0; i < b; i++) {
    if (vp[i].first > vp[i].second) {
      ans += vp[i].first - vp[i].second;
    }
  }
  long long fans = ans;
  for (int i = 0; i < n; i++) {
    long long temp = ans + max(mul * vp[i].first, vp[i].second) - vp[i].second;
    if (i < b) {
      temp -= max(0ll, vp[i].first - vp[i].second);
    } else {
      temp -= max(0ll, vp[b - 1].first - vp[b - 1].second);
    }
    fans = max(fans, temp);
  }
  cout << fans;
  return 0;
}
