Annoyed at sorting stuff for Sultan Malik, advisor Fankoush has stolen a powerful treasure and escaped into a deep maze. He will be taking some specific path that will lead him to a point of no return, where he will disappear without a trace.
The maze contains $$$N$$$ rooms. Each room is connected to one or multiple rooms by a passage. There are $$$M$$$ passages in the maze. Passage $$$i$$$ has length $$$w_i$$$.
The sultan's soldiers chase the thief, and each of them starts in some room in the maze. The soldiers know the exact path that Fankoush will take and the distances between the rooms.
Note the following:
The soldiers' mission is to catch Fankoush before he leaves the maze and escapes forever.
Your task is to help them find the number of the first room where they can intercept him. If it's impossible to catch him in time, you should return $$$-1$$$.
Note:
Print a single integer, the number of the first room in Fankoush's path where any soldier can intercept him, or $$$-1$$$ if no interception is possible before the last room.
6 70 2 10 5 31 2 21 3 21 4 21 5 22 3 23 3 1 52 0 211 10
5