



from __future__ import annotations



def __lowerCAmelCase (     SCREAMING_SNAKE_CASE_  ):
			lowercase__					  =				len(SCREAMING_SNAKE_CASE_  ) // 2

			# choose the middle 3 elements
			lowercase__					  =				lst[m - 1 : m + 2]

			# if middle element is peak
			if three[1] > three[0] and three[1] > three[2]:
						return three[1]

			# if increasing, recurse on right
			elif three[0] < three[2]:
						if len(lst[:m]  ) == 2:
									m -= 1
						return peak(lst[m:]  )

			# decreasing
			else:
						if len(lst[:m]  ) == 2:
									m += 1
						return peak(lst[:m]  )


if __name__ == "__main__":
							import doctest

							doctest.testmod()









def __lowerCAmelCase (     SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_  ):
			lowercase__  ,       lowercase__					  =				len(SCREAMING_SNAKE_CASE_  ), len(grid[0]  )
			if (
			    min(SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_  ) < 0
			    or row == row_length
			    or col == col_length
			    or (row, col) in visit
			    or grid[row][col] == 1
			):
						return 0
			if row == row_length - 1 and col == col_length - 1:
						return 1

			visit.add((row, col)  )

			lowercase__					  =				0
			count += depth_first_search(SCREAMING_SNAKE_CASE_						,  row + 1						,  SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_  )
			count += depth_first_search(SCREAMING_SNAKE_CASE_						,  row - 1						,  SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_  )
			count += depth_first_search(SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_						,  col + 1						,  SCREAMING_SNAKE_CASE_  )
			count += depth_first_search(SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_						,  col - 1						,  SCREAMING_SNAKE_CASE_  )

			visit.remove((row, col)  )
			return count


if __name__ == "__main__":
							import doctest

							doctest.testmod()




