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 = 0 for k in range(N): 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 max_score > ans: ans = max_score print(ans)