





def      a__			(       lowercase__	,     lowercase__	):






   '''simple docstring'''






   UpperCAmelCase_           =""
   for i in table:
      res += inp[i - 1]
   return res




def      a__			(       lowercase__	):






   '''simple docstring'''






   return data[1:] + data[0]




def      a__			(       lowercase__	,     lowercase__	):






   '''simple docstring'''






   UpperCAmelCase_           =""
   for i in range(len(lowercase__	)	):
      if a[i] == b[i]:
         res += "0"
      else:
         res += "1"
   return res




def      a__			(       lowercase__	,     lowercase__	):






   '''simple docstring'''






   UpperCAmelCase_           =int("0b" + data[0] + data[-1]	,     2	)
   UpperCAmelCase_           =int("0b" + data[1:3]	,     2	)
   return bin(s[row][col]	)[2:]




def      a__			(       lowercase__	,     lowercase__	,     lowercase__	,     lowercase__	,     lowercase__	):






   '''simple docstring'''






   UpperCAmelCase_           =message[:4]
   UpperCAmelCase_           =message[4:]
   UpperCAmelCase_           =apply_table(lowercase__	,     lowercase__	)
   UpperCAmelCase_           =xor(lowercase__	,     lowercase__	)
   UpperCAmelCase_           =apply_sbox(lowercase__	,     temp[:4]	)  # noqa: E741
   UpperCAmelCase_           =apply_sbox(lowercase__	,     temp[4:]	)
   UpperCAmelCase_           ="0" * (2 - len(lowercase__	)) + l  # noqa: E741
   UpperCAmelCase_           ="0" * (2 - len(lowercase__	)) + r
   UpperCAmelCase_           =apply_table(l + r	,     lowercase__	)
   UpperCAmelCase_           =xor(lowercase__	,     lowercase__	)
   return temp + right


if __name__ == "__main__":
     __lowercase	: Union[str, Any]       =input("""Enter 10 bit key: """)
     __lowercase	: Optional[Any]       =input("""Enter 8 bit message: """)

     __lowercase	: str       =[6, 3, 7, 4, 8, 5, 10, 9]
     __lowercase	: List[Any]       =[3, 5, 2, 7, 4, 10, 1, 9, 8, 6]
     __lowercase	: Dict       =[2, 4, 3, 1]
     __lowercase	: Optional[Any]       =[2, 6, 3, 1, 4, 8, 5, 7]
     __lowercase	: int       =[4, 1, 3, 5, 7, 2, 8, 6]
     __lowercase	: Any       =[4, 1, 2, 3, 2, 3, 4, 1]
     __lowercase	: int       =[[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
     __lowercase	: List[str]       =[[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

     # key generation
     __lowercase	: List[str]       =apply_table(key, paa_table)
     __lowercase	: Dict       =temp[:5]
     __lowercase	: List[Any]       =temp[5:]
     __lowercase	: Union[str, Any]       =left_shift(left)
     __lowercase	: Optional[Any]       =left_shift(right)
     __lowercase	: Tuple       =apply_table(left + right, pa_table)
     __lowercase	: List[str]       =left_shift(left)
     __lowercase	: List[str]       =left_shift(right)
     __lowercase	: int       =left_shift(left)
     __lowercase	: Any       =left_shift(right)
     __lowercase	: Tuple       =apply_table(left + right, pa_table)

     # encryption
     __lowercase	: Union[str, Any]       =apply_table(message, IP)
     __lowercase	: Dict       =function(expansion, sa, sa, keya, temp)
     __lowercase	: Dict       =temp[4:] + temp[:4]
     __lowercase	: str       =function(expansion, sa, sa, keya, temp)
     __lowercase	: Tuple       =apply_table(temp, IP_inv)
     print("""Cipher text is:""", CT)

     # decryption
     __lowercase	: List[str]       =apply_table(CT, IP)
     __lowercase	: str       =function(expansion, sa, sa, keya, temp)
     __lowercase	: int       =temp[4:] + temp[:4]
     __lowercase	: int       =function(expansion, sa, sa, keya, temp)
     __lowercase	: Optional[int]       =apply_table(temp, IP_inv)
     print("""Plain text after decypting is:""", PT)











from __future__ import annotations


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : list[float]   ,    _lowercase     : Tuple			)   ->							int:




		'''simple docstring'''
		print(f"""Vertex\tShortest Distance from vertex {src}"""			)
		for i, d in enumerate(_lowercase			):
				print(f"""{i}\t\t{d}"""			)


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : list[dict[str, int]]   ,    _lowercase     : list[float]   ,    _lowercase     : int			)   ->							Any:




		'''simple docstring'''
		for j in range(_lowercase			):
				lowercase__   ,				lowercase__   ,				lowercase__					:      Dict      =		(graph[j][k] for k in ['src', 'dst', 'weight'])
				if distance[u] != float('inf'			) and distance[u] + w < distance[v]:
						return True
		return False


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : list[dict[str, int]]   ,    _lowercase     : int   ,    _lowercase     : int   ,    _lowercase     : int			)   ->							list[float]:




		'''simple docstring'''
		lowercase__					:      Dict      =		[float('inf'			)] * vertex_count
		lowercase__					:      Dict      =		0.0

		for _ in range(vertex_count - 1			):
				for j in range(_lowercase			):
						lowercase__   ,				lowercase__   ,				lowercase__					:      int      =		(graph[j][k] for k in ['src', 'dst', 'weight'])

						if distance[u] != float('inf'			) and distance[u] + w < distance[v]:
								lowercase__					:      str      =		distance[u] + w

		lowercase__					:      str      =		check_negative_cycle(_lowercase   ,    _lowercase   ,    _lowercase			)
		if negative_cycle_exists:
				raise Exception('Negative cycle found'			)

		return distance


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			__UpperCamelCase:	Optional[int] = int(input("""Enter number of vertices: """).strip())
			__UpperCamelCase:	Union[str, Any] = int(input("""Enter number of edges: """).strip())

			__UpperCamelCase:	list[dict[str, int]] = [{} for _ in range(E)]

			for i in range(E):
						print("""Edge """, i + 1)
						__UpperCamelCase,	__UpperCamelCase,	__UpperCamelCase:	List[str] = (
						    int(x)
						    for x in input("""Enter source, destination, weight: """).strip().split(""" """)
						)
						__UpperCamelCase:	List[Any] = {"""src""": src, """dst""": dest, """weight""": weight}

			__UpperCamelCase:	Optional[int] = int(input("""\nEnter shortest path source:""").strip())
			__UpperCamelCase:	Dict = bellman_ford(graph, V, E, source)
			print_distance(shortest_distance, 0)


