#include <bits/stdc++.h>
using namespace std;
void FAST() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void solve() {}
pair<int, int> mp[300007];
long long sum[300007];
int main() {
  FAST();
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  for (int first = 0; first < n; ++first) {
    cin >> mp[first].second >> mp[first].first;
  }
  sort(mp, mp + n);
  int mn = INT_MAX;
  long long sum = 0;
  vector<int> v(k);
  for (int first = n - 1; first >= 0 && first >= n - k; --first) {
    mn = min(mn, mp[first].second);
    v.push_back(mp[first].second);
    sum += mp[first].second;
    ans = max(ans, sum * mp[first].first);
  }
  sort(v.begin(), v.end());
  for (int first = n - k - 1; first >= 0; --first) {
    if (mp[first].second > v[0]) {
      sum -= v[0];
      v[0] = mp[first].second;
      sort(v.begin(), v.end());
    }
    ans = max(ans, sum * mp[first].first);
  }
  cout << ans;
  return 0;
}
