"Template made by : https://codeforces.com/profile/c1729 , github repo : https://github.com/cheran-senthil/PyRival"
from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register

if sys.version_info[0] < 3:
    from io import BytesIO as stream
else:
    from io import StringIO as stream


if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip


def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n,k=map(int,input().split())
    l1=[]
    l2=[]
    for i in range(0,n):
        t,b=map(int,input().split())
        l1.append((b,t))
    l1.sort()
    l1=l1[::-1]
    sumt=[]
    for i in range(0,n):
        if i==0:
            sumt.append(l1[i][1])
        else :
            sumt.append(sumt[i-1]+l1[i][1])
    maxans=0
    
    for i in range(0,n):
        if i<=k:
            maxans=max(maxans,sumt[i]*l1[i][0])
        else :
            maxans=max(maxans,(sumt[k-2]+l1[i][1])*l1[i][0])
    print(maxans)
        
    
if __name__ == '__main__':
    sync_with_stdio(False)
    main()