#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > fl;
int n, m;
int dis[300][300], u[40010], v[40010], d[40010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) dis[i][j] = 1000000007;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &u[i], &v[i], &d[i]);
    d[i] *= 2;
    dis[u[i]][v[i]] = dis[v[i]][u[i]] = min(dis[u[i]][v[i]], d[i]);
  }
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  int ans = 1000000007;
  for (int i = 1; i <= m; i++) {
    int x = u[i], y = v[i];
    fl.clear();
    for (int j = 1; j <= n; j++) fl.push_back(make_pair(dis[x][j], j));
    sort(fl.begin(), fl.end());
    int r = 0, l = 0;
    for (int j = n - 1; j >= 0; j--) {
      l = dis[x][fl[j].second];
      int mid = (l + r + d[i]) / 2;
      if ((mid >= l) && (mid <= l + d[i])) ans = min(ans, mid);
      r = max(dis[y][fl[j].second], r);
    }
  }
  printf("%.9lf\n", ans / 2.0);
  return 0;
}
