Working with BellmanFord variations for shortest path in both sum and product of edge weights