# AC
import sys
from heapq import heappush, heappop


class Main:
    def __init__(self):
        self.buff = None
        self.index = 0

    def next(self):
        if self.buff is None or self.index == len(self.buff):
            self.buff = sys.stdin.readline().split()
            self.index = 0
        val = self.buff[self.index]
        self.index += 1
        return val

    def next_int(self):
        return int(self.next())

    def cal(self, s):
        if len(s) == 1:
            return s[0]
        if s[0] == 0:
            return self.cal(s[1:])
        v = 1
        for c in s:
            v *= c
        return v

    def solve(self):
        n = self.next_int()
        k = self.next_int()
        rs = sorted([(self.next_int(), self.next_int()) for _ in range(0, n)],  key=lambda x: x[1], reverse=True)
        heap = []
        sum = 0
        ans = 0
        for x, b in rs:
            heappush(heap, x)
            sum += x
            if len(heap) > k:
                sum -= heappop(heap)
            ans = max(ans, sum * b)
        print(ans)


if __name__ == '__main__':
    Main().solve()
