#P2136. 拉近距离

拉近距离

Description

In the lives of Xiao Ming and Xiao Hong, there are NN key nodes. There are MM events, denoted as a triplet (Si,Ti,Wi)(S_i, T_i, W_i), meaning that from node SiS_i there is an event that can move to TiT_i, and the effect of the event is to reduce the distance between them by WiW_i.

These nodes form a network, in which nodes 11 and NN are special: node 11 represents Xiao Ming, node NN represents Xiao Hong, and the others represent stages of progress. You may freely choose whether to perform each event, but at any step you may only perform an event that is outgoing from the current node. Please write a program to compute the shortest possible distance between them.

Input Format

The first line contains two positive integers N,MN, M.

Then follow MM lines, each containing 33 space-separated integers Si,Ti,WiS_i, T_i, W_i.

Output Format

Output one line with a single integer representing the shortest possible distance between them. If this distance can be decreased without bound, output Forever love.

3 3
1 2 3
2 3 -1
3 1 -10
-2

Hint

For 20%20\% of the testdata, N10N \le 10, M50M \le 50.

For 50%50\% of the testdata, N300N \le 300, M5000M \le 5000.

For 100%100\% of the testdata, 1N1031 \le N \le 10^3, 1M1041 \le M \le 10^4, Wi100|W_i| \le 100. It is guaranteed that there is a path from node 11 to every node 2N2 \dots N, and from node NN to every node 1N11 \dots N - 1.

Translated by ChatGPT 5