Hello everyone,

I have some trouble with a problem and I hope someone may help me to solve it:

Given a graph N vertices and M edges (N <= 50, M <= N * (N — 1) / 2). Each edge has a weight w (w <= 1e4). And the task is to find if there is a path with the total weight exactly equals to S (S <= 1e18).

Thanks in advance!