



def  UpperCAmelCase__    (    lowercase__						,       lowercase__						,       lowercase__						,       lowercase__   ):
						__lowercase	,			__lowercase					=				len(lowercase__   ), len(grid[0]   )
						if (
						    min(lowercase__						,       lowercase__   ) < 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(lowercase__						,       row + 1						,       lowercase__						,       lowercase__   )
						count += depth_first_search(lowercase__						,       row - 1						,       lowercase__						,       lowercase__   )
						count += depth_first_search(lowercase__						,       lowercase__						,       col + 1						,       lowercase__   )
						count += depth_first_search(lowercase__						,       lowercase__						,       col - 1						,       lowercase__   )

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


if __name__ == "__main__":
			import doctest

			doctest.testmod()










def  UpperCAmelCase__    (    lowercase__						,       lowercase__   ) ->      bool:
						__lowercase					=				len(lowercase__   )
						__lowercase					=				[[False] * (required_sum + 1) for _ in range(arr_len + 1   )]

						# for each arr value, a sum of zero(0) can be formed by not taking any element
						# hence True/1
						for i in range(arr_len + 1   ):
												__lowercase					=				True

						# sum is not zero and set is empty then false
						for i in range(1						,       required_sum + 1   ):
												__lowercase					=				False

						for i in range(1						,       arr_len + 1   ):
												for j in range(1						,       required_sum + 1   ):
																		if arr[i - 1] > j:
																								__lowercase					=				subset[i - 1][j]
																		if arr[i - 1] <= j:
																								__lowercase					=				subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

						return subset[arr_len][required_sum]


if __name__ == "__main__":
			import doctest

			doctest.testmod()





