





from __future__ import annotations





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				list[int]:







	'''simple docstring'''







	assert len(__snake_case							) == len(__snake_case							)

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

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

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










import os





def lowerCAmelCase__()    ->				Optional[Any]:







	'''simple docstring'''







	lowerCamelCase__        =		os.path.dirname(os.path.realpath(__snake_case							)							)
	lowerCamelCase__        =		os.path.join(__snake_case	,'''triangle.txt'''							)

	with open(__snake_case							) as f:
		lowerCamelCase__        =		f.readlines()

	lowerCamelCase__        =		[[int(__snake_case							) for y in x.rstrip('''\r\n'''							).split(''' '''							)] for x in triangle]

	for i in range(1	,len(__snake_case							)							):
		for j in range(len(a[i]							)							):
			lowerCamelCase__        =		a[i - 1][j] if j != len(a[i - 1]							) else 0
			lowerCamelCase__        =		a[i - 1][j - 1] if j > 0 else 0
			a[i][j] += max(__snake_case	,__snake_case							)
	return max(a[-1]							)


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



