#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int M = 100005;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
struct P {
  long long h, d;
  bool operator<(const P& a) const { return h > a.h; }
} p[200005];
long long pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret *= a;
    a *= a;
    b >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, a, b, sum = 0, ss = 0, tp = 0, ans = 0, x = 0;
  cin >> n >> a >> b;
  long long t = pow(2, a);
  for (int i = 0; i < n; ++i) {
    cin >> p[i].h >> p[i].d;
    p[i].h = p[i].h - p[i].d;
    sum += p[i].d;
  }
  if (b == 0) {
    cout << sum << endl;
    return 0;
  }
  sort(p, p + n);
  for (int i = 0; i < b && i < n; ++i) {
    if (p[i].h > 0) ss += p[i].h;
  }
  for (int i = 0; i < n; ++i) {
    tp = sum - p[i].d;
    if ((p[i].h + p[i].d) * t > p[i].d)
      tp += (p[i].h + p[i].d) * t;
    else
      tp += p[i].d;
    if (i < b) {
      tp += ss;
      if (p[i].h > 0) tp -= p[i].h;
    } else if (p[b - 1].h <= 0)
      tp += ss;
    else
      tp += ss - p[b - 1].h;
    ans = max(ans, tp);
  }
  cout << ans << endl;
  return 0;
}
