#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
inline int rd() {
  int first = 0;
  char p = getchar();
  while (p < '0' || p > '9') p = getchar();
  while (p >= '0' && p <= '9') first = first * 10 + p - '0', p = getchar();
  return first;
}
const int N = 1e6 + 10;
int n, a, b;
struct _ {
  long long a, b, c;
  void pr() { printf("a=%lld,b=%lld\n", a, b); }
  bool operator<(const _& rhs) const { return c > rhs.c; }
} e[N];
long long ans;
int vis[N];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &e[i].a, &e[i].b);
    e[i].c = e[i].a - e[i].b;
  }
  for (int i = 1; i <= n; ++i) ans += e[i].b;
  if (!b) return printf("%lld\n", ans), 0;
  if (b == 1) {
    long long t = 0;
    for (int i = 1; i <= n; ++i) t = max(t, (e[i].a << a) - e[i].b);
    return printf("%lld\n", ans + t), 0;
  }
  sort(e + 1, e + 1 + n);
  for (int i = 1; i <= n; ++i)
    if (e[i].a > e[i].b) vis[i] = 1;
  int cnt = 0;
  for (int i = 1; i <= b; ++i)
    if (vis[i]) ans += e[i].a - e[i].b, ++cnt;
  long long t = 0;
  for (int i = 1; i <= b; ++i) {
    if (vis[i])
      t = max(t, (e[i].a << a) - e[i].a);
    else
      t = max(t, (e[i].a << a) - e[i].b);
  }
  long long ret = ans + t;
  t = 0;
  for (int i = b + 1; i <= n; ++i) t = max(t, (e[i].a << a) - e[i].b);
  if (cnt < b)
    ret = max(ret, ans + t);
  else
    ret = max(ret, ans + t - e[b].a + e[b].b);
  printf("%lld\n", ret);
}
