




import os


def 		_lowerCamelCase				(					)			->		List[Any]:





  """simple docstring"""





  _lowercase: int						     =    os.path.dirname(os.path.realpath(UpperCamelCase							)							)
  _lowercase: Union[str, Any]						     =    os.path.join(UpperCamelCase					,     'triangle.txt'							)

  with open(UpperCamelCase							) as f:
    _lowercase: Tuple						     =    f.readlines()

  _lowercase: int						     =    [[int(UpperCamelCase							) for y in x.rstrip('\r\n'							).split(' '							)] for x in triangle]

  for i in range(1					,     len(UpperCamelCase							)							):
    for j in range(len(a[i]							)							):
      _lowercase: Dict						     =    a[i - 1][j] if j != len(a[i - 1]							) else 0
      _lowercase: List[str]						     =    a[i - 1][j - 1] if j > 0 else 0
      a[i][j] += max(UpperCamelCase					,     UpperCamelCase							)
  return max(a[-1]							)


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






import math


def 		_lowerCamelCase				(					UpperCamelCase							)			->		int:





  """simple docstring"""





  return sum(int(UpperCamelCase							) for digit in str(UpperCamelCase							)							)


def 		_lowerCamelCase				(					UpperCamelCase = 30							)			->		int:





  """simple docstring"""





  _lowercase: int						     =    []
  for digit in range(2					,     100							):
    for power in range(2					,     100							):
      _lowercase: int						     =    int(math.pow(UpperCamelCase					,     UpperCamelCase							)							)
      if digit == digit_sum(UpperCamelCase							):
        digit_to_powers.append(UpperCamelCase							)

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


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