


'''simple docstring'''



import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


__UpperCAmelCase    :Optional[Any]				       =     re.compile(r"^(?P<major>\d+)" r"\.(?P<minor>\d+)" r"\.(?P<patch>\d+)$")



@total_ordering
@dataclass
class 			a       :


     """simple docstring"""






     SCREAMING_SNAKE_CASE :				str
     SCREAMING_SNAKE_CASE :				Optional[str]							     =     None
     SCREAMING_SNAKE_CASE :				Optional[Union[str, int]]							     =     None
     SCREAMING_SNAKE_CASE :				Optional[Union[str, int]]							     =     None
     SCREAMING_SNAKE_CASE :				Optional[Union[str, int]]							     =     None

     def 				lowerCamelCase__				(       self  :	Tuple    )		->							str:
          __UpperCAmelCase			:				int													=    _str_to_version_tuple(self.version_str    )

     def __repr__(       self  :	str    )		->							Dict:
          return f'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'

     @property
     def 				lowerCamelCase__				(       self  :	str    )		->							List[Any]:
          return self.major, self.minor, self.patch

     def 				lowerCamelCase__				(       self  :	Tuple							,				snake_case  :	Tuple    )		->							Tuple:
          if isinstance(lowercase__							,				lowercase__    ):
               return Version(lowercase__    )
          elif isinstance(lowercase__							,				lowercase__    ):
               return other
          raise TypeError(f'{other} (type {type(lowercase__    )}) cannot be compared to version.'    )

     def __eq__(       self  :	str							,				snake_case  :	Optional[int]    )		->							int:
          try:
               __UpperCAmelCase			:				List[Any]													=    self._validate_operand(lowercase__    )
          except (TypeError, ValueError):
               return False
          else:
               return self.tuple == other.tuple

     def __lt__(       self  :	Dict							,				snake_case  :	Optional[int]    )		->							Dict:
          __UpperCAmelCase			:				Optional[Any]													=    self._validate_operand(lowercase__    )
          return self.tuple < other.tuple

     def __hash__(       self  :	int    )		->							List[Any]:
          return hash(_version_tuple_to_str(self.tuple    )    )

     @classmethod
     def 				lowerCamelCase__				(       cls  :	Union[str, Any]							,				snake_case  :	List[Any]    )		->							Optional[Any]:
          __UpperCAmelCase			:				Dict													=    {f.name for f in dataclasses.fields(cls    )}
          return cls(**{k: v for k, v in dic.items() if k in field_names}    )






     def 				lowerCamelCase__				(       self  :	str    )		->							List[str]:
          return self.version_str




def 			_a			(		_lowercase      :			Optional[Any]						):





     '''simple docstring'''






     __UpperCAmelCase			:				List[str]													=    _VERSION_REG.match(SCREAMING_SNAKE_CASE__						)
     if not res:
          raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'						)
     return tuple(int(SCREAMING_SNAKE_CASE__						) for v in [res.group('''major'''						), res.group('''minor'''						), res.group('''patch'''						)]						)




def 			_a			(		_lowercase      :			List[str]						):





     '''simple docstring'''






     return ".".join(str(SCREAMING_SNAKE_CASE__						) for v in version_tuple						)








'''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()