#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
bool cmp(pair<long long, long long>& p1, pair<long long, long long>& p2) {
  return (p1.second * p2.first > p2.second * p1.first);
}
bool cmp2(pair<long long, long long>& p1, pair<long long, long long>& p2) {
  return (p1.second * p1.first > p2.second * p2.first);
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  t = 1;
  for (long long tc = 0; tc < t; tc++) {
    long long n, k;
    cin >> n >> k;
    vector<pair<long long, long long> > arr(n);
    for (long long i1 = 0; i1 < n; i1++) cin >> arr[i1].first >> arr[i1].second;
    sort(arr.begin(), arr.end(), cmp2);
    long long mn = arr[0].second, sum = arr[0].first;
    for (long long i = 1; i < n; i++) {
      if (min(mn, arr[i].second) * (sum + arr[i].first) <= mn * sum) continue;
      mn = min(mn, arr[i].second);
      sum += arr[i].first;
    }
    long long ans = sum * mn;
    cout << ans << "\n";
  }
  return 0;
}
