#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
const int dxx[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          dyy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long mod = 1000000007;
const int base = 311;
const int N = 2e5 + 5;
int n, a, b;
long long ans = 0;
int used[N], hp[N], dmg[N];
pair<int, int> c[N];
void gogo() {
  cin >> n >> a >> b;
  for (int i = 1; i <= n; ++i) {
    cin >> hp[i] >> dmg[i];
  }
  if (b == 0) {
    for (int i = 1; i <= n; ++i) ans += dmg[i];
    cout << ans;
    return;
  }
  for (int i = 1; i <= n; ++i) {
    c[i] = make_pair(hp[i] - dmg[i], i);
  }
  sort(c + 1, c + n + 1, greater<pair<int, int> >());
  long long temp = 0, dung = 0, mn = 1e15;
  for (int i = 1; i <= n; ++i) {
    if (c[i].first > 0) {
      if (dung < b) {
        ++dung;
        temp += hp[c[i].second];
        mn = min(mn, (long long)c[i].first);
        used[c[i].second] = 1;
      } else
        temp += dmg[c[i].second];
    } else
      temp += dmg[c[i].second];
  }
  ans = temp;
  for (int i = 1; i <= n; ++i) {
    if (used[i]) {
      long long tam = (1LL << a) * hp[i];
      ans = max(ans, temp - hp[i] + tam);
    } else {
      long long tam = (1LL << a) * hp[i];
      if (dung < b)
        ans = max(ans, temp - dmg[i] + tam);
      else
        ans = max(ans, temp - dmg[i] - mn + tam);
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("sol"
            ".inp",
            "r")) {
    freopen(
        "sol"
        ".inp",
        "r", stdin);
    freopen(
        "sol"
        ".out",
        "w", stdout);
  }
  gogo();
  return 0;
}
