


"""simple docstring"""



def     UpperCAmelCase    (					_lowercase   :      int  )	->   int:


	"""simple docstring"""




	if number != int(_lowercase  ):
		raise ValueError('''factorial() only accepts integral values'''  )
	if number < 0:
		raise ValueError('''factorial() not defined for negative values'''  )
	lowerCAmelCase_			       = 1
	for i in range(1 ,      number + 1  ):
		value *= i
	return value
def     UpperCAmelCase    (					_lowercase   :      int  )	->   int:


	"""simple docstring"""




	if not isinstance(_lowercase ,      _lowercase  ):
		raise ValueError('''factorial() only accepts integral values'''  )
	if n < 0:
		raise ValueError('''factorial() not defined for negative values'''  )
	return 1 if n == 0 or n == 1 else n * factorial(n - 1  )


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			lowercase_							 =       int(input('Enter a positive integer: ').strip() or 0)
			print(f"""factorial{n} is {factorial(n)}""")



"""simple docstring"""



def     UpperCAmelCase    (					_lowercase   :      list[int]  )	->   int:


	"""simple docstring"""




	lowerCAmelCase_			       = len(_lowercase  )
	if n in (0, 1):
		return 0
	return sum(query * (n - i - 1) for i, query in enumerate(sorted(_lowercase  )  )  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()