#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long MAX = 200005;
const int MOD = 1000000000 + 7;
const long long INF = 20000;
const int nr[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int nc[] = {0, 0, 1, -1, 1, -1, 1, -1};
long long n, a, b, tx, t, ans, sum;
pair<long long, pair<long long, long long> > x[MAX];
int main() {
  cout << fixed << setprecision(9);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  b = min(b, n);
  tx = 1;
  for (int i = 1; i <= a; i++) tx *= 2;
  for (int i = 1; i <= n; i++)
    cin >> x[i].second.first >> x[i].second.second,
        x[i].first = min((long long)0, x[i].second.second - x[i].second.first),
        sum += x[i].second.second;
  if (!b) {
    cout << sum << endl;
    return 0;
  }
  sort(x + 1, x + 1 + n);
  for (int i = 1; i <= n; i++) x[i].first *= -1;
  for (int i = 1; i <= b; i++) t += x[i].first;
  for (int i = 1; i <= b; i++)
    ans =
        max(ans, t - x[i].first + x[i].second.first * tx - x[i].second.second);
  for (int i = b + 1; i <= n; i++)
    ans =
        max(ans, t - x[b].first + x[i].second.first * tx - x[i].second.second);
  cout << sum + ans << endl;
  return 0;
}
