class Solution: def maximizeSum(self, nums: List[int], k: int) -> int: first = max(nums) last = first + (k - 1) * 1 return (k * (first + last)) // 2