#include <bits/stdc++.h>
struct Monster {
  int64_t hp, dmg;
};
bool operator<(const Monster& lhs, const Monster& rhs) {
  return lhs.hp - lhs.dmg > rhs.hp - rhs.dmg;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  int64_t n, a, b;
  std::cin >> n >> a >> b;
  b = std::min(b, n);
  int64_t buff = 1 << a;
  int64_t initialSum = 0;
  std::vector<Monster> deltas(n);
  for (int64_t i = 0; i != n; ++i) {
    std::cin >> deltas[i].hp >> deltas[i].dmg;
    initialSum += deltas[i].dmg;
  }
  if (b == 0) {
    std::cout << initialSum << '\n';
    return 0;
  }
  std::sort(deltas.begin(), deltas.end());
  for (int64_t i = 0; i < b; ++i) {
    if (i == deltas.size()) break;
    if (deltas[i].hp > deltas[i].dmg) {
      initialSum += deltas[i].hp - deltas[i].dmg;
    }
  }
  int64_t answer = 0;
  for (int64_t i = 0; i < b; ++i) {
    if (i == deltas.size()) break;
    auto sum = initialSum;
    if (deltas[i].hp > deltas[i].dmg) {
      sum -= deltas[i].hp - deltas[i].dmg;
    }
    if (deltas[i].hp * buff > deltas[i].dmg) {
      sum += deltas[i].hp * buff - deltas[i].dmg;
    }
    answer = std::max(answer, sum);
  }
  for (int64_t i = b; i < deltas.size(); ++i) {
    auto sum = initialSum;
    if (deltas[b - 1].hp > deltas[b - 1].dmg) {
      sum -= deltas[b - 1].hp - deltas[b - 1].dmg;
    }
    if (deltas[i].hp * buff > deltas[i].dmg) {
      sum += deltas[i].hp * buff - deltas[i].dmg;
    }
    answer = std::max(answer, sum);
  }
  std::cout << answer << '\n';
}
