#!/usr/bin/python2 # -*- coding: utf-8 -*- # † from heapq import heappush, heappop from collections import namedtuple edge = namedtuple('edge', 'to, cost') 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(edge(b, c)) rG[b].append(edge(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.to] < cost0[v] + e.cost: cost0[e.to] = cost0[v] + e.cost heappush(que0, [cost0[e.to], e.to]) 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.to] < rcost[v] + e.cost: rcost[e.to] = rcost[v] + e.cost heappush(rq, [rcost[e.to], e.to]) days = cost0[n-1] cnt = sum(cost0[i] != days - rcost[i] for i in xrange(n)) print '{} {}/{}'.format(days, cnt, n)