#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
using ll = long long;
struct node {
  ll hp, dmp, d;
  bool operator<(const node &t) const { return d > t.d; }
} x[maxn];
ll sumd[maxn];
int n, a, b;
int main() {
  cin >> n >> a >> b;
  b = min(b, n);
  ll tmp = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x[i].hp >> x[i].dmp;
    x[i].d = x[i].hp - x[i].dmp > 0 ? x[i].hp - x[i].dmp : 0;
    tmp += x[i].dmp;
  }
  if (b == 0) {
    cout << tmp << endl;
    return 0;
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i <= n; i++) sumd[i] = sumd[i - 1] + x[i].d;
  ans = max(ans, sumd[b] + tmp);
  for (int i = 1; i <= n; i++) {
    if (i <= b) {
      ans = max(ans, tmp + x[i].hp * (1ll << a) - x[i].dmp + sumd[b] - sumd[i] +
                         sumd[i - 1]);
    } else {
      ans = max(ans, tmp + x[i].hp * (1ll << a) - x[i].dmp + sumd[b - 1]);
    }
  }
  cout << ans << endl;
}
