Problem: BerDonalds, a well-known fast food restaurant, is going to open a cafe in Bertown. The important thing is to choose the new restaurant's location so that it would be easy to get there. The Bertown road system is represented by n junctions, connected by m bidirectional roads. For each road we know its length. We also know that we can get from any junction to any other one, moving along the roads.

Your task is to find such location of the restaurant, that the shortest distance along the roads from the cafe to the farthest junction would be minimum. Note that the restaurant can be located not only on the junction, but at any point of any road.

Input

The first line contains two integers n and m (<image>) — the number of junctions and the number of roads, correspondingly. Then m lines follow, describing all Bertown roads. Each road is described by three integers ai, bi, wi (1 ≤ ai, bi ≤ n, ai ≠ bi; 1 ≤ wi ≤ 105), where ai and bi are the numbers of the junctions, connected by the i-th road, and wi is the length of the i-th road. 

It is guaranteed that each road connects two distinct junctions, there is at most one road between any two junctions, and you can get from any junction to any other one.

Output

Print a single real number — the shortest distance from the optimal restaurant location to the farthest junction. The answer will be considered correct, if its absolute or relative error doesn't exceed 10 - 9.

Examples

Input

2 1
1 2 1


Output

0.50


Input

3 3
1 2 1
2 3 1
1 3 1


Output

1.00


Input

3 2
1 2 100
2 3 1


Output

50.50

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int mm, md, mu, n, m, w[40000], t[40000], pr[40000], a[205][205], p[205],
    nn[205], p1[205], nn1[205];
long double qq, mx, mx1, ans = 1000000000, q[205], b[205], b1[205], q1[205];
void sort(int l, int r, long double* a, int* b, long double* c, int* nn) {
  int i = l, j = r, h;
  long double d = a[i + rand() % (j - i + 1)], x;
  do {
    while (d - a[i] >= 1e-15) i++;
    while (a[j] - d >= 1e-15) j--;
    if (i <= j) {
      x = a[i];
      a[i] = a[j];
      a[j] = x;
      h = b[i];
      b[i] = b[j];
      b[j] = h;
      x = c[i];
      c[i] = c[j];
      c[j] = x;
      h = nn[i];
      nn[i] = nn[j];
      nn[j] = h;
      i++;
      --j;
    }
  } while (i <= j);
  if (i < r) sort(i, r, a, b, c, nn);
  if (l < j) sort(l, j, a, b, c, nn);
}
int main() {
  cin >> n >> m;
  int i, j, k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) a[i][j] = 1000000000;
  for (i = 1; i <= n; i++) a[i][i] = 0;
  for (i = 1; i <= m; i++) {
    cin >> w[i] >> t[i] >> pr[i];
    a[w[i]][t[i]] = pr[i];
    a[t[i]][w[i]] = pr[i];
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      for (k = 1; k <= n; k++)
        if (a[j][i] + a[i][k] < a[j][k]) a[j][k] = a[j][i] + a[i][k];
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      q[j] = 1.0 * (a[t[i]][j] + pr[i] - a[w[i]][j]) / 2;
      if (q[j] <= 1e-15 || q[j] - pr[i] >= 1e-15)
        p[j] = -1;
      else
        p[j] = 1;
      b[j] = a[w[i]][j];
      p1[j] = p[j];
      b1[j] = b[j];
      q1[j] = q[j];
      nn[j] = j;
    }
    sort(1, n, q, p, b, nn);
    for (j = 1; j <= n; j++) {
      nn[j] = j;
      nn1[j] = j;
      b1[j] = b[j];
      q1[j] = q[j];
      p1[j] = p[j];
    }
    sort(1, n, b1, p1, q1, nn1);
    j = n;
    while (p1[j] == 1 && j > 0) j--;
    md = nn1[j];
    mm = n;
    while (p1[mm] == -1 && mm > 0) mm--;
    mu = nn1[mm];
    for (j = 1; j <= n; j++) nn[nn1[j]] = j;
    for (j = 2; j <= n; j++)
      if (q[j] >= -1e-15 && pr[i] - q[j] >= -1e-15) {
        if (md == 0) {
          md = j;
          if (ans - (b[mu] + q[j - 1]) >= 1e-15) ans = b[mu] + q[j - 1];
        } else if (mu == 0) {
          if (ans - (b[md] - q[j]) >= 1e-15) ans = b[md] - q[j];
        } else {
          qq = (b[md] - b[mu]) / 2;
          if (qq - q[j - 1] >= -1e-15 && q[j] - qq >= -1e-15 &&
              ans - (b[mu] + qq) >= 1e-15)
            ans = b[mu] + qq;
          else if ((q[j - 1] - qq >= 1e-15 || qq - q[j] >= 1e-15) &&
                   fabs(q[j] - q[j - 1]) > 0.000001) {
            if (b[md] - q[j - 1] - (b[mu] + q[j - 1]) >= 1e-15 &&
                ans - (b[md] - q[j - 1]) >= 1e-15)
              ans = b[md] - q[j - 1];
            else if (-(b[md] - q[j - 1]) + (b[mu] + q[j - 1]) >= 1e-15 &&
                     ans - (b[mu] + q[j - 1]) >= 1e-15)
              ans = b[mu] + q[j - 1];
            if (b[md] - q[j] - (b[mu] + q[j]) >= 1e-15 &&
                ans - (b[md] - q[j]) >= 1e-15)
              ans = b[md] - q[j];
            else if (-(b[md] - q[j]) + (b[mu] + q[j]) >= 1e-15 &&
                     ans - (b[mu] + q[j]) >= 1e-15)
              ans = b[mu] + q[j];
          }
        }
        if (b[j] + q[j] - (b[md] - q[j]) >= 1e-15) md = j;
        p[j] = -1;
        b[j] = b[j] + 2 * q[j];
        p1[nn[j]] = -1;
        b1[nn[j]] = b[j];
        while (m > 0 && p1[mm] == -1) mm--;
        mu = nn1[mm];
      }
  }
  cout << fixed << setprecision(10) << ans << endl;
}