#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <typename T>
void chmax(T &x, const T &y) {
  if (x < y) x = y;
}
char readc() {
  char c;
  while ((c = getchar()) < '-')
    ;
  return c;
}
int read() {
  char c;
  while ((c = getchar()) < '-')
    ;
  if (c == '-') {
    int x = (c = getchar()) - '0';
    while ((c = getchar()) >= '0') x = x * 10 + c - '0';
    return -x;
  }
  int x = c - '0';
  while ((c = getchar()) >= '0') x = x * 10 + c - '0';
  return x;
}
const int N = 2e5 + 5;
pair<int, int> p[N];
long long s[N];
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; ++i) {
    p[i].first = read();
    p[i].second = read();
    p[i].first -= p[i].second;
  }
  sort(p + 1, p + n + 1, greater<pair<int, int> >());
  for (int i = 1; i <= n; ++i) s[i] = s[i - 1] + max(0, p[i].first);
  for (int i = n + 1; i <= b; ++i) s[i] = s[i - 1];
  long long ans = s[b];
  if (b)
    for (int i = 1; i <= n; ++i)
      chmax(ans, ((i < b) ? s[b] - max(0, p[i].first) : s[b - 1]) +
                     ((long long)(p[i].first + p[i].second) << a) -
                     p[i].second);
  for (int i = 1; i <= n; ++i) ans += p[i].second;
  cout << ans;
}
