#include <bits/stdc++.h>
using namespace std;
const int MaxN = 210;
const int MaxM = MaxN * MaxN;
const int INF = 1000000000;
int n, m;
int x[MaxM], y[MaxM], w[MaxM];
int d[MaxN][MaxN];
void init() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (i != j) d[i][j] = INF;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &x[i], &y[i], &w[i]);
    w[i] *= 2;
    d[x[i]][y[i]] = d[y[i]][x[i]] = min(d[x[i]][y[i]], w[i]);
  }
  for (int k = 1; k <= n; ++k)
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}
pair<int, int> p[MaxN];
void work() {
  int ans = INF;
  for (int k = 1; k <= m; ++k) {
    for (int i = 1; i <= n; ++i) p[i] = pair<int, int>(d[i][x[k]], d[i][y[k]]);
    sort(p + 1, p + n + 1);
    ans = min(ans, p[n].first);
    for (int i = n - 1, j = n; i >= 1; --i) {
      if (p[i].second <= p[j].second) continue;
      ans = min(ans, (w[k] + p[i].first + p[j].second) / 2);
      j = i;
    }
  }
  cout << ans * 0.5 << endl;
}
int main() {
  init();
  work();
  return 0;
}
