"""simple docstring"""





from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
@dataclass
class  _snake_case     :
						snake_case__			  =			42
						snake_case__			  =			42

class  _snake_case     :






						def __init__(       self      :			List[str]							,					UpperCAmelCase      :			int    ):
													__lowerCamelCase					:		List[Any]		   =     [[] for _ in range(lowerCAmelCase__    )]
													__lowerCamelCase					:		Optional[int]		   =     size






						def __getitem__(       self      :			str							,					UpperCAmelCase      :			int    ):
													return iter(self._graph[vertex]    )






						@property
						def       lowerCamelCase__     (       self      :			Union[str, Any]    ):
													return self._size






						def       lowerCamelCase__     (       self      :			Optional[Any]							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			int    ):
													if weight not in (0, 1):
																				raise ValueError("Edge weight must be either 0 or 1."    )

													if to_vertex < 0 or to_vertex >= self.size:
																				raise ValueError("Vertex indexes must be in [0; size)."    )

													self._graph[from_vertex].append(Edge(lowerCAmelCase__							,					lowerCAmelCase__    )    )







						def       lowerCamelCase__     (       self      :			str							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			int    ):
													__lowerCamelCase					:		Union[str, Any]		   =     deque([start_vertex]    )
													__lowerCamelCase					:		Any		   =     [None] * self.size
													__lowerCamelCase					:		Tuple		   =     0

													while queue:
																				__lowerCamelCase					:		Any		   =     queue.popleft()
																				__lowerCamelCase					:		int		   =     distances[current_vertex]
																				if current_distance is None:
																											continue

																				for edge in self[current_vertex]:
																											__lowerCamelCase					:		List[str]		   =     current_distance + edge.weight
																											__lowerCamelCase					:		Tuple		   =     distances[edge.destination_vertex]
																											if (
																											    isinstance(lowerCAmelCase__							,					lowerCAmelCase__    )
																											    and new_distance >= dest_vertex_distance
																											):
																																		continue
																											__lowerCamelCase					:		Union[str, Any]		   =     new_distance
																											if edge.weight == 0:
																																		queue.appendleft(edge.destination_vertex    )
																											else:
																																		queue.append(edge.destination_vertex    )

													if distances[finish_vertex] is None:
																				raise ValueError("No path from start_vertex to finish_vertex."    )

													return distances[finish_vertex]


if __name__ == "__main__":
				import doctest

				doctest.testmod()

"""simple docstring"""





import os


def    lowercase_   (   ) ->      List[str]:



							'''simple docstring'''

							__lowerCamelCase					:		Union[str, Any]		   =     os.path.dirname(os.path.realpath(_lowerCamelCase      )      )
							__lowerCamelCase					:		int		   =     os.path.join(_lowerCamelCase						,   "triangle.txt"      )

							with open(_lowerCamelCase      ) as f:
														__lowerCamelCase					:		List[str]		   =     f.readlines()

							__lowerCamelCase					:		List[str]		   =     []
							for line in triangle:
														__lowerCamelCase					:		Optional[int]		   =     []
														for number in line.strip().split(" "      ):
																					numbers_from_line.append(int(_lowerCamelCase      )      )
														a.append(_lowerCamelCase      )

							for i in range(1						,   len(_lowerCamelCase      )      ):
														for j in range(len(a[i]      )      ):
																					__lowerCamelCase					:		int		   =     a[i - 1][j] if j != len(a[i - 1]      ) else 0
																					__lowerCamelCase					:		Union[str, Any]		   =     a[i - 1][j - 1] if j > 0 else 0
																					a[i][j] += max(_lowerCamelCase						,   _lowerCamelCase      )
							return max(a[-1]      )


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