'''simple docstring'''




def 							lowerCamelCase	(      UpperCAmelCase__       :					Optional[int] )			->      Optional[int]:
							lowercase_					:			int										=       [0] * len(UpperCAmelCase__ )
							lowercase_					:			Optional[int]										=       []
							lowercase_					:			List[str]										=       [1] * len(UpperCAmelCase__ )

							for values in graph.values():
														for i in values:
																					indegree[i] += 1

							for i in range(len(UpperCAmelCase__ ) ):
														if indegree[i] == 0:
																					queue.append(UpperCAmelCase__ )

							while queue:
														lowercase_					:			str										=       queue.pop(0 )
														for x in graph[vertex]:
																					indegree[x] -= 1

																					if long_dist[vertex] + 1 > long_dist[x]:
																												lowercase_					:			Any										=       long_dist[vertex] + 1

																					if indegree[x] == 0:
																												queue.append(UpperCAmelCase__ )

							print(max(UpperCAmelCase__ ) )


# Adjacency list of Graph
_lowercase						: Tuple						=						{0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}

longest_distance(graph)






'''simple docstring'''




import math




def 							lowerCamelCase	(      UpperCAmelCase__       :					int )			->      int:

							if not isinstance(UpperCAmelCase__      ,      UpperCAmelCase__ ):
														lowercase_					:			List[Any]										=       F'''Input value of [number={number}] must be an integer'''
														raise TypeError(UpperCAmelCase__ )

							if number < 1:
														lowercase_					:			Tuple										=       F'''Input value of [number={number}] must be > 0'''
														raise ValueError(UpperCAmelCase__ )
							elif number == 1:
														return 3
							elif number == 2:
														return 5
							else:
														lowercase_					:			Union[str, Any]										=       int(math.log(number // 3      ,      2 ) ) + 2

														lowercase_					:			Any										=       [3, 5]
														lowercase_					:			List[Any]										=       2
														lowercase_					:			Optional[Any]										=       3
														for block in range(1      ,      UpperCAmelCase__ ):
																					for _ in range(UpperCAmelCase__ ):
																												proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1] )
																												proth_index += 1
																					increment *= 2

							return proth_list[number - 1]


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						for number in range(11):
												_lowercase						: Optional[Any]						=						0
												try:
																		_lowercase						: str						=						proth(number)
												except ValueError:
																		print(f"""ValueError: there is no {number}th Proth number""")
																		continue

												print(f"""The {number}th Proth number: {value}""")





