

1. All the edges are directed.
2. Multiple edges can be present between two nodes.
3. The given graph is a single connected component.
4. It does not have any self-loop.
5. At least one path always exists between the two given nodes.
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the 'T' test cases follow.
The first line of each test case contains two space-separated integers ‘N’ and ‘M’, denoting the number of nodes present in the graph and the number of edges present in the graph respectively. Then, ‘M’ lines follow.
Each line contains four space-separated integers, ‘A’, ‘B’, ‘W1’, ‘W2’, denoting that there is a normal link between ‘A’ and ‘B’ having a length ‘D1’ and a special link having a length ‘D2’.
The last line of each test case contains two space-separated integers, ‘X’ and ‘Y’, denoting the nodes between which the shortest distance has to be calculated.
For each test case, return an integer denoting the shortest between the two given nodes.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N < 10^3
N-1 <= M <= 10^3
1 <= A,B,X,Y <= N
1 <= D1,D2 <= 10^6
Time Limit: 1sec
The approach is to apply Dijkstra’s Algorithm after making some modifications according to our requirements. We can make a struct that has three values, the node to which the current node is directed, and the respective distances of both types of edges. We also need a VISITED array to keep track of nodes that have already been VISITED.