A = [] B = [] N, M = map(int, input().strip().split(' ')) for i in range(N): a, b = map(int, input().strip().split(' ')) A.append(a) B.append(b) ans = None for k in range(1, N+1): score = 0 for i in range(k): score += max(A[i] * M, A[i] * (M - 1) + B[i], B[i]) max_score = score for i in range(k, N): score += max(A[i], B[i]) if score > max_score: max_score = score if ans is None: ans = max_score if max_score > ans: ans = max_score print(ans)