#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, length, beauty;
  cin >> n >> k;
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    scanf("%d%d", &length, &beauty);
    mp.insert({beauty, length});
  }
  map<long long int, long long int>::reverse_iterator itr;
  long long int mk = k, mx = -1;
  long long int i = 0, sum = 0;
  set<long long int> st;
  long long int p;
  for (i = 1, itr = mp.rbegin(); i < k; i++, itr++) {
    p = (sum + itr->second) * (itr->first);
    if (p > mx) mx = p;
    st.insert(itr->second);
    sum += itr->second;
  }
  for (; itr != mp.rend(); itr++) {
    p = (long long int)(sum + itr->second) * (long long int)(itr->first);
    if (p > mx) mx = p;
    set<long long int>::iterator it;
    it = st.begin();
    if ((*it) < (itr->second)) {
      st.erase(it);
      st.insert(itr->second);
      sum = sum + (itr->second) - *it;
    }
  }
  cout << mx;
}
