






import os






def    UpperCamelCase__  (   )     ->		Any:







							"""simple docstring"""





							_a  :    List[str]			=						0
							_a  :    Dict			=						0
							with open(os.path.dirname(lowerCAmelCase_     ) + '''/p022_names.txt'''     ) as file:
														_a  :    List[Any]			=						str(file.readlines()[0]     )
														_a  :    str			=						name.replace('''"'''    ,	''''''     ).split(''','''     )

							name.sort()
							for i in range(len(lowerCAmelCase_     )     ):
														for j in name[i]:
																					temp_sum += ord(lowerCAmelCase_     ) - ord('''A'''     ) + 1
														total_sum += (i + 1) * temp_sum
														_a  :    List[Any]			=						0
							return total_sum


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







def 						UpperCAmelCase							(		lowerCAmelCase_							)						->						int:
     return sum(int(lowerCAmelCase_							) for digit in str(lowerCAmelCase_							)							)







def 						UpperCAmelCase							(		lowerCAmelCase_ = 3_0							)						->						int:
     a	:     Optional[int]						      =    []
     for digit in range(2    ,   1_0_0							):
          for power in range(2    ,   1_0_0							):
               a	:     List[str]						      =    int(math.pow(lowerCAmelCase_    ,   lowerCAmelCase_							)							)
               if digit == digit_sum(lowerCAmelCase_							):
                    digit_to_powers.append(lowerCAmelCase_							)

     digit_to_powers.sort()
     return digit_to_powers[n - 1]


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