#include <bits/stdc++.h>
using namespace std;
long long int n, H[200009], D[200009], mn, A;
bool vis[200009];
vector<pair<long long int, long long int> > temp;
int main() {
  long long int a, b, c, d, e, i, j, k, l, m, x, y, t, p;
  long long int ans = 0;
  scanf("%lld%lld%lld", &n, &a, &b);
  for (i = 0; i < n; i++) {
    scanf("%lld%lld", &H[i], &D[i]);
    ans += D[i];
    temp.push_back({H[i] - D[i], i});
  }
  if (b == 0) {
    printf("%lld\n", ans);
    return 0;
  }
  A = powl(2, a);
  sort(temp.rbegin(), temp.rend());
  c = 0;
  mn = 8e18;
  for (i = 0; i < n; i++) {
    j = temp[i].second;
    x = temp[i].first;
    if (x > 0 && c < b) {
      vis[j] = true;
      ans += x;
      c++;
      mn = min(mn, x);
    } else {
      break;
    }
  }
  if (mn == 8e18) {
    mn = 0;
  }
  x = 0;
  for (i = 0; i < n; i++) {
    if (vis[i] == true) {
      y = (A * H[i]) - H[i];
    } else {
      if (c < b) {
        y = (A * H[i]) - D[i];
      } else {
        y = (A * H[i]) - D[i] - mn;
      }
    }
    x = max(x, y);
  }
  ans += x;
  cout << ans << endl;
}
