#include <bits/stdc++.h>
const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1000000;
const double eps = 1e-9;
const long long mod = 1e9 + 7;
using namespace std;
long long binpow(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans *= a;
    a *= a;
    n >>= 1;
  }
  return ans;
}
long long n, a, b;
long long hp[MAXN], dmg[MAXN], ans, mn = 1e18, pos, f[MAXN];
vector<pair<long long, long long> > v;
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; ++i) {
    cin >> hp[i] >> dmg[i];
  }
  for (int i = 1; i <= n; ++i) {
    v.push_back(make_pair(hp[i] - dmg[i], i));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); ++i) {
    if (hp[v[i].second] > dmg[v[i].second] && b > 0) {
      b--;
      f[v[i].second] = 1;
      ans += hp[v[i].second];
      if (mn > v[i].first) {
        mn = v[i].first;
        pos = i;
      }
    } else
      ans += dmg[v[i].second];
  }
  long long now = ans;
  long long ans1 = 0, ans2 = 0, ans3 = 0, ans4 = ans;
  for (int i = 0; i < v.size(); ++i) {
    if (f[v[i].second] == 1) {
      ans1 = max(ans1, now + hp[v[i].second] * binpow(2, a) - hp[v[i].second]);
    }
  }
  if (mn != 1e18) {
    for (int i = 0; i < v.size(); ++i) {
      if (f[v[i].second] == 0) {
        ans2 =
            max(ans2, now + hp[v[i].second] * binpow(2, a) - dmg[v[i].second] -
                          hp[v[pos].second] + dmg[v[pos].second]);
      }
    }
  }
  if (b) {
    for (int i = 0; i < v.size(); ++i) {
      if (f[v[i].second] == 0)
        ans3 =
            max(ans3, now + hp[v[i].second] * binpow(2, a) - dmg[v[i].second]);
    }
  }
  cout << max(ans1, max(ans3, max(ans4, ans2))) << "\n";
  return 0;
}
