#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 50;
pair<int, int> a[N];
int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
        scanf("%d%d", &a[i].second, &a[i].first);
    sort(a, a + n);
    multiset<int> lens;
    long long sum = 0, ans = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        lens.insert(a[i].second);
        sum += a[i].second;
        while (lens.size() > k)
        {
            auto ite = lens.begin();
            sum -= *ite;
            lens.erase(ite);
        }
        ans = max(ans, sum * a[i].first);
    }
    printf("%lld", ans);
    return 0;
}