#include <bits/stdc++.h>
using namespace std;
const int SIZE = 202;
int n, m;
int from[SIZE * SIZE], to[SIZE * SIZE], cst[SIZE * SIZE], mat[SIZE][SIZE];
void floyd() {
  for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        mat[i][j] = mat[j][i] = min(mat[i][j], mat[i][k] + mat[k][j]);
}
int main() {
  for (int i = 0; i < SIZE; i++) {
    fill(mat[i], mat[i] + SIZE, 1 << 28);
    mat[i][i] = 0;
  }
  scanf("%d%d", &n, &m);
  int a, b, c;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    --a, --b, c *= 2;
    mat[a][b] = mat[b][a] = c;
    from[i] = a, to[i] = b, cst[i] = c;
  }
  floyd();
  int mn = 1 << 28;
  for (int k = 0; k < m; k++) {
    map<int, vector<int> > ev;
    set<pair<int, int> > lf, rt;
    int len = mat[from[k]][to[k]];
    for (int i = 0; i < n; i++) {
      int a = mat[i][from[k]], b = mat[i][to[k]];
      int x = (b + len - a) / 2;
      if (x > 0 && x <= len) ev[x].push_back(i);
      if (a < b + len)
        lf.insert(make_pair((a), (i)));
      else
        rt.insert(make_pair((b), (i)));
    }
    ev[0];
    ev[len];
    for (auto it = (ev).begin(); (it) != ev.end(); ++(it)) {
      vector<int> &v = it->second;
      for (int l = 0; l < ((int)(v).size()); l++) {
        int i = v[l];
        int a = mat[i][from[k]], b = mat[i][to[k]];
        lf.erase(make_pair((a), (i)));
        rt.insert(make_pair((b), (i)));
      }
      int x1 = 0, x2 = 0;
      if (((int)(lf).size())) x1 = lf.rbegin()->first;
      if (((int)(rt).size())) x2 = rt.rbegin()->first;
      int ps = (x1 + x2 + len) / 2 - x1;
      if (ps > len || ps < 0) continue;
      mn = min(mn, max(x1 + ps, x2 + len - ps));
    }
  }
  printf("%.1lf\n", mn / 2.0);
  return 0;
}
