#include <bits/stdc++.h>
using namespace std;
const int N = 300 * 1005;
struct node {
  long long h, d;
  bool friend operator<(node a, node b) { return (a.h - a.d) > (b.h - b.d); }
} f[N];
int main() {
  ios::sync_with_stdio(false);
  int n, a, b;
  while (cin >> n >> a >> b) {
    for (int i = 0; i < n; ++i) {
      cin >> f[i].h >> f[i].d;
    }
    sort(f, f + n);
    long long ans, sum = 0;
    int b1 = 0, add = 0;
    vector<int> vis(n, 0);
    for (int i = 0; i < n; ++i) {
      sum += f[i].d;
      if (b1 < b && f[i].h > f[i].d) {
        ++b1;
        add = f[i].h - f[i].d;
        sum += add;
        vis[i] = 1;
      }
    }
    ans = sum;
    if (a == 0 || b == 0) {
      cout << ans << endl;
      continue;
    }
    long long x = 1;
    while (a--) {
      x <<= 1;
    }
    for (int i = 0; i < n; ++i) {
      long long tmp = f[i].h * x - f[i].d;
      if (tmp <= 0) continue;
      if (vis[i]) {
        ans = max(ans, sum + tmp + f[i].d - f[i].h);
      } else {
        if (b1 < b) {
          ans = max(ans, sum + tmp);
        } else {
          ans = max(ans, sum + tmp - add);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
