def sum_Pairs(arr, n):
    arr.sort()
    total = 0
    for i in range(n):
        total += arr[i] * (2 * i - n + 1)
    return total