





'''simple docstring'''

from queue import PriorityQueue
from typing import Any

import numpy as np





def 						UpperCamelCase    (							_lowerCamelCase : dict						,	_lowerCamelCase : str						,	_lowerCamelCase : set						,	_lowerCamelCase : set						,	_lowerCamelCase : dict						,	_lowerCamelCase : dict						,	_lowerCamelCase : PriorityQueue						,	_lowerCamelCase : dict						,	_lowerCamelCase : float | int						,	):
				for nxt, d in graph[v]:
								if nxt in visited_forward:
												continue
								A__    =      cst_fwd.get(_lowerCamelCase						,	np.inf	)
								A__    =      cst_fwd[v] + d
								if new_cost_f < old_cost_f:
												queue.put((new_cost_f, nxt)	)
												A__    =      new_cost_f
												A__    =      v
								if nxt in visited_backward:
												if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
																A__    =      cst_fwd[v] + d + cst_bwd[nxt]
				return shortest_distance





def 						UpperCamelCase    (							_lowerCamelCase : str						,	_lowerCamelCase : str						,	_lowerCamelCase : dict						,	_lowerCamelCase : dict	):
				A__    =      -1

				A__    =      set()
				A__    =      set()
				A__    =      {source: 0}
				A__    =      {destination: 0}
				A__    =      {source: None}
				A__    =      {destination: None}
				A__    =      PriorityQueue()
				A__    =      PriorityQueue()

				A__    =      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():
								A__,     A__    =      queue_forward.get()
								visited_forward.add(_lowerCamelCase	)

								A__,     A__    =      queue_backward.get()
								visited_backward.add(_lowerCamelCase	)

								A__    =      pass_and_relaxation(
								    _lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	)

								A__    =      pass_and_relaxation(
								    _lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase						,	)

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

				if shortest_distance != np.inf:
								A__    =      shortest_distance
				return shortest_path_distance


__lowerCAmelCase							:     int		     ={
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["G", 2]],
    "F": [],
    "G": [["F", 1]],
}
__lowerCAmelCase							:     str		     ={
    "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 						UpperCamelCase    (							_lowerCamelCase : int = 1_00_00_00	):
    A__    =      set(range(3						,	_lowerCamelCase						,	2	)	)
    primes.add(2	)
    for p in range(3						,	_lowerCamelCase						,	2	):
        if p not in primes:
            continue
        primes.difference_update(set(range(p * p						,	_lowerCamelCase						,	_lowerCamelCase	)	)	)

    A__    =      [float(_lowerCamelCase	) for n in range(limit + 1	)]

    for p in primes:
        for n in range(_lowerCamelCase						,	limit + 1						,	_lowerCamelCase	):
            phi[n] *= 1 - 1 / p

    return int(sum(phi[2:]	)	)


if __name__ == "__main__":
  print(f"""{solution() = }""")



