# Arup Guha
# 1/20/2026
# CF Div 4 Round 1074
# Problem B: Prefix Max
# https://codeforces.com/contest/2185/problem/B

# Get number of cases.
nC = int(input())

# Process cases.
for i in range(nC):

    # Get length of list.
    n = int(input())

    # Get list.
    vals = [int(x) for x in input().split()]

    # Python makes this easy (swap max to first is best strategy)
    print(n*max(vals))
