#!/usr/bin/python2 # -*- coding: utf-8 -*- # † n, m = map(int, raw_input().split()) G0 = [] rG = [] for _ in xrange(m): a, b, c = map(int, raw_input().split()) G0.append([a, b, -c]) rG.append([b, a, -c]) cost0 = [1] * n # cost0[n] cost0[0] = 0 while True: update = False for e in G0: if cost0[e[0]] != 1 and cost0[e[1]] > cost0[e[0]] + e[2]: cost0[e[1]] = cost0[e[0]] + e[2] update = True if not update: break days = -cost0[n-1] rcost = [1] * n rcost[n-1] = 0 while True: update = False for e in rG: if rcost[e[0]] != 1 and rcost[e[1]] > rcost[e[0]] + e[2]: rcost[e[1]] = rcost[e[0]] + e[2] update = True if not update: break cnt = sum(-cost0[i] != days + rcost[i] for i in xrange(n)) print '{} {}/{}'.format(days, cnt, n)