#include <bits/stdc++.h>
using namespace std;
int inf = 1000000005;
long long int llinf = 2000000000000000005LL;
long long int mod = 1000000007;
long long int mod9 = 1000000009;
double PI = 3.1415926535897;
double eps = 1e-10;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}, dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
vector<bool> isprime;
vector<int> primes;
void seive(int n, bool wantlist = true) {
  isprime.resize(n + 1, true);
  isprime[0] = isprime[1] = false;
  int sq = sqrt(n + 1);
  for (int i = (2); i < (sq + 1); i++) {
    if (isprime[i]) {
      for (int j = i * i; j <= n; j += i) isprime[j] = false;
    }
  }
  for (int i = 2; wantlist && i <= n; i++) {
    if (isprime[i]) primes.push_back(i);
  }
}
template <class T>
inline T gcd(T a, T b) {
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
inline long long int bexp(long long int x, long long int n,
                          long long int m = mod) {
  long long int res = 1;
  x %= m;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
int main() {
  int n, k;
  scanf("%d", &n);
  ;
  scanf("%d", &k);
  ;
  vector<pair<int, int> > a(n);
  for (int i = (0); i < (n); i++) {
    scanf("%d", &a[i].second);
    ;
    scanf("%d", &a[i].first);
    ;
  }
  sort(a.begin(), a.end());
  long long int len = 0, ans = 0;
  multiset<int> st;
  for (int i = (n - 1); i >= (0); i--) {
    st.insert(a[i].second);
    len += a[i].second;
    if (st.size() > k) {
      len -= *st.begin();
      st.erase(st.begin());
    }
    ans = max(ans, len * a[i].first);
  }
  cout << ans << endl;
}
