
Problem:
Get the greatest sum of numbers by adding given N numbers M times. But, the greatest number, among the numbers, can be added not over K times in a row.
큰 수의 법칙에 따라 가장 큰 수의 합을 구해라.
#input (ex: 5 8 3, 2 4 5 4 6)
n, m, k = map(int, input().split())
data = list(map(int, input().split()))
#Get the greatest number and the second greatest number
first = max(data)
data.remove(first)
second = max(data)
#Initialize the result
result = 0
# sum = (2) * (3) * 6 + (2) * 5
result = (m//k) * k * first + (m%k) * second
print(result)