






"""simple docstring"""


from __future__ import annotations

from collections import Counter




def      snake_case    (A_ :int ):







  '''simple docstring'''

  a	:     List[Any]							=  [True] * n
  a	:     List[Any]							=  False
  a	:     Dict							=  False
  a	:     Union[str, Any]							=  True

  for i in range(3      ,     int(n**0.5 + 1 )      ,     2 ):
    a	:     Tuple							=  i * 2
    while index < n:
      a	:     str							=  False
      a	:     int							=  index + i

  a	:     Any							=  [2]

  for i in range(3      ,     __UpperCAmelCase      ,     2 ):
    if is_prime[i]:
      primes.append(__UpperCAmelCase )

  return primes




def      snake_case    (A_ :List[str] ):







  '''simple docstring'''

  a	:     Optional[Any]							=  str(__UpperCAmelCase )
  a	:     str							=  []
  a	:     Union[str, Any]							=  ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

  for duplicate in Counter(__UpperCAmelCase ) - Counter(set(__UpperCAmelCase ) ):
    a	:     Optional[int]							=  [int(number_str.replace(__UpperCAmelCase      ,     __UpperCAmelCase ) ) for digit in digits]
    replacements.append(__UpperCAmelCase )

  return replacements




def      snake_case    (A_ :Optional[Any] = 8 ):







  '''simple docstring'''

  a	:     Any							=  set()

  # Filter primes with less than 3 replaceable digits
  a	:     Optional[Any]							=  {
      x for x in set(prime_sieve(1_0_0_0_0_0_0 ) ) if len(str(__UpperCAmelCase ) ) - len(set(str(__UpperCAmelCase ) ) ) >= 3
  }

  for prime in primes:
    if prime in numbers_checked:
      continue

    a	:     Dict							=  digit_replacements(__UpperCAmelCase )

    for family in replacements:
      numbers_checked.update(__UpperCAmelCase )
      a	:     Dict							=  primes.intersection(__UpperCAmelCase )

      if len(__UpperCAmelCase ) != family_length:
        continue

      return min(__UpperCAmelCase )

  return -1


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









def 							A     (						__UpperCAmelCase				,   __UpperCAmelCase      )			->			int:



						'''simple docstring'''






						print('''\nVertex Distance'''      )
						for i in range(__UpperCAmelCase      ):
												if dist[i] != float('''inf'''      ):
																		print(__UpperCAmelCase				,   '''\t'''				,   int(dist[i]      )				,   end='''\t'''      )
												else:
																		print(__UpperCAmelCase				,   '''\t'''				,   '''INF'''				,   end='''\t'''      )
												print()







def 							A     (						__UpperCAmelCase				,   __UpperCAmelCase				,   __UpperCAmelCase      )			->			str:



						'''simple docstring'''






						UpperCAmelCase_					=	float('''inf'''      )
						UpperCAmelCase_					=	-1
						for i in range(__UpperCAmelCase      ):
												if (not vset[i]) and mdist[i] < min_val:
																		UpperCAmelCase_					=	i
																		UpperCAmelCase_					=	mdist[i]
						return min_ind







def 							A     (						__UpperCAmelCase				,   __UpperCAmelCase				,   __UpperCAmelCase      )			->			Optional[Any]:



						'''simple docstring'''






						UpperCAmelCase_					=	[float('''inf'''      ) for _ in range(__UpperCAmelCase      )]
						UpperCAmelCase_					=	[False for _ in range(__UpperCAmelCase      )]
						UpperCAmelCase_					=	0.0

						for _ in range(v - 1      ):
												UpperCAmelCase_					=	min_dist(__UpperCAmelCase				,   __UpperCAmelCase				,   __UpperCAmelCase      )
												UpperCAmelCase_					=	True

												for i in range(__UpperCAmelCase      ):
																		if (
																		    (not vset[i])
																		    and graph[u][i] != float('''inf'''      )
																		    and mdist[u] + graph[u][i] < mdist[i]
																		):
																								UpperCAmelCase_					=	mdist[u] + graph[u][i]

						print_dist(__UpperCAmelCase				,   __UpperCAmelCase      )


if __name__ == "__main__":
							UpperCamelCase_      			=  int(input("Enter number of vertices: ").strip())
							UpperCamelCase_      			=  int(input("Enter number of edges: ").strip())

							UpperCamelCase_      			=  [[float("inf") for i in range(V)] for j in range(V)]

							for i in range(V):
														UpperCamelCase_      			=  0.0

							for i in range(E):
														print("\nEdge ", i + 1)
														UpperCamelCase_      			=  int(input("Enter source:").strip())
														UpperCamelCase_      			=  int(input("Enter destination:").strip())
														UpperCamelCase_      			=  float(input("Enter weight:").strip())
														UpperCamelCase_      			=  weight

							UpperCamelCase_      			=  int(input("\nEnter shortest path source:").strip())
							dijkstra(graph, V, gsrc)





