import java.util.*; 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) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); for (int i = 0; i < n; i++) { graph.add(new HashMap<>()); rgraph.add(new HashMap<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); 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]; } }