


'''simple docstring'''



import enum
import shutil
import sys


__UpperCAmelCase    :str				       =     shutil.get_terminal_size()

__UpperCAmelCase    :Optional[int]				       =     {"UP": "A", "DOWN": "B", "RIGHT": "C", "LEFT": "D"}



class 			a       (	enum.Enum ):


     """simple docstring"""






     SCREAMING_SNAKE_CASE :				Optional[int]							     =     0
     SCREAMING_SNAKE_CASE :				Union[str, Any]							     =     1




def 			_a			(		_lowercase      :			Union[str, Any]    ,      _lowercase      :			List[str]=""						):





     '''simple docstring'''






     sys.stdout.write(str(_lowercase						) + end						)
     sys.stdout.flush()




def 			_a			(		_lowercase      :			Optional[Any]    ,      _lowercase      :			str    ,      _lowercase      :			List[Any]=""						):





     '''simple docstring'''






     forceWrite(F'\u001b[{color}m{content}\u001b[0m'    ,      _lowercase						)




def 			_a			(		):





     '''simple docstring'''






     forceWrite('''\r'''						)




def 			_a			(		_lowercase      :			int    ,      _lowercase      :			str						):





     '''simple docstring'''






     forceWrite(F'\033[{num_lines}{CURSOR_TO_CHAR[direction.upper()]}'						)




def 			_a			(		):





     '''simple docstring'''






     forceWrite(''' ''' * TERMINAL_WIDTH						)
     reset_cursor()




def 			_a			(		):





     '''simple docstring'''






     reset_cursor()
     forceWrite('''-''' * TERMINAL_WIDTH						)








'''simple docstring'''



def 			_a			(		_lowercase      :			list[list[int]]    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			set						):





     '''simple docstring'''






     __UpperCAmelCase							,     __UpperCAmelCase			:				Any													=    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)						)

     __UpperCAmelCase			:				Optional[Any]													=    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()