






'''simple docstring'''



from queue import PriorityQueue
from typing import Any

import numpy as np


def 				lowercase_					(     __A			:							dict       ,   __A			:							str       ,   __A			:							set       ,   __A			:							set       ,   __A			:							dict       ,   __A			:							dict       ,   __A			:							PriorityQueue       ,   __A			:							dict       ,   __A			:							float | int       ,   )							->   float | int:



 """simple docstring"""




 for nxt, d in graph[v]:
  if nxt in visited_forward:
   continue
  lowercase       : str						=cst_fwd.get(__A       ,   np.inf      )
  lowercase       : str						=cst_fwd[v] + d
  if new_cost_f < old_cost_f:
   queue.put((new_cost_f, nxt)      )
   lowercase       : int						=new_cost_f
   lowercase       : Optional[int]						=v
  if nxt in visited_backward:
   if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
    lowercase       : List[Any]						=cst_fwd[v] + d + cst_bwd[nxt]
 return shortest_distance


def 				lowercase_					(     __A			:							str       ,   __A			:							str       ,   __A			:							dict       ,   __A			:							dict      )							->   int:



 """simple docstring"""




 lowercase       : Optional[Any]						=-1

 lowercase       : Tuple						=set()
 lowercase       : str						=set()
 lowercase       : List[str]						={source: 0}
 lowercase       : List[str]						={destination: 0}
 lowercase       : Tuple						={source: None}
 lowercase       : List[Any]						={destination: None}
 lowercase       : PriorityQueue[Any]						=PriorityQueue()
 lowercase       : PriorityQueue[Any]						=PriorityQueue()

 lowercase       : Any						=np.inf

 queue_forward.put((0, source)      )
 queue_backward.put((0, destination)      )

 if source == destination:
  return 0

 while not queue_forward.empty() and not queue_backward.empty():
  lowercase	,		lowercase       : int						=queue_forward.get()
  visited_forward.add(__A      )

  lowercase	,		lowercase       : int						=queue_backward.get()
  visited_backward.add(__A      )

  lowercase       : Dict						=pass_and_relaxation(
      __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   )

  lowercase       : List[Any]						=pass_and_relaxation(
      __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   __A       ,   )

  if cst_fwd[v_fwd] + cst_bwd[v_bwd] >= shortest_distance:
   break

 if shortest_distance != np.inf:
  lowercase       : Union[str, Any]						=shortest_distance
 return shortest_path_distance


SCREAMING_SNAKE_CASE							=						{
    'B': [['C', 1]],
    'C': [['D', 1]],
    'D': [['F', 1]],
    'E': [['B', 1], ['G', 2]],
    'F': [],
    'G': [['F', 1]],
}
SCREAMING_SNAKE_CASE							=						{
    'B': [['E', 1]],
    'C': [['B', 1]],
    'D': [['C', 1]],
    'F': [['D', 1], ['G', 1]],
    'E': [[None, np.inf]],
    'G': [['E', 2]],
}

if __name__ == "__main__":
      import doctest

      doctest.testmod()










'''simple docstring'''




def 			_lowerCAmelCase     (    __snake_case    :					int     )	->	bool:
     return sum(i for i in range(1					,				number // 2 + 1     ) if number % i == 0     ) == number


if __name__ == "__main__":
  print('''Program to check whether a number is a Perfect number or not...''')
  lowercase__       : int         =       int(input('''Enter number: ''').strip())
  print(f"""{number} is {"" if perfect(number) else "not "}a Perfect Number.""")