#include <bits/stdc++.h>
using namespace std;
bool cmp(vector<int> &i, vector<int> &j) {
  if (i[1] > j[1])
    return true;
  else if (i[1] == j[1]) {
    return i[0] > j[0];
  }
  return false;
}
class Solution {
 public:
  long long Solve(vector<vector<int>> &songs, int sz, int k) {
    sort(songs.begin(), songs.end(), cmp);
    long long pqsum = 0;
    long long ans = 0;
    priority_queue<int> pq;
    for (int i = 0; i < sz; i++) {
      pq.push(-songs[i][0]);
      pqsum += songs[i][0];
      if (pq.size() > k) {
        int top = -pq.top();
        pq.pop();
        pqsum -= top;
      }
      ans = max(ans, pqsum * songs[i][1]);
    }
    return ans;
  }
};
int main() {
  int sz, k;
  vector<vector<int>> songs;
  cin >> sz >> k;
  for (int i = 1; i <= sz; i++) {
    int l, b;
    cin >> l >> b;
    vector<int> v{l, b};
    songs.push_back(v);
  }
  Solution X;
  cout << X.Solve(songs, sz, k) << endl;
}
