import java.util.*; import java.io.*; public class Main { static ArrayList> graph = new ArrayList<>(); static ArrayList> rgraph = new ArrayList<>(); static int[] costs; static int[] rcosts; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); for (int i = 0; i < n; i++) { graph.add(new HashMap<>()); rgraph.add(new HashMap<>()); } for (int i = 0; i < m; i++) { String[] line = br.readLine().split(" ", 3); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); int c = Integer.parseInt(line[2]); graph.get(a).put(b, c); rgraph.get(b).put(a, c); } costs = new int[n]; Arrays.fill(costs, -1); costs[0] = 0; dfw(n - 1); rcosts = new int[n]; Arrays.fill(rcosts, Integer.MAX_VALUE); rcosts[n - 1] = costs[n - 1]; rdfw(0); int ans = 0; for (int i = 0; i < n; i++) { if (costs[i] < rcosts[i]) { ans++; } } System.out.println(costs[n - 1] + " " + ans + "/" + n); } static int rdfw(int idx) { if (rcosts[idx] == Integer.MAX_VALUE) { for (int x : graph.get(idx).keySet()) { rcosts[idx] = Math.min(rcosts[idx], rdfw(x) - graph.get(idx).get(x)); } } return rcosts[idx]; } static int dfw(int idx) { if (costs[idx] < 0) { for (int x : rgraph.get(idx).keySet()) { costs[idx] = Math.max(costs[idx], dfw(x) + rgraph.get(idx).get(x)); } } return costs[idx]; } }