#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int arr1[n], arr2[n];
    multimap<long long int, long long int> mp;
    long long int j;
    for (j = 0; j < n; j++) {
      long long int x, y;
      cin >> x >> y;
      mp.insert({y, x});
    }
    long long int ptr = 0;
    for (auto &p : mp) {
      arr1[ptr] = p.second;
      arr2[ptr] = p.first;
      ptr++;
    }
    long long int answer = 0;
    long long int sum = 0;
    multiset<long long int> st;
    for (j = n - 1; j >= n - k; j--) {
      st.insert(arr1[j]);
      sum += arr1[j];
      long long int val2 = arr2[j];
      long long int here = sum * val2;
      answer = max(answer, here);
    }
    sum -= *(st.begin());
    st.erase(st.begin());
    for (j = n - k - 1; j >= 0; j--) {
      long long int sum2 = sum + arr1[j];
      long long int val2 = arr2[j];
      long long int here = sum2 * val2;
      answer = max(answer, here);
      auto it = st.begin();
      if (it != st.end() && *it < arr1[j]) {
        sum += (arr1[j] - *it);
        st.erase(it);
        st.insert(arr1[j]);
      }
    }
    cout << answer << endl;
  }
}
