#include <bits/stdc++.h>
using namespace std;
int n, a, b;
long long p[30];
long long rez, sum, init;
struct mon {
  long long h, d;
  int in;
} v[200005];
bool cmp2(mon x, mon y) { return (x.h - x.d) > (y.h - y.d); }
int main() {
  int i, in;
  cin >> n >> a >> b;
  p[0] = 1;
  for (i = 1; i <= a + 1; i++) p[i] = p[i - 1] * 2;
  for (i = 1; i <= n; i++) {
    cin >> v[i].h >> v[i].d;
    v[i].in = i;
  }
  if (b == 0) {
    for (i = 1; i <= n; i++) rez += v[i].d;
    cout << rez << "\n";
    return 0;
  }
  sort(v + 1, v + n + 1, cmp2);
  for (i = 1; i <= n; i++)
    if (i <= b)
      rez += max(v[i].d, v[i].h);
    else
      rez += v[i].d;
  init = rez;
  for (i = 1; i <= n; i++) {
    sum = init;
    in = v[i].in;
    if (i <= b) {
      sum -= max(v[i].d, v[i].h);
      sum += v[i].h * p[a];
    } else {
      sum += v[i].h * p[a];
      sum -= v[i].d;
      sum = sum - max(v[b].d, v[b].h) + v[b].d;
    }
    rez = max(sum, rez);
  }
  cout << rez << "\n";
  return 0;
}
