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;
double anss;
int hh[210], ecnt;
int n;
int in[210], dis[210][210];
int tdis1[210], tdis2[210];
double cal(double l, double w) {
  double anss = 0;
  for (int i = 1; i <= n; i++) {
    if (tdis1[i] == -1)
      anss = max(anss, w - l + tdis2[i]);
    else if (tdis2[i] == -1)
      anss = max(anss, l + tdis1[i]);
    else
      anss = max(anss, min(w - l + tdis2[i], l + tdis1[i]));
  }
  return anss;
}
int uu[40010], vv[40010], ww[40010];
struct node {
  double l, r;
};
node p[210];
int sgn(double x) {
  if (fabs(x) < 1e-10) return 0;
  return x > 0 ? 1 : -1;
}
bool cmp(const node &a, const node &b) {
  if (sgn(a.l - b.l) != 0) return a.l < b.l;
  return a.r > b.r;
}
int main() {
  int m;
  scanf("%d%d", &n, &m);
  memset(dis, -1, sizeof(dis));
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &uu[i], &vv[i], &ww[i]);
    int u = uu[i], v = vv[i], w = ww[i];
    if (dis[u][v] == -1 || dis[u][v] > w) dis[u][v] = dis[v][u] = w;
  }
  anss = -100;
  for (int i = 1; i <= n; i++) dis[i][i] = 0;
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        if (dis[i][k] == -1) continue;
        if (dis[k][j] == -1) continue;
        if (dis[i][j] == -1 || dis[i][j] > dis[i][k] + dis[k][j])
          dis[i][j] = dis[i][k] + dis[k][j];
      }
  int maxx = 0;
  for (int s = 1; s <= n; s++) {
    for (int i = 1; i <= n; i++) maxx = max(maxx, dis[s][i]);
    if (anss < -50)
      anss = maxx * 1.0;
    else
      anss = min(anss, maxx * 1.0);
  }
  double L = 0;
  double R = anss;
  for (int i = 0; i < m; i++) {
    int u = uu[i], v = vv[i], w = ww[i];
    for (int k = 1; k <= n; k++) tdis1[k] = tdis2[k] = -1;
    bool ck = true;
    int maxx = 0;
    for (int k = 1; k <= n; k++) {
      if (dis[v][k] + w > dis[u][k]) tdis1[k] = dis[u][k];
      if (dis[u][k] + w > dis[v][k]) tdis2[k] = dis[v][k];
      int minn = tdis1[k];
      if (minn == -1 || (tdis2[k] != -1 && minn > tdis2[k])) minn = tdis2[k];
      maxx = max(maxx, minn);
      if (minn > R) {
        ck = false;
        break;
      }
    }
    if (!ck) continue;
    L = maxx;
    while (fabs(L - R) > 1e-9) {
      double mid = (L + R) / 2.0;
      for (int j = 1; j <= n; j++) {
        p[j - 1].l = min(w * 1.0, mid - dis[u][j]);
        p[j - 1].r = w - min(w * 1.0, mid - dis[v][j]);
        p[j - 1].l = max(p[j - 1].l, 0.0);
        p[j - 1].r = min(p[j - 1].r, w * 1.0);
      }
      sort(p, p + n, cmp);
      double ll = 0, rr = 0;
      bool ok = false;
      for (int j = 0; j < n; j++) {
        if (sgn(rr - w) == 0) break;
        if (sgn(p[j].l - rr) > 0) {
          ok = true;
          break;
        } else
          rr = max(p[j].r, rr);
      }
      if (sgn(rr - w) < 0) ok = true;
      if (ok)
        R = mid;
      else
        L = mid;
    }
    anss = min(anss, L);
  }
  printf("%.15f\n", anss);
}