CSES - E4590 2020 2 - Internet connection
  • Time limit: 1.00 s
  • Memory limit: 512 MB

The internet connection between Teemu and Taina has had problems lately. Before more investigation on the subject, Teemu decided to find out the theoretical maximum rate at which he can send data to Taina.

Can you help Teemu to calculate the maximum rate?

Input

The first line of the input has two integers nn and mm: the number of computers and number of connections in the network. Computers are numbered 1,2,,n1,2,\ldots,n. Computer 11 is owned by Teemu and computer nn by Taina.

After the first line mm lines follow, each of which describe one connection between computers. Each line has three integers aa, bb and cc. This means that computer aa can send data to computer bb at a rate of cc bytes/s. There is at most one connection from computer aa to bb and no connection connects a computer to itself.

Output

Your program should print one integer: the maximum rate (bytes/s) at which Teemu can send data to Taina.

Limits

  • 2n1002 \le n \le 100
  • 0m10000 \le m \le 1000
  • 1a,bn1 \le a, b \le n
  • 1c1091 \le c \le 10^9

Examples

Input:

4 5
1 2 2
1 3 5
2 4 3
3 2 2
3 4 1

Output:

4