#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
bool comp(pair<long long, long long> i1, pair<long long, long long> i2) {
  return i1.second > i2.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > v(n + 2);
  for (long long i = 0; i < n + 1; i++) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin(), v.end(), comp);
  multiset<long long> s;
  long long sum = 0, res, max1 = 0;
  for (long long i = 0; i < n; i++) {
    if (i < k) {
      s.insert(v[i].first);
      sum += v[i].first;
    } else {
      auto it = s.begin();
      long long k = *it;
      s.erase(it);
      sum -= k;
      sum += v[i].first;
      s.insert(max(k, v[i].first));
      sum += max(k - v[i].first, 0ll);
    }
    res = v[i].second * sum;
    max1 = max(max1, res);
  }
  cout << max1;
}
