let n, m = Scanf.scanf "%d %d" (fun x y -> x, y);; let inf = max_int / 4;; let g = Array.make_matrix n n (-inf);; for i = 1 to m do let a, b, c = Scanf.scanf " %d %d %d" (fun x y z -> x-1, y-1, z) in g.(a).(b) <- max g.(a).(b) c; g.(b).(a) <- max g.(b).(a) c; done;; let dp = Array.make_matrix (1 lsl n) (n) (-inf);; for i = 0 to n - 1 do dp.(1 lsl i).(i) <- 0; done;; for i = 0 to (1 lsl n) - 1 do for j = 0 to n - 1 do for k = 0 to n - 1 do if (i lsr k) mod 2 == 0 then dp.(i lor (1 lsl k)).(k) <- max dp.(i lor (1 lsl k)).(k) (dp.(i).(j) + g.(j).(k)); done done done;; let ans = ref (-inf);; for i = 0 to (1 lsl n) - 1 do for j = 0 to n - 1 do ans := max !ans dp.(i).(j); done done;; Printf.printf "%d\n" !ans;;