


import os






def 				UpperCamelCase      (			)     ->						Union[str, Any]:
  """simple docstring"""




  lowercase__      =	os.path.dirname(os.path.realpath(lowercase__  )  )
  lowercase__      =	os.path.join(lowercase__					,					"""triangle.txt"""  )

  with open(lowercase__  ) as in_file:
    lowercase__      =	[[int(lowercase__  ) for i in line.split()] for line in in_file]

  while len(lowercase__  ) != 1:
    lowercase__      =	triangle.pop()
    lowercase__      =	triangle[-1]
    for j in range(len(lowercase__  ) - 1  ):
      curr_row[j] += max(last_row[j]					,					last_row[j + 1]  )
  return triangle[0][0]


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





from __future__ import annotations






def 				UpperCamelCase      (			__magic_name__  :							list[list[int]]					,					__magic_name__  :							list[list[int]]  )     ->						list[int]:
		"""simple docstring"""




		assert len(__magic_name__  ) == len(__magic_name__  )

		lowercase__      =	len(__magic_name__  )
		lowercase__      =	list(range(__magic_name__  )  )
		lowercase__      =	[-1] * n  # who the donor has donated to
		lowercase__      =	[-1] * n  # who the recipient has received from
		lowercase__      =	[0] * n

		while unmatched_donors:
				lowercase__      =	unmatched_donors[0]
				lowercase__      =	donor_pref[donor]
				lowercase__      =	donor_preference[num_donations[donor]]
				num_donations[donor] += 1
				lowercase__      =	recipient_pref[recipient]
				lowercase__      =	rec_record[recipient]

				if prev_donor != -1:
						if rec_preference.index(__magic_name__  ) > rec_preference.index(__magic_name__  ):
								lowercase__      =	donor
								lowercase__      =	recipient
								unmatched_donors.append(__magic_name__  )
								unmatched_donors.remove(__magic_name__  )
				else:
						lowercase__      =	donor
						lowercase__      =	recipient
						unmatched_donors.remove(__magic_name__  )
		return donor_record

