# Arup Guha
# 7/23/2025
# Solution? to kattis Problem: Building Highways
# https://open.kattis.com/problems/buildinghighways

n = int(input())
vals = [int(x) for x in input().split()]
vals.sort()

# This is the answer due to the crucial fact about msts.
print(sum(vals)+(n-2)*vals[0])
