"""simple docstring"""
from __future__ import annotations

lowercase__ 	=     list[tuple[int, int]]

lowercase__ 	=     [
    [0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 0, 0, 0],  # 0 are free path whereas 1's are obstacles
    [0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 0, 0, 0, 0],
    [1, 0, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 0, 0],
]

lowercase__ 	=     ([-1, 0], [0, -1], [1, 0], [0, 1])  # up, left, down, right




class        __snake_case	:



      def __init__(						self   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase   ,      )     ->      List[Any]:





        '''simple docstring'''





        a__:					Union[str, Any]      							=     pos_x
        a__:					Union[str, Any]      							=     pos_y
        a__:					Tuple      							=     (pos_y, pos_x)
        a__:					Any      							=     goal_x
        a__:					List[Any]      							=     goal_y
        a__:					Union[str, Any]      							=     g_cost
        a__:					int      							=     parent
        a__:					List[Any]      							=     self.calculate_heuristic()



      def   lowerCamelCase_       (						self)     ->      float:





        '''simple docstring'''





        a__:					Dict      							=     abs(self.pos_x - self.goal_x)
        a__:					Any      							=     abs(self.pos_y - self.goal_y)
        return dx + dy



      def __lt__(						self   ,      lowercase)     ->      bool:





        '''simple docstring'''





        return self.f_cost < other.f_cost







class        __snake_case	:



      def __init__(						self   ,      lowercase   ,      lowercase)     ->      List[str]:





        '''simple docstring'''





        a__:					Dict      							=     Node(start[1]   ,      start[0]   ,      goal[1]   ,      goal[0]   ,      0   ,      lowercase)
        a__:					List[Any]      							=     Node(goal[1]   ,      goal[0]   ,      goal[1]   ,      goal[0]   ,      9_99_99   ,      lowercase)

        a__:					Any      							=     [self.start]
        a__:					list[Node]      							=     []

        a__:					Optional[int]      							=     False



      def   lowerCamelCase_       (						self)     ->      Path | None:





        '''simple docstring'''





        while self.open_nodes:
          # Open Nodes are sorted using __lt__
          self.open_nodes.sort()
          a__:					List[Any]      							=     self.open_nodes.pop(0)

          if current_node.pos == self.target.pos:
            a__:					List[Any]      							=     True
            return self.retrace_path(lowercase)

          self.closed_nodes.append(lowercase)
          a__:					str      							=     self.get_successors(lowercase)

          for child_node in successors:
            if child_node in self.closed_nodes:
              continue

            if child_node not in self.open_nodes:
              self.open_nodes.append(lowercase)
            else:
              # retrieve the best current path
              a__:					str      							=     self.open_nodes.pop(self.open_nodes.index(lowercase))

              if child_node.g_cost < better_node.g_cost:
                self.open_nodes.append(lowercase)
              else:
                self.open_nodes.append(lowercase)

        if not self.reached:
          return [self.start.pos]
        return None



      def   lowerCamelCase_       (						self   ,      lowercase)     ->      list[Node]:





        '''simple docstring'''





        a__:					Tuple      							=     []
        for action in delta:
          a__:					Optional[int]      							=     parent.pos_x + action[1]
          a__:					Tuple      							=     parent.pos_y + action[0]

          if not (0 <= pos_x <= len(grid[0]) - 1 and 0 <= pos_y <= len(lowercase) - 1):
            continue

          if grid[pos_y][pos_x] != 0:
            continue

          successors.append(
              Node(
                  lowercase   ,      lowercase   ,      self.target.pos_y   ,      self.target.pos_x   ,      parent.g_cost + 1   ,      lowercase   ,      ))
        return successors



      def   lowerCamelCase_       (						self   ,      lowercase)     ->      Path:





        '''simple docstring'''





        a__:					Union[str, Any]      							=     node
        a__:					Optional[Any]      							=     []
        while current_node is not None:
          path.append((current_node.pos_y, current_node.pos_x))
          a__:					Dict      							=     current_node.parent
        path.reverse()
        return path


if __name__ == "__main__":
       lowercase__ 	=     (0, 0)
       lowercase__ 	=     (len(grid) - 1, len(grid[0]) - 1)
       for elem in grid:
              print(elem)

       print('------')

       lowercase__ 	=     GreedyBestFirst(init, goal)
       lowercase__ 	=     greedy_bf.search()
       if path:
              for pos_x, pos_y in path:
                     lowercase__ 	=     2

              for elem in grid:
                     print(elem)



"""simple docstring"""
import math







def 						__a       (     _SCREAMING_SNAKE_CASE		,					_SCREAMING_SNAKE_CASE       )     ->Optional[int]:
  if 0 not in (x, y):
    # We use the relation x^y = y*log10(x), where 10 is the base.
    return y * math.logaa(_SCREAMING_SNAKE_CASE       )
  else:
    if x == 0:  # 0 raised to any number is 0
      return 0
    elif y == 0:
      return 1  # any number raised to 0 is 1
  raise AssertionError('This should never happen'       )


if __name__ == "__main__":  # Main function
 # Read two numbers from input and typecast them to int using map function.
 # Here x is the base and y is the power.
 lowercase__ 	=     'Enter the base and the power separated by a comma: '
 lowercase__	, lowercase__ 	=     map(int, input(prompt).split(','))
 lowercase__	, lowercase__ 	=     map(int, input(prompt).split(','))

 # We find the log of each number, using the function res(), which takes two
 # arguments.
 lowercase__ 	=     res(xa, ya)
 lowercase__ 	=     res(xa, ya)

 # We check for the largest number
 if resa > resa:
  print('Largest number is', xa, '^', ya)
 elif resa > resa:
  print('Largest number is', xa, '^', ya)
 else:
  print('Both are equal')


