#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long RandInt(long long min, long long max) {
  if (max < min) swap(min, max);
  random_device rd;
  mt19937 mt(rd());
  uniform_int_distribution<long long> dist(min, max);
  return dist(mt);
}
const long long maxn = 4e5, mod = 1e9 + 7, inf = 1e18;
const long double eps = 1e-9, pi = 3.141592653589793238462643;
const long long N = 200010;
struct node {
  long long x, y, d;
};
node c[maxn];
bool cmp(node x, node y) { return x.d > y.d; }
void solve() {
  long long n, a, b, t = 0, ans = 0, s = 0;
  cin >> n >> a >> b;
  if (b > n) b = n;
  for (long long i = 1; i <= n; i++) {
    cin >> c[i].x >> c[i].y;
    c[i].d = max(c[i].x - c[i].y, 0ll);
    s += c[i].y;
  }
  sort(c + 1, c + n + 1, cmp);
  for (long long i = 1; i <= b; i++) t += c[i].d;
  for (long long i = 1; i <= b; i++) {
    long long t1 = c[i].x << a;
    ans = max(ans, t - c[i].d + t1 - c[i].y);
  }
  for (long long i = b + 1; i <= n; i++) {
    long long t1 = c[i].x << a;
    ans = max(ans, t - c[b].d + t1 - c[i].y);
  }
  if (!b) ans = 0;
  cout << s + ans << "\n";
}
signed main() {
  srand(time(0));
  cout.precision(10);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
