#!/usr/bin/python2 # -*- coding: utf-8 -*- # † from heapq import heappush, heappop n, m = map(int, raw_input().split()) G0 = [[] for i in range(n)] rG = [[] for i in range(n)] for _ in xrange(m): a, b, c = map(int, raw_input().split()) G0[a].append((b, c)) rG[b].append((a, c)) cost0 = [-1] * n # cost0[n] cost0[0] = 0 que0 = [] heappush(que0, [0, 0]) while len(que0): c, v = heappop(que0) if c < cost0[v]: continue for e in G0[v]: if cost0[e[0]] < cost0[v] + e[1]: cost0[e[0]] = cost0[v] + e[1] heappush(que0, [cost0[e[0]], e[0]]) rcost = [-1] * n # rcost[n] rcost[n-1] = 0 rq = [] heappush(rq, [0, n-1]) while len(rq): c, v = heappop(rq) if c < rcost[v]: continue for e in rG[v]: if rcost[e[0]] < rcost[v] + e[1]: rcost[e[0]] = rcost[v] + e[1] heappush(rq, [rcost[e[0]], e[0]]) days = cost0[n-1] cnt = sum(cost0[i] != days - rcost[i] for i in xrange(n)) print '{} {}/{}'.format(days, cnt, n)