

"""simple docstring"""




from __future__ import annotations

from collections.abc import MutableSequence
class      _UpperCAmelCase   :



	def __init__(  self     :       Optional[int]			,    _lowercase     :       int			,    _lowercase     :       MutableSequence[float]						):
		if len(_lowercase						) != degree + 1:
			raise ValueError(
			    '''The number of coefficients should be equal to the degree + 1.'''						)

		__UpperCAmelCase      		= list(_lowercase						)
		__UpperCAmelCase      		= degree



	def __add__(  self     :       Union[str, Any]			,    _lowercase     :       Polynomial						):

		if self.degree > polynomial_a.degree:
			__UpperCAmelCase      		= self.coefficients[:]
			for i in range(polynomial_a.degree + 1						):
				coefficients[i] += polynomial_a.coefficients[i]
			return Polynomial(self.degree			,    _lowercase						)
		else:
			__UpperCAmelCase      		= polynomial_a.coefficients[:]
			for i in range(self.degree + 1						):
				coefficients[i] += self.coefficients[i]
			return Polynomial(polynomial_a.degree			,    _lowercase						)



	def __sub__(  self     :       Optional[Any]			,    _lowercase     :       Polynomial						):
		return self + polynomial_a * Polynomial(0			,    [-1]						)



	def __neg__(  self     :       int						):
		return Polynomial(self.degree			,    [-c for c in self.coefficients]						)



	def __mul__(  self     :       int			,    _lowercase     :       Polynomial						):
		__UpperCAmelCase      		= [0] * (self.degree + polynomial_a.degree + 1)
		for i in range(self.degree + 1						):
			for j in range(polynomial_a.degree + 1						):
				coefficients[i + j] += (
				    self.coefficients[i] * polynomial_a.coefficients[j]
				)

		return Polynomial(self.degree + polynomial_a.degree			,    _lowercase						)



	def        a  (  self     :       List[Any]			,    _lowercase     :       int | float						):
		__UpperCAmelCase      		= 0
		for i in range(self.degree + 1						):
			result += self.coefficients[i] * (substitution**i)
		return result



	def __str__(  self     :       Tuple						):
		__UpperCAmelCase      		= ''''''
		for i in range(self.degree			,    -1			,    -1						):
			if self.coefficients[i] == 0:
				continue
			elif self.coefficients[i] > 0:
				if polynomial:
					polynomial += " + "
			else:
				polynomial += " - "

			if i == 0:
				polynomial += str(abs(self.coefficients[i]						)						)
			elif i == 1:
				polynomial += str(abs(self.coefficients[i]						)						) + "x"
			else:
				polynomial += str(abs(self.coefficients[i]						)						) + "x^" + str(_lowercase						)

		return polynomial



	def __repr__(  self     :       Optional[int]						):
		return self.__str__()



	def        a  (  self     :       Tuple						):
		__UpperCAmelCase      		= [0] * self.degree
		for i in range(self.degree						):
			__UpperCAmelCase      		= self.coefficients[i + 1] * (i + 1)
		return Polynomial(self.degree - 1			,    _lowercase						)



	def        a  (  self     :       Any			,    _lowercase     :       int | float = 0						):
		__UpperCAmelCase      		= [0] * (self.degree + 2)
		__UpperCAmelCase      		= constant
		for i in range(self.degree + 1						):
			__UpperCAmelCase      		= self.coefficients[i] / (i + 1)
		return Polynomial(self.degree + 1			,    _lowercase						)



	def __eq__(  self     :       Optional[int]			,    _lowercase     :       object						):
		if not isinstance(_lowercase			,    _lowercase						):
			return False

		if self.degree != polynomial_a.degree:
			return False

		for i in range(self.degree + 1						):
			if self.coefficients[i] != polynomial_a.coefficients[i]:
				return False

		return True



	def __ne__(  self     :       Any			,    _lowercase     :       object						):
		return not self.__eq__(_lowercase						)




"""simple docstring"""






import os





def 				A_       ( )					->  Any:
			with open(os.path.dirname(snake_case__		) + '''/p022_names.txt'''		) as file:
						_UpperCamelCase					:Optional[Any]					     =	str(file.readlines()[0]		)
						_UpperCamelCase					:Dict					     =	names.replace('''"'''       ,					''''''		).split(''','''		)

			names.sort()

			_UpperCamelCase					:str					     =	0
			_UpperCamelCase					:Union[str, Any]					     =	0

			for i, name in enumerate(snake_case__		):
						for letter in name:
									name_score += ord(snake_case__		) - 64

						total_score += (i + 1) * name_score
						_UpperCamelCase					:List[Any]					     =	0
			return total_score


if __name__ == "__main__":
					print(solution())

