#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 2e5 + 5;
const long double pi = 3.14159265359;
void SRAND() {
  auto duration = std::chrono::system_clock::now().time_since_epoch();
  auto millis =
      std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
  srand(millis);
}
long long n, a, b, ans, sa, sb, x, y;
vector<pair<long long, long long> > v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> b;
  b = min(b, n);
  for (long long i = 0; i < n; i++) cin >> x >> y, v.push_back(make_pair(x, y));
  sort(v.begin(), v.end(),
       [](pair<long long, long long> ta, pair<long long, long long> tb) {
         return (ta.first - ta.second > tb.first - tb.second);
       });
  for (long long i = 0; i < n; i++) sa += v[i].second, sb += v[i].second;
  for (long long i = 0; i < b - 1; i++)
    sa += (v[i].first > v[i].second ? v[i].first - v[i].second : 0);
  for (long long i = 0; i < b; i++)
    sb += (v[i].first > v[i].second ? v[i].first - v[i].second : 0);
  ans = max(ans, sb);
  if (b == 0) {
    cout << sa;
    return 0;
  }
  for (long long i = 0; i < b; i++) {
    ans = max(ans,
              sb - (v[i].first > v[i].second ? v[i].first - v[i].second : 0) +
                  (v[i].first * (1LL << a)) - v[i].second);
  }
  for (long long i = b; i < n; i++) {
    ans = max(ans, sa + (v[i].first * (1LL << a) - v[i].second));
  }
  cout << ans << "\n";
  return 0;
}
