#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
const int NMax = 2e4 + 5;
const ll inf_ll = 1e18 + 5;
const int inf_int = 1e9 + 5;
using zint = int;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  ll N, A, B;
  cin >> N >> A >> B;
  ll totalDamage = 0;
  vector<pair<ll, ll> > v(N + 1);
  for (int i = 1; i <= N; ++i) {
    cin >> v[i].first >> v[i].second;
    totalDamage += v[i].second;
  }
  if (B == 0) {
    cout << totalDamage;
    return 0;
  }
  auto cmp = [](const pair<ll, ll>& a, const pair<ll, ll>& b) {
    ll dif1 = a.first - a.second, dif2 = b.first - b.second;
    return dif1 > dif2;
  };
  sort(v.begin() + 1, v.end(), cmp);
  ll ans = totalDamage, idx = 1;
  while (idx <= N && idx <= B && (v[idx].first - v[idx].second) > 0) {
    ans += v[idx].first - v[idx].second;
    ++idx;
  }
  --idx;
  ll maxAdd = -1, pw = 1 << A;
  for (int i = 1; i <= idx; ++i) {
    ll add = (pw * v[i].first - v[i].second) - (v[i].first - v[i].second);
    maxAdd = max(maxAdd, add);
  }
  ll smallestAdd = v[idx].first - v[idx].second;
  for (int i = idx + 1; i <= N; ++i) {
    ll add = pw * v[i].first - v[i].second;
    if (idx == B) {
      add -= smallestAdd;
    }
    maxAdd = max(maxAdd, add);
  }
  if (maxAdd > 0) {
    ans += maxAdd;
  }
  cout << ans;
  return 0;
}
