"""simple docstring"""
import os







def 		__a  (      )      ->Tuple:
  a__:	Any     				=      os.path.dirname(os.path.realpath(_SCREAMING_SNAKE_CASE  )  )
  a__:	Tuple     				=      os.path.join(_SCREAMING_SNAKE_CASE						,	'triangle.txt'  )

  with open(_SCREAMING_SNAKE_CASE  ) as f:
    a__:	Dict     				=      f.readlines()

  a__:	Tuple     				=      [[int(_SCREAMING_SNAKE_CASE  ) for y in x.rstrip('\r\n'  ).split(' '  )] for x in triangle]

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


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



"""simple docstring"""
def 		__a  (      _SCREAMING_SNAKE_CASE = 100						,	_SCREAMING_SNAKE_CASE = 100  )      ->int:
  return max(
      sum(int(_SCREAMING_SNAKE_CASE  ) for x in str(base**power  )  )
      for base in range(_SCREAMING_SNAKE_CASE  )
      for power in range(_SCREAMING_SNAKE_CASE  )  )


# Tests
if __name__ == "__main__":
 import doctest

 doctest.testmod()


