"""simple docstring"""




import math



def      __SCREAMING_SNAKE_CASE  ( __UpperCamelCase   :	int     )							-> int:







  """simple docstring"""





  if not isinstance(__UpperCamelCase			,					__UpperCamelCase     ):
    SCREAMING_SNAKE_CASE__      							=				f"""Input value of [number={number}] must be an integer"""
    raise TypeError(__UpperCamelCase     )

  if number < 1:
    SCREAMING_SNAKE_CASE__      							=				f"""Input value of [number={number}] must be > 0"""
    raise ValueError(__UpperCamelCase     )
  elif number == 1:
    return 3
  elif number == 2:
    return 5
  else:
    SCREAMING_SNAKE_CASE__      							=				int(math.log(number // 3			,					2     )     ) + 2

    SCREAMING_SNAKE_CASE__      							=				[3, 5]
    SCREAMING_SNAKE_CASE__      							=				2
    SCREAMING_SNAKE_CASE__      							=				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):
      __lowerCamelCase      :			int							       =		0
      try:
         __lowerCamelCase      :			Any							       =		proth(number)
      except ValueError:
         print(F"""ValueError: there is no {number}th Proth number""")
         continue

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

def      __SCREAMING_SNAKE_CASE  ( __UpperCamelCase   :	List[Any]     )							-> Any:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__      							=				[0] * len(__UpperCamelCase     )
  SCREAMING_SNAKE_CASE__      							=				[]
  SCREAMING_SNAKE_CASE__      							=				[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:
    SCREAMING_SNAKE_CASE__      							=				queue.pop(0     )
    for x in graph[vertex]:
      indegree[x] -= 1

      if long_dist[vertex] + 1 > long_dist[x]:
        SCREAMING_SNAKE_CASE__      							=				long_dist[vertex] + 1

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

  print(max(__UpperCamelCase     )     )


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






longest_distance(graph)
