#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<pair<int64_t, int64_t>> v(n);
    for (auto &p : v) cin >> p.second >> p.first;
    sort(begin(v), end(v));
    reverse(begin(v), end(v));
    long long res = 0, sum = 0;
    multiset<int64_t> s;
    for (int i = 0; i < n; i++)
    {
        s.insert(v[i].second);
        sum += v[i].second;
        while (s.size() > k)
        {
            auto it = s.begin();
            sum -= *it;
            s.erase(s.begin());
        }
        res = max(res, sum * v[i].first);
    }
    cout << res << endl;
    return 0;
}
