


from __future__ import annotations





def   _UpperCAmelCase       (     UpperCAmelCase      :			tuple[int, int]						,	UpperCAmelCase      :			int      ):
      """simple docstring"""




      __lowerCamelCase						, __lowerCamelCase     :      Optional[Any]       						=						position
      __lowerCamelCase     :      Optional[Any]       						=						[
          (y + 1, x + 2),
          (y - 1, x + 2),
          (y + 1, x - 2),
          (y - 1, x - 2),
          (y + 2, x + 1),
          (y + 2, x - 1),
          (y - 2, x + 1),
          (y - 2, x - 1),
      ]
      __lowerCamelCase     :      Optional[int]       						=						[]

      for position in positions:
            __lowerCamelCase						, __lowerCamelCase     :      Optional[int]       						=						position
            if 0 <= y_test < n and 0 <= x_test < n:
                  permissible_positions.append(UpperCAmelCase      )

      return permissible_positions





def   _UpperCAmelCase       (     UpperCAmelCase      :			list[list[int]]      ):
      """simple docstring"""




      return not any(elem == 0 for row in board for elem in row      )





def   _UpperCAmelCase       (     UpperCAmelCase      :			list[list[int]]						,	UpperCAmelCase      :			tuple[int, int]						,	UpperCAmelCase      :			int      ):
      """simple docstring"""




      if is_complete(UpperCAmelCase      ):
            return True

      for position in get_valid_pos(UpperCAmelCase						,	len(UpperCAmelCase      )      ):
            __lowerCamelCase						, __lowerCamelCase     :      Dict       						=						position

            if board[y][x] == 0:
                  __lowerCamelCase     :      str       						=						curr + 1
                  if open_knight_tour_helper(UpperCAmelCase						,	UpperCAmelCase						,	curr + 1      ):
                        return True
                  __lowerCamelCase     :      int       						=						0

      return False





def   _UpperCAmelCase       (     UpperCAmelCase      :			int      ):
      """simple docstring"""




      __lowerCamelCase     :      Tuple       						=						[[0 for i in range(UpperCAmelCase      )] for j in range(UpperCAmelCase      )]

      for i in range(UpperCAmelCase      ):
            for j in range(UpperCAmelCase      ):
                  __lowerCamelCase     :      Optional[Any]       						=						1
                  if open_knight_tour_helper(UpperCAmelCase						,	(i, j)						,	1      ):
                        return board
                  __lowerCamelCase     :      int       						=						0

      __lowerCamelCase     :      Any       						=						f"""Open Kight Tour cannot be performed on a board of size {n}"""
      raise ValueError(UpperCAmelCase      )


if __name__ == "__main__":
    import doctest

    doctest.testmod()







def   _UpperCAmelCase       (     ):
      """simple docstring"""




      __lowerCamelCase     :      Optional[int]       						=						[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

      __lowerCamelCase     :      str       						=						6
      __lowerCamelCase     :      Optional[int]       						=						1
      __lowerCamelCase     :      Optional[int]       						=						1_901

      __lowerCamelCase     :      Optional[Any]       						=						0

      while year < 2_001:
            day += 7

            if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
                  if day > days_per_month[month - 1] and month != 2:
                        month += 1
                        __lowerCamelCase     :      Tuple       						=						day - days_per_month[month - 2]
                  elif day > 29 and month == 2:
                        month += 1
                        __lowerCamelCase     :      str       						=						day - 29
            else:
                  if day > days_per_month[month - 1]:
                        month += 1
                        __lowerCamelCase     :      Any       						=						day - days_per_month[month - 2]

            if month > 12:
                  year += 1
                  __lowerCamelCase     :      Optional[Any]       						=						1

            if year < 2_001 and day == 1:
                  sundays += 1
      return sundays


if __name__ == "__main__":
    print(solution())



