


"""simple docstring"""


import math
import sys
class snake_case					:







		def __init__(    self					:				int						)				->  Optional[Any]:





						'''simple docstring'''







						_A         =	0
						_A         =	[]
						_A         =	{}  # To store the pos of node in array







		def        a_       (    self					:				Tuple						)				->  List[Any]:





						'''simple docstring'''







						return self.cur_size == 0







		def        a_       (    self					:				Optional[int]			,      a__					:				List[Any]						)				->  Dict:





						'''simple docstring'''







						_A         =	self.left(a__						)
						_A         =	self.right(a__						)
						if lc < self.cur_size and self.array(a__						)[0] < self.array(a__						)[0]:
										_A         =	lc
						else:
										_A         =	idx
						if rc < self.cur_size and self.array(a__						)[0] < self.array(a__						)[0]:
										_A         =	rc
						if smallest != idx:
										self.swap(a__			,      a__						)
										self.min_heapify(a__						)







		def        a_       (    self					:				Dict			,      a__					:				Tuple						)				->  Dict:





						'''simple docstring'''







						_A         =	self.cur_size
						self.cur_size += 1
						self.array.append((sys.maxsize, tup[1])						)
						self.decrease_key((sys.maxsize, tup[1])			,      tup[0]						)







		def        a_       (    self					:				Union[str, Any]						)				->  Optional[int]:





						'''simple docstring'''







						_A         =	self.array[0][1]
						_A         =	self.array[self.cur_size - 1]
						self.cur_size -= 1
						self.min_heapify(1						)
						del self.pos[min_node]
						return min_node







		def        a_       (    self					:				Optional[Any]			,      a__					:				Tuple						)				->  int:





						'''simple docstring'''







						return 2 * i + 1







		def        a_       (    self					:				Optional[int]			,      a__					:				Optional[int]						)				->  Optional[int]:





						'''simple docstring'''







						return 2 * i + 2







		def        a_       (    self					:				int			,      a__					:				List[Any]						)				->  Dict:





						'''simple docstring'''







						return math.floor(i / 2						)







		def        a_       (    self					:				Optional[Any]			,      a__					:				Any			,      a__					:				int						)				->  List[str]:





						'''simple docstring'''







						_A         =	j
						_A         =	i
						_A         =	self.array[i]
						_A         =	self.array[j]
						_A         =	temp







		def        a_       (    self					:				Union[str, Any]			,      a__					:				Tuple			,      a__					:				Union[str, Any]						)				->  Dict:





						'''simple docstring'''







						_A         =	self.pos[tup[1]]
						# assuming the new_d is atmost old_d
						_A         =	(new_d, tup[1])
						while idx > 0 and self.array[self.par(a__						)][0] > self.array[idx][0]:
										self.swap(a__			,      self.par(a__						)						)
										_A         =	self.par(a__						)





class snake_case					:







		def __init__(    self					:				Any			,      a__					:				str						)				->  Union[str, Any]:





						'''simple docstring'''







						_A         =	{}  # To store graph: u -> (v,w)
						_A         =	num  # Number of nodes in graph
						# To store the distance from source vertex
						_A         =	[0] * self.num_nodes
						_A         =	[-1] * self.num_nodes  # To store the path







		def        a_       (    self					:				Union[str, Any]			,      a__					:				Union[str, Any]			,      a__					:				Optional[Any]			,      a__					:				str						)				->  int:





						'''simple docstring'''







						if u in self.adjList:
										self.adjList[u].append((v, w)						)
						else:
										_A         =	[(v, w)]

						# Assuming undirected graph
						if v in self.adjList:
										self.adjList[v].append((u, w)						)
						else:
										_A         =	[(u, w)]







		def        a_       (    self					:				int						)				->  str:





						'''simple docstring'''







						for u in self.adjList:
										print(a__			,      "->"			,      " -> ".join(str(F"""{v}({w})"""						) for v, w in self.adjList[u]						)						)







		def        a_       (    self					:				int			,      a__					:				Union[str, Any]						)				->  int:





						'''simple docstring'''







						_A         =	[-1] * self.num_nodes
						# src is the source node
						_A         =	0
						_A         =	PriorityQueue()
						q.insert((0, src)						)  # (dist from src, node)
						for u in self.adjList:
										if u != src:
														_A         =	sys.maxsize  # Infinity
														_A         =	-1

						while not q.is_empty():
										_A         =	q.extract_min()  # Returns node with the min dist from source
										# Update the distance of all the neighbours of u and
										# if their prev dist was INFINITY then push them in Q
										for v, w in self.adjList[u]:
														_A         =	self.dist[u] + w
														if self.dist[v] > new_dist:
																		if self.dist[v] == sys.maxsize:
																						q.insert((new_dist, v)						)
																		else:
																						q.decrease_key((self.dist[v], v)			,      a__						)
																		_A         =	new_dist
																		_A         =	u

        # Show the shortest distances from src
						self.show_distances(a__						)







		def        a_       (    self					:				Dict			,      a__					:				int						)				->  Optional[int]:





						'''simple docstring'''







						print(F"""Distance from node: {src}"""						)
						for u in range(self.num_nodes						):
										print(F"""Node {u} has distance: {self.dist[u]}"""						)







		def        a_       (    self					:				List[Any]			,      a__					:				List[str]			,      a__					:				str						)				->  Optional[Any]:





						'''simple docstring'''







						_A         =	[]
						_A         =	0
						_A         =	dest
						# Backtracking from dest to src
						while self.par[temp] != -1:
										path.append(a__						)
										if temp != src:
														for v, w in self.adjList[temp]:
																		if v == self.par[temp]:
																						cost += w
																						break
										_A         =	self.par[temp]
						path.append(a__						)
						path.reverse()

						print(F"""----Path to reach {dest} from {src}----"""						)
						for u in path:
										print(F"""{u}"""			,      end=" "						)
										if u != dest:
														print("-> "			,      end=""						)

						print("\nTotal cost of path: "			,      a__						)


if __name__ == "__main__":
		a_											=			Graph(9)
		graph.add_edge(0, 1, 4)
		graph.add_edge(0, 7, 8)
		graph.add_edge(1, 2, 8)
		graph.add_edge(1, 7, 11)
		graph.add_edge(2, 3, 7)
		graph.add_edge(2, 8, 2)
		graph.add_edge(2, 5, 4)
		graph.add_edge(3, 4, 9)
		graph.add_edge(3, 5, 14)
		graph.add_edge(4, 5, 10)
		graph.add_edge(5, 6, 2)
		graph.add_edge(6, 7, 1)
		graph.add_edge(6, 8, 6)
		graph.add_edge(7, 8, 7)
		graph.show_graph()
		graph.dijkstra(0)
		graph.show_path(0, 4)

# OUTPUT
# 0 -> 1(4) -> 7(8)
# 1 -> 0(4) -> 2(8) -> 7(11)
# 7 -> 0(8) -> 1(11) -> 6(1) -> 8(7)
# 2 -> 1(8) -> 3(7) -> 8(2) -> 5(4)
# 3 -> 2(7) -> 4(9) -> 5(14)
# 8 -> 2(2) -> 6(6) -> 7(7)
# 5 -> 2(4) -> 3(14) -> 4(10) -> 6(2)
# 4 -> 3(9) -> 5(10)
# 6 -> 5(2) -> 7(1) -> 8(6)
# Distance from node: 0
# Node 0 has distance: 0
# Node 1 has distance: 4
# Node 2 has distance: 12
# Node 3 has distance: 19
# Node 4 has distance: 21
# Node 5 has distance: 11
# Node 6 has distance: 9
# Node 7 has distance: 8
# Node 8 has distance: 14
# ----Path to reach 4 from 0----
# 0 -> 7 -> 6 -> 5 -> 4
# Total cost of path:  21



"""simple docstring"""


import math
from decimal import Decimal, getcontext






def    a__       ( __lowercase = 400_0000      )		->		int:

				try:
								_A         =	int(__lowercase      )
				except (TypeError, ValueError):
								raise TypeError("Parameter n must be int or castable to int."      )
				if n <= 0:
								raise ValueError("Parameter n must be greater than or equal to one."      )
				_A         =	100
				_A         =	(Decimal(5      ) ** Decimal(0.5      ) + 1) / Decimal(2      )

				_A         =	(math.floor(math.log(n * (phi + 2)   ,	__lowercase      ) - 1      ) // 3) * 3 + 2
				_A         =	Decimal(round(phi ** Decimal(index + 1      )      )      ) / (phi + 2)
				_A         =	num // 2
				return int(__lowercase      )


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