#include using namespace std; using ll = long long; using PII = std::pair; using PLL = std::pair; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) const int mod = 1e9 + 7; const ll maxint = 1e15; vector shortest, shortest2, indegree, outdegree; vector>> connective, connective2; void djkstra(int x, vector>> connective, vector &shortest, vector °ree) { vector search = {x}; vector new_search; shortest[x] = 0; int v, d; while (!search.empty()) { for (auto itr = search.begin(); itr != search.end(); itr++) { for (auto itr2 = connective[*itr].begin(); itr2 != connective[*itr].end(); itr2++) { v = itr2->first, d = itr2->second; degree[v] -= 1; shortest[v] = max(shortest[v], shortest[*itr] + d); if (degree[v] == 0) new_search.push_back(v); } } search.clear(); search = new_search; new_search.clear(); } } int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif int n, m, s, t, c, r; cin >> n >> m; connective.resize(n), connective2.resize(n); rep(i, n) { shortest.push_back(0); shortest2.push_back(0); indegree.push_back(0); outdegree.push_back(0); } rep(i, m) { cin >> s >> t >> c; connective[s].push_back(make_pair(t, c)); connective2[t].push_back(make_pair(s, c)); indegree[s] += 1; outdegree[t] += 1; } djkstra(0, connective, shortest, outdegree); djkstra(n - 1, connective2, shortest2, indegree); r = 0; rep(i, n) { shortest2[i] = shortest[n - 1] - shortest2[i]; if (shortest[i] == shortest2[i]) r++; } cout << shortest[n - 1] << " " << n - r << "/" << n << endl; return 0; }