I am new to graph algorithms so i cannot think of approach to solve this problem, if someone could help me out to solve this problem please explain the approach?

U have to learn LCA …so go to youtube and search CodeNCode.

One thing to notice here is that there is only one path between two nodes. So now you just have to find the sum of weights on that unique path which can be found with the help of some precomputation and lca.