n, m ,k = map(int, input().split())
numbers = list(map(int, input().split()))
numbers.sort()
# sort와 sorted함수 차이점
# sort()와 sorted()의 가장 큰 차이점은 sorted()는 리스트와 문자열 둘 다 적용이 가능하지만
# sort()는 리스트만 가능하다. sort()로 문자열을 정렬하면 error가 발생하니 주의
# 해당 부분에선 sorted를 사용해도 괜찮은지
#-> error (AttributeError: 'list' object has no attribute 'sorted'. Did you mean: 'sort'?)
# 리스트에 사용했는데 sorted 왜 에러?
#-> sorted 함수는 정렬된 결괏값을 입력값에 바로 반영하지 않는 것이 특징.
#즉, sorted 함수를 활용해 입력값을 정렬한 결과는 얻을 수 있지만,
#결괏값을 입력값에 따로 할당하지 않는 이상 입력값은 정렬되지 않음.
# https://heytech.tistory.com/61 참조
max1 = numbers[-1]
max2 = numbers[-2]
count = int(m / (k+1)) * k
count += m % (k+1)
result = 0
result += ((count) * max1)
result += ((m-count) * max2)
print(result)
-> 반복되는 수열에 대해서 파악.