def getMinimumCost(k, c):
    c.sort(reverse=True)
    price = 0
    for i, cost in enumerate(c):
        price += ((i//k) +1) * cost
    
    return price


c = [2, 5, 6]
k = 2
result = getMinimumCost(k, c)
print(result)

e17189514ef5f1d8731e4ddd53a469648dd49fa7
<mask token>

def getMinimumCost(k, c):
    c.sort(reverse=True)
    price = 0
    for i, cost in enumerate(c):
        price += (i // k + 1) * cost
    return price


<mask token>

def getMinimumCost(k, c):
    c.sort(reverse=True)
    price = 0
    for i, cost in enumerate(c):
        price += (i // k + 1) * cost
    return price


<mask token>
print(result)

def getMinimumCost(k, c):
    c.sort(reverse=True)
    price = 0
    for i, cost in enumerate(c):
        price += (i // k + 1) * cost
    return price


c = [2, 5, 6]
k = 2
result = getMinimumCost(k, c)
print(result)

def getMinimumCost(k, c):
    c.sort(reverse=True)
    price = 0
    for i, cost in enumerate(c):
        price += ((i//k) +1) * cost
    
    return price


c = [2, 5, 6]
k = 2
result = getMinimumCost(k, c)
print(result)
