using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Edge : IComparable
    {
        internal int from, to, weight;

        public Edge(int s, int t, int d)
        {
            from = s;
            to = t;
            weight = d;
        }

        public int CompareTo(object obj)
        {
            Edge other = obj as Edge;

            if (weight != other.weight) return other.weight - weight;   // reverse
            if (from != other.from) return from - other.from;
            else return to - other.to;
        }
    }

    class Program
    {
        static readonly int INFTY = int.MaxValue / 2;

        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int V = input[0];
            int E = input[1];

            Dictionary<int, List<Edge>> G = new Dictionary<int, List<Edge>>();
            for (int i = 0; i < V; i++) G.Add(i, new List<Edge>());

            for (int i = 0; i < E; i++)
            {
                input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                int s = input[0];
                int t = input[1];
                int d = input[2];

                G[s].Add(new Edge(s, t, d));
                G[t].Add(new Edge(t, s, d));
            }
            Console.WriteLine(ChinesePostman(G));
        }

        static int ChinesePostman(Dictionary<int, List<Edge>> G)
        {
            int V = G.Count, total = 0;
            List<int> odds = new List<int>();

            for (int i = 0; i < V; i++)
            {
                foreach (var e in G[i]) total += e.weight;

                if (G[i].Count % 2 != 0) odds.Add(i);
            }

            total /= 2;
            int n = odds.Count;
            int N = 1 << n;

            int[,] W = new int[n, n];

            for (int u = 0; u < n; u++)
            {
                int s = odds[u];

                int[] dist = new int[V];
                int[] prev = new int[V];

                for (int i = 0; i < V; i++)
                {
                    dist[i] = INFTY;
                    prev[i] = -2;
                }

                dist[s] = 0;

                PriorityQueue<Edge> PQ = new PriorityQueue<Edge>();
                PQ.Enqueue(new Edge(-1, s, 0));

                while (PQ.Count() > 0)
                {
                    Edge e = PQ.Dequeue();

                    if (prev[e.to] != -2) continue;

                    prev[e.to] = e.from;

                    foreach (var f in G[e.to])
                    {
                        int tempWeight = e.weight + f.weight;

                        if (dist[f.to] > tempWeight)
                        {
                            dist[f.to] = tempWeight;

                            PQ.Enqueue(new Edge(f.from, f.to, tempWeight));
                        }
                    }
                }

                for (int v = 0; v < n; v++) W[u, v] = dist[odds[v]];
            }

            int[] dp = Enumerable.Repeat(INFTY, N).ToArray();
            dp[0] = 0;

            for (int S = 0; S < N; S++)
            {
                for (int i = 0; i < n; i++)
                {
                    if ((S & (1 << i)) != 0) continue;

                    for (int j = i + 1; j < n; j++)
                    {
                        if ((S & (1 << j)) != 0) continue;

                        dp[S | (1 << i) | (1 << j)] = Math.Min(dp[S | (1 << i) | (1 << j)], dp[S] + W[i, j]);
                    }
                }
            }

            return total + dp[N - 1];
        }
    }

    class PriorityQueue<T> where T : IComparable
    {
        List<T> heap;
        int size;

        public PriorityQueue()
        {
            heap = new List<T>();
        }

        public void Enqueue(T x)
        {
            heap.Add(x);
            int i = size++;

            while (i > 0)
            {
                int p = (i - 1) / 2;

                if (Compare(heap[p], x) <= 0) break;

                heap[i] = heap[p];
                i = p;
            }
            heap[i] = x;
        }

        public T Dequeue()
        {
            T ret = heap[0];
            T x = heap[--size];

            int i = 0;
            while (i * 2 + 1 < size)
            {
                int a = i * 2 + 1;
                int b = i * 2 + 2;

                if (b < size && Compare(heap[b], heap[a]) < 0)
                    a = b;
                if (Compare(heap[a], x) >= 0)
                    break;

                heap[i] = heap[a];
                i = a;
            }
            heap[i] = x;
            heap.RemoveAt(size);
            return ret;
        }

        public int Count()
        {
            return size;
        }

        private int Compare(T x, T y)
        {
            return y.CompareTo(x);
        }
    }
}

Measured memory_bytes: 10292