#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const long double eps = 1e-9;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
bool compare(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second > p2.second;
}
signed main() {
  long long n, k;
  cin >> n >> k;
  pair<long long, long long> p[n];
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    p[i] = make_pair(x, y);
  }
  sort(p, p + n, compare);
  set<pair<long long, long long> > s;
  long long ans = 0, sum = 0, min1 = INT_MAX;
  for (long long i = 0; i < n; i++) {
    s.insert(make_pair(p[i].first, i));
    sum += p[i].first;
    if (s.size() > k) {
      auto f = s.begin();
      sum -= f->first;
      s.erase(f);
    }
    ans = max(ans, sum * p[i].second);
  }
  cout << ans;
}
