#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template static void amin(T &x, U y) { if (y < x) x = y; } template static void amax(T &x, U y) { if (x < y) x = y; } int main() { int N; int M; while (~scanf("%d%d", &N, &M)) { vector > > gw(N); for (int i = 0; i < M; ++i) { int u, v, w; scanf("%d%d%d", &u, &v, &w); gw[u].push_back(make_pair(v, w)); } vector deg(N, 0); vector ord(N, -1); vector time(N, 0); rep(i, N) for (auto e : gw[i]) ++deg[e.first]; int t = 0; ord[t++] = 0; for (int h = 0; h < t; h++) { int i = ord[h]; for (auto e : gw[i]) { amax(time[e.first], time[i] + e.second); if (--deg[e.first] == 0) ord[t++] = e.first; } } assert(t == N); int num = 0; vector latest(N, INF); latest[N - 1] = time[N - 1]; for (int ix = N - 1; ix >= 0; --ix) { int i = ord[ix]; for (auto e : gw[i]) amin(latest[i], latest[e.first] - e.second); num += latest[i] != time[i]; } printf("%d %d/%d\n", time[N - 1], num, N); } return 0; }