#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
long long h[N], d[N];
multiset<long long> st;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1, n, i, j;
  int a, b;
  long long tot = 0;
  cin >> n >> a >> b;
  b = min(b, n);
  for (i = 0; i < n; i++) {
    cin >> h[i] >> d[i];
    tot += d[i];
    if (h[i] > d[i]) v.push_back(h[i] - d[i]);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  if (v.size() > b) v.resize(b);
  long long tot2 = 0, first = 0;
  if (v.size()) {
    for (auto ve : v) tot2 += ve;
    first = v[v.size() - 1];
  }
  for (auto ve : v) st.insert(ve);
  if (b == 0) {
    cout << tot << "\n";
  } else {
    long long cur = (1ll << a);
    long long mx = tot;
    for (i = 0; i < n; i++) {
      long long p = cur * h[i] - d[i] + tot;
      if (st.find(h[i] - d[i]) == st.end()) {
        if (v.size() < b)
          p += tot2;
        else
          p += (tot2 - first);
      } else {
        p += tot2 - (h[i] - d[i]);
      }
      mx = max(mx, p);
    }
    cout << mx << "\n";
  }
  return 0;
}
