import sys
input = sys.stdin.readline
n,t = map(int, input().split())
info = []
for _ in range(n):
info.append(list(map(int, input().split())))
info.sort(key=lambda x: (x[1], x[0]))
cnt = 0
for i in range(t-1, -1, -1):
if not info: break
cnt += info[-1][0] + info[-1][1] * i
info.pop()
print(cnt)