import sys inf = 10**9 + 1 def solve(): def memorec1(v, saitan): if saitan[v] >= 0: return saitan[v] if v == 0: saitan[0] = 0 return 0 res = 0 for u, c in adj1[v]: res = max(res, memorec1(u, saitan) + c) saitan[v] = res return res def memorec2(v, saiti): if saiti[v] >= 0: return saiti[v] if v == N - 1: saiti[N - 1] = saitan[N - 1] return saiti[N - 1] res = inf for u, c in adj2[v]: res = min(res, memorec2(u, saiti) - c) saiti[v] = res return res N, M = map(int, input().split()) saitan = [-1] * N saiti = [-1] * N adj1 = [[] for i in range(N)] adj2 = [[] for i in range(N)] for i in range(M): a, b, c = map(int, sys.stdin.readline().split()) adj1[b].append((a, c)) adj2[a].append((b, c)) memorec1(N - 1, saitan) # print(*saitan, file=sys.stderr) memorec2(0, saiti) # print(*saiti, file=sys.stderr) cnt = 0 for u in range(N): if saitan[u] == saiti[u]: cnt += 1 t = saitan[N - 1] p = N - cnt print('{} {}/{}'.format(t, p, N)) if __name__ == '__main__': solve()