import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList> graph = new ArrayList<>(); ArrayList> reverse = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); reverse.add(new ArrayList<>()); } int[] counts = new int[n]; int[] rCounts = new int[n]; for (int i = 0; i < m; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); counts[b]++; rCounts[a]++; graph.get(a).add(new Path(b, c)); reverse.get(b).add(new Path(a, c)); } ArrayDeque idxes = new ArrayDeque<>(); idxes.add(0); int[] value = new int[n]; while (idxes.size() > 0) { int x = idxes.poll(); for (Path y : graph.get(x)) { value[y.idx] = Math.max(value[y.idx], value[x] + y.value); counts[y.idx]--; if(counts[y.idx] == 0) { idxes.add(y.idx); } } } idxes.add(n - 1); int[] rValue = new int[n]; Arrays.fill(rValue, Integer.MAX_VALUE); rValue[n - 1] = value[n - 1]; while (idxes.size() > 0) { int x = idxes.poll(); for (Path y : reverse.get(x)) { rValue[y.idx] = Math.min(rValue[y.idx], rValue[x] - y.value); rCounts[y.idx]--; if(rCounts[y.idx] == 0) { idxes.add(y.idx); } } } int ans = 0; for (int i = 0; i < n; i++) { if (rValue[i] > value[i]) { ans++; } } System.out.print(value[n - 1]); System.out.println(" " + ans + "/" + n); } static class Path { int idx; int value; public Path(int idx, int value) { this.idx = idx; this.value = value; } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }