CSES - High Score
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You play a game consisting of nn rooms and mm tunnels. Your initial score is 00, and each tunnel increases your score by xx where xx may be both positive or negative. You may go through a tunnel several times.

Your task is to walk from room 11 to room nn. What is the maximum score you can get?

Input

The first input line has two integers nn and mm: the number of rooms and tunnels. The rooms are numbered 1,2,,n1,2,\dots,n.

Then, there are mm lines describing the tunnels. Each line has three integers aa, bb and xx: the tunnel starts at room aa, ends at room bb, and it increases your score by xx. All tunnels are one-way tunnels.

You can assume that it is possible to get from room 11 to room nn.

Output

Print one integer: the maximum score you can get. However, if you can get an arbitrarily large score, print 1-1.

Constraints

  • 1n25001 \le n \le 2500
  • 1m50001 \le m \le 5000
  • 1a,bn1 \le a,b \le n
  • 109x109-10^9 \le x \le 10^9

Example

Input:

4 5
1 2 3
2 4 -1
1 3 -2
3 4 7
1 4 4

Output:

5