




'''simple docstring'''



from __future__ import annotations







def       _UpperCamelCase			(_lowerCamelCase				:  list[float] ,						_lowerCamelCase				:  Dict						)-> List[Any]:




     '''simple docstring'''





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







def       _UpperCamelCase			(_lowerCamelCase				:  list[dict[str, int]] ,						_lowerCamelCase				:  list[float] ,						_lowerCamelCase				:  int						)-> Any:




     '''simple docstring'''





     for j in range(_lowerCamelCase						):
          __snake_case       ,     __snake_case       ,     __snake_case            =	(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       _UpperCamelCase			(_lowerCamelCase				:  list[dict[str, int]] ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  int						)-> list[float]:




     '''simple docstring'''





     __snake_case            =	[float('''inf'''						)] * vertex_count
     __snake_case            =	0.0

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

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

     __snake_case            =	check_negative_cycle(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)
     if negative_cycle_exists:
          raise Exception('''Negative cycle found'''						)

     return distance


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     UpperCAmelCase_							:	Dict	     =		int(input('''Enter number of vertices: ''').strip())
     UpperCAmelCase_							:	List[str]	     =		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_							:	int	     =		(
              int(x)
              for x in input('''Enter source, destination, weight: ''').strip().split(''' ''')
          )
          UpperCAmelCase_							:	Optional[Any]	     =		{'''src''': src, '''dst''': dest, '''weight''': weight}

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













from __future__ import annotations

import math



def 						A_							(	_lowerCAmelCase				,  _lowerCAmelCase	)		->					float:
 UpperCamelCase      :   Tuple			      =  u
 for i in range(1				,  _lowerCAmelCase	):
  UpperCamelCase      :   Any			      =  temp * (u - i)
 return temp



def 						A_							(	)		->					None:
 UpperCamelCase      :   Union[str, Any]			      =  int(input("enter the numbers of values: "	)	)
 UpperCamelCase      :   list[list[float]]			      =  []
 for _ in range(_lowerCAmelCase	):
  y.append([]	)
 for i in range(_lowerCAmelCase	):
  for j in range(_lowerCAmelCase	):
   y[i].append(_lowerCAmelCase	)
   UpperCamelCase      :   List[str]			      =  0

 print("enter the values of parameters in a list: "	)
 UpperCamelCase      :   Optional[Any]			      =  list(map(_lowerCAmelCase				,  input().split()	)	)

 print("enter the values of corresponding parameters: "	)
 for i in range(_lowerCAmelCase	):
  UpperCamelCase      :   Tuple			      =  float(input()	)

 UpperCamelCase      :   Any			      =  int(input("enter the value to interpolate: "	)	)
 UpperCamelCase      :   List[Any]			      =  (value - x[0]) / (x[1] - x[0])

 # for calculating forward difference table

 for i in range(1				,  _lowerCAmelCase	):
  for j in range(n - i	):
   UpperCamelCase      :   Optional[Any]			      =  y[j + 1][i - 1] - y[j][i - 1]

 UpperCamelCase      :   List[str]			      =  y[0][0]
 for i in range(1				,  _lowerCAmelCase	):
  summ += (ucal(_lowerCAmelCase				,  _lowerCAmelCase	) * y[0][i]) / math.factorial(_lowerCAmelCase	)

 print(F"""the value at {value} is {summ}"""	)


if __name__ == "__main__":
    main()
