#include <bits/stdc++.h>
using namespace std;
struct emt {
  long a, b;
} bk[20005][202];
long a[202][202], b[202][202], z0[20005];
long num[202][202], n, m;
long tot[20005];
bool cmp(emt x, emt y) { return (x.a < y.a); }
bool check(long len) {
  long i, j, k, dk;
  long bh0, bh1, maxn;
  memset(tot, 0, sizeof(tot));
  for (k = 1; k <= n; k++)
    for (i = 1; i <= n - 1; i++)
      for (j = i + 1; j <= n; j++)
        if (a[i][j] >= 0) {
          if (b[k][i] + a[i][j] <= len)
            bh0 = a[i][j];
          else
            bh0 = len - b[k][i];
          if (b[k][j] + a[j][i] <= len)
            bh1 = a[j][i];
          else
            bh1 = len - b[k][j];
          if (max((long)0, bh0) + max((long)0, bh1) >= a[i][j]) continue;
          dk = num[i][j];
          if (bh0 < 0) bh0 = -1;
          if (bh1 < 0) bh1 = -1;
          bh1 = a[j][i] - bh1;
          bh0++;
          bh1--;
          if (bh0 <= bh1) {
            tot[dk]++;
            bk[dk][tot[dk]].a = bh0;
            bk[dk][tot[dk]].b = bh1;
          }
        }
  for (i = 1; i <= m; i++) {
    sort(bk[i] + 1, bk[i] + tot[i] + 1, cmp);
    if (bk[i][1].a > 0) return (true);
    maxn = 0;
    for (j = 1; j <= tot[i]; j++)
      if (maxn >= bk[i][j].a)
        maxn = max(maxn, bk[i][j].b + 1);
      else
        return (true);
    if (maxn <= z0[i]) return (true);
  }
  return (false);
}
int main() {
  long i, j, k, x, y, z;
  scanf("%ld%ld", &n, &m);
  memset(a, -1, sizeof(a));
  for (i = 1; i <= m; i++) {
    scanf("%ld%ld%ld", &x, &y, &z);
    z0[i] = z * 2;
    a[x][y] = a[y][x] = z;
    num[x][y] = num[y][x] = i;
  }
  for (i = 1; i <= n; i++) a[i][i] = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (a[i][j] >= 0)
        b[i][j] = a[i][j];
      else
        b[i][j] = 100000000;
  for (k = 1; k <= n; k++)
    for (i = 1; i <= n; i++)
      for (j = 1; j <= n; j++) b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      a[i][j] *= 2;
      if (b[i][j] < 100000000) b[i][j] *= 2;
    }
  long l = 0, r = 0, mid;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (b[i][j] <= 100000000) r = max(r, b[i][j]);
  while (r - l > 1) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  double ans = ((double)r) / 2;
  printf("%.2lf\n", ans);
  return 0;
}
