#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
long long fac[1] = {1}, inv[1] = {1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mp(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
long long cmb(long long r, long long c) {
  return (c > r || c < 0) ? 0 : fac[r] * inv[c] % MOD * inv[r - c] % MOD;
}
pair<long long, long long> vec[200000];
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  long long sum = 0;
  for (int i = 0; i < n; i++)
    scanf("%lld %lld", &vec[i].first, &vec[i].second), sum += vec[i].second;
  sort(vec, vec + n,
       [](pair<long long, long long> a, pair<long long, long long> b) {
         return a.first - a.second > b.first - b.second;
       });
  if (b == 0) return !printf("%lld", sum);
  long long rhq = 1;
  while (a--) rhq *= 2;
  int cnt = 0;
  for (int i = 0; i < min(n, b); i++)
    if (vec[i].first > vec[i].second)
      sum += vec[i].first - vec[i].second, cnt++;
  long long ans = sum;
  for (int i = 0; i < n; i++) {
    long long tmp = sum;
    if (i < cnt) {
      tmp -= vec[i].first - vec[i].second;
      long long rk = vec[i].first * rhq - vec[i].second;
      ans = max(ans, rk + tmp);
    } else {
      if (b == cnt) tmp -= vec[cnt - 1].first - vec[cnt - 1].second;
      long long rk = vec[i].first * rhq - vec[i].second;
      ans = max(ans, rk + tmp);
    }
  }
  printf("%lld", ans);
}
