
import heapq

def input_s():
    return raw_input()

def input_i():
    return int(raw_input())

def input_2_i():
    arr = map(int, raw_input().split())
    return arr[0], arr[1]

def input_3_i():
    arr = map(int, raw_input().split())
    return arr[0], arr[1], arr[2]

def input_i_array():
    return map(int, raw_input().split())

def get_presum(n, arr):
    presum = [arr[0]]
    for i in range(1, n):
        presum.append(presum[i - 1] + arr[i])
    return presum

def calc(n, k, songs):
    heap = []
    cnt_sum = 0
    ans = 0

    for i in range(n):
        b, a = songs[i]
        
        if i < k:
            heapq.heappush(heap, a)
            cnt_sum += a
        else:
            if a <= heap[0]:
                continue
            cnt_sum += a - heap[0]
            heapq.heappop(heap)
            heapq.heappush(heap, a)

        cnt_ans = b * cnt_sum
        ans = max(ans, cnt_ans)
            
    return ans

"""
4 3
4 7
15 1
3 6
6 8
"""

n, k = input_2_i()

songs = []
for i in range(n):
    a, b = input_2_i()
    songs.append((b, a))

new_songs = sorted(songs, reverse=True)
print calc(n, k, new_songs)
