[2]---
/ | \
/1 | \ 6
/ | \
[1] 0| --[3]
\ | / \2
4\ | /4 [6]
\ | / /1
[4]-----[5]
3 Given FJ's map, what is the minimal number of treats that he should bring with him, given that he will feed each distinct cow he meets exactly one treat? He does not care about the length of his journey.
* Line 1: Two space-separated integers: N and M
* Lines 2..M+1: Three space-separated integers:,
, and
* Line 1: The minimum number of treats that FJ must bring