"""simple docstring"""





import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey


def    lowercase_   (   _lowerCamelCase:	int						,   _lowerCamelCase:	int						,   _lowerCamelCase:	int						,   _lowerCamelCase:	int						,   _lowerCamelCase:	int						,   _lowerCamelCase:	int      ) ->      np.ndarray:



							'''simple docstring'''

							if (ksize % 2) == 0:
														__lowerCamelCase					:		Tuple		   =     ksize + 1
							__lowerCamelCase					:		str		   =     np.zeros((ksize, ksize)						,   dtype=np.floataa      )

							# each value
							for y in range(_lowerCamelCase      ):
														for x in range(_lowerCamelCase      ):
																					# distance from center
																					__lowerCamelCase					:		Optional[int]		   =     x - ksize // 2
																					__lowerCamelCase					:		Optional[Any]		   =     y - ksize // 2

																					# degree to radiant
																					__lowerCamelCase					:		Optional[Any]		   =     theta / 180 * np.pi
																					__lowerCamelCase					:		Union[str, Any]		   =     np.cos(_theta      )
																					__lowerCamelCase					:		Optional[int]		   =     np.sin(_theta      )

																					# get kernel x
																					__lowerCamelCase					:		Union[str, Any]		   =     cos_theta * px + sin_theta * py

																					# get kernel y
																					__lowerCamelCase					:		Tuple		   =     -sin_theta * px + cos_theta * py

																					# fill kernel
																					__lowerCamelCase					:		Optional[Any]		   =     np.exp(
																					    -(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)      ) * np.cos(2 * np.pi * _x / lambd + psi      )

							return gabor


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				# read original image
				__A  =				imread('''../image_data/lena.jpg''')
				# turn image in gray scale value
				__A  =				cvtColor(img, COLOR_BGR2GRAY)

				# Apply multiple Kernel to detect edges
				__A  =				np.zeros(gray.shape[:2])
				for theta in [0, 30, 60, 90, 120, 150]:
								__A  =				gabor_filter_kernel(10, 8, theta, 10, 0, 0)
								out += filteraD(gray, CV_8UC3, kernel_aa)
				__A  =				out / out.max() * 255
				__A  =				out.astype(np.uinta)

				imshow('''Original''', gray)
				imshow('''Gabor filter with 20x20 mask and 6 directions''', out)

				waitKey(0)
"""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())