#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<ll, ll>;
const int MAXN = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);
template <typename T>
T max_self(T& a, T b) {
  if (a < b) a = b;
  return a;
}
template <typename T>
T min_self(T& a, T b) {
  if (a > b) a = b;
  return a;
}
template <typename T>
T add(T x, T y) {
  return ((x % MOD) + (y % MOD)) % MOD;
}
template <typename T>
T mul(T x, T y) {
  return ((x % MOD) * (long long)(y % MOD)) % MOD;
}
template <typename T>
T sub(T x, T y) {
  return add(x, -y + MOD);
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
inline int read() {
  char c = getchar();
  int num = 0, f = 1;
  for (; !isdigit(c); c = getchar()) f = c == '-' ? -1 : f;
  for (; isdigit(c); c = getchar()) num = num * 10 + c - '0';
  return num * f;
}
long long best = 0;
int n, k;
vector<pair<int, int>> songs;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  n = read(), k = read();
  for (int i = 0; i < n; ++i) {
    pair<int, int> p;
    p.second = read(), p.first = read();
    songs.push_back(p);
  }
  sort((songs).begin(), (songs).end());
  multiset<int> myset;
  long long sum = 0;
  long long res = 0;
  for (int i = n - 1; i >= 0; --i) {
    myset.insert(songs[i].second);
    sum += songs[i].second;
    while ((int)((myset).size()) > k) {
      auto it = myset.begin();
      sum -= *it;
      myset.erase(it);
    }
    res = max(res, sum * songs[i].first);
  }
  cout << res << "\n";
  return 0;
}
