School Road

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Beaverland consists of NN cities, numbered from 11 to NN. There are MM roads connecting cities, numbered from 11 to MM. The road ii (1iM1 ≤ i ≤ M) connects the city A_iA\_i and the city B_iB\_i bidirectionally, and the length of the road ii is C_iC\_i. It is possible to move from any city to any other city by passing through a number of roads.

Bitaro is a beaver living in the city 11. He goes to a school in the city NN. He usually takes the same route to the school. His route to the school satisfies the following conditions.

  • Let LL be the minimum distance from the city 11 to the city NN.
  • Bitaro’s route to the school connects the city 11 and the city NN, and its length is LL.

Since today is a fine day, Bitaro decided to go back to his home by taking a roundabout way. Namely, he will take a route longer than LL from the city NN to the city 11. Since Bitaro is easily bored, he does not want to visit the same city more than once. Therefore, when he takes a roundabout way to his home, it is not allowed to visit the same city more than once, and it is not allowed to turn back on the way.

Given information of the cities and the roads in Beaverland, write a program which determines whether there exists a roundabout way from the school to Bitaro’s home.

입력

Read the following data from the standard input. Given values are all integers.

NN MM

A_1A\_1 B_1B\_1 C_1C\_1

A_2A\_2 B_2B\_2 C_2C\_2

\vdots

A_MA\_M B_MB\_M C_MC\_M

출력

Write one line to the standard output. Output 11 if there exists a route to Bitaro’s home longer than LL without visiting the same city more than once. Otherwise, output 00.

제한

  • 2N100,0002 ≤ N ≤ 100\\,000.
  • 1M200,0001 ≤ M ≤ 200\\,000.
  • 1A_i<B_iN1 ≤ A\_i < B\_i ≤ N (1iM1 ≤ i ≤ M).
  • 1C_i1,000,000,0001 ≤ C\_i ≤ 1\\,000\\,000\\,000 (=109= 10^9) (1iM1 ≤ i ≤ M).
  • It is possible to move from any city to any other city by passing through a number of roads.