In the country there are exactly *n* cities numbered with positive integers from 1 to *n*. In each city there is an airport is located.

Also, there is the only one airline, which makes *m* flights. Unfortunately, to use them, you need to be a regular customer of this company, namely, you have the opportunity to enjoy flight *i* from city *a*<sub class="lower-index">*i*</sub> to city *b*<sub class="lower-index">*i*</sub> only if you have already made at least *d*<sub class="lower-index">*i*</sub> flights before that.

Please note that flight *i* flies exactly from city *a*<sub class="lower-index">*i*</sub> to city *b*<sub class="lower-index">*i*</sub>. It can not be used to fly from city *b*<sub class="lower-index">*i*</sub> to city *a*<sub class="lower-index">*i*</sub>. An interesting fact is that there may possibly be recreational flights with a beautiful view of the sky, which begin and end in the same city.

You need to get from city 1 to city *n*. Unfortunately, you've never traveled by plane before. What minimum number of flights you have to perform in order to get to city *n*?

Note that the same flight can be used multiple times.
The first line contains two integers, *n* and *m* (2 ≤ *n* ≤ 150, 1 ≤ *m* ≤ 150) — the number of cities in the country and the number of flights the company provides.

Next *m* lines contain numbers *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub>, *d*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ *n*, 0 ≤ *d*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>), representing flight number *i* from city *a*<sub class="lower-index">*i*</sub> to city *b*<sub class="lower-index">*i*</sub>, accessible to only the clients who have made at least *d*<sub class="lower-index">*i*</sub> flights.
print("_RANDOM_GUESS_1689591648.0253446")# 1689591648.0253646