xay is competiting on the Internet. He spends 0.1 seconds thinking about it, then he quickly codes “Floyd" algorithm.
for k from 1 to n for i from 1 to n for j from 1 to n dis[i][j] <- min(dis[i][j], dis[i][k] + dis[k][j])However, xay can't remember how to write it. Then he writes down:
for i from 1 to n for j from 1 to n for k from 1 to n dis[i][j] <- min(dis[i][j], dis[i][k] + dis[k][j])Although xay makes a mistake, he still want to calculate how many
The first line contains two integers n and m .
The following m lines, each line contains three integers u,v,w , denoting there is a directed edge from u to v , and the weight is w , i.e. dis[u][v]=w .It's guaranteed that (u,v) appears at most once.It's guaranteed
Output the answer.