#include <bits/stdc++.h>
using namespace std;
const int MAX_T = 1e6 + 1;
int cnt[MAX_T];
int main() {
  int N, K;
  cin >> N >> K;
  long long T, B;
  vector<pair<long long, long long> > song(N);
  vector<long long> s_len(N);
  for (int i = 0; i < N; i++) {
    cin >> T >> B;
    song[i] = pair<long long, long long>(B, T);
  }
  if (K == 1) {
    long long ans = 0;
    for (int i = 0; i < N; i++) {
      ans = max(ans, song[i].first * song[i].second);
    }
    cout << ans << endl;
    return 0;
  }
  sort(song.begin(), song.end());
  reverse(song.begin(), song.end());
  priority_queue<long long> PQ;
  long long sum_len = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    ans = max(ans, song[i].first * (song[i].second + sum_len));
    if (PQ.size() < K - 1) {
      sum_len += song[i].second;
      PQ.push(-song[i].second);
    } else if (PQ.top() < -song[i].second) {
      sum_len += PQ.top() + song[i].second;
      PQ.pop();
      PQ.push(-song[i].second);
    }
  }
  cout << ans << endl;
  return 0;
}
