#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e18 + 7;
const int inf = (int)1e9 + 9;
const double eps = 1e-7;
const int sz = 300;
const double pi = 3.14159265359;
long long n, sum, a, b, res, cur, delta_last;
pair<long long, long long> ar[200000];
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first - a.second > b.first - b.second;
}
int main() {
  scanf("%lld%lld%lld", &n, &a, &b);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &ar[i].first, &ar[i].second);
  }
  sort(ar, ar + n, cmp);
  for (int i = 0; i < n; ++i) {
    if (i < b)
      sum += max(ar[i].first, ar[i].second);
    else
      sum += ar[i].second;
  }
  if (b == 0) {
    printf("%lld", sum);
    return 0;
  }
  res = sum;
  for (int i = 0; i < n; ++i) {
    if (i < b) {
      sum -= max(ar[i].second, ar[i].first);
      cur = ar[i].first;
      for (int j = 0; j < a; ++j) cur <<= 1;
      cur = max(cur, ar[i].second);
      res = max(res, sum + cur);
      sum += max(ar[i].second, ar[i].first);
    } else {
      sum -= ar[i].second;
      cur = ar[i].first;
      for (int j = 0; j < a; ++j) cur <<= 1;
      if (cur <= ar[i].second)
        sum += ar[i].second;
      else {
        sum -= max(0LL, ar[b - 1].first - ar[b - 1].second);
        res = max(res, sum + cur);
        sum += ar[i].second;
        sum += max(0LL, ar[b - 1].first - ar[b - 1].second);
      }
    }
  }
  printf("%lld", res);
  return 0;
}
