"""simple docstring"""







def     __UpperCAmelCase							(       UpperCAmelCase_       :							list[int]    )				->     int:

	'''simple docstring'''





	__snake_case     :				Optional[int] 						=					len(UpperCAmelCase__    )
	if n in (0, 1):
		return 0
	return sum(query * (n - i - 1) for i, query in enumerate(sorted(UpperCAmelCase__    )    )    )


if __name__ == "__main__":
	import doctest

	doctest.testmod()






"""simple docstring"""







def 	a__   (		UpperCAmelCase__							:      list[int]      )->						int:
						UpperCAmelCase__       						=		len(UpperCAmelCase__      )
						if n in (0, 1):
												return 0
						return sum(query * (n - i - 1) for i, query in enumerate(sorted(UpperCAmelCase__      )      )      )


if __name__ == "__main__":
						import doctest

						doctest.testmod()

