#include <bits/stdc++.h>
using namespace std;
int f[205][205];
struct edge {
  int a, b, v;
} w[205 * 205];
pair<int, int> node[205];
int n, m;
int main() {
  memset(f, 63, sizeof f);
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (int)n; i++) f[i][i] = 0;
  for (int i = (1); i <= (int)m; i++) {
    scanf("%d%d%d", &w[i].a, &w[i].b, &w[i].v);
    f[w[i].a][w[i].b] = w[i].v;
    f[w[i].b][w[i].a] = w[i].v;
  }
  for (int k = (1); k <= (int)n; k++)
    for (int i = (1); i <= (int)n; i++)
      for (int j = (1); j <= (int)n; j++)
        f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
  int Res = f[0][0];
  for (int i = (1); i <= (int)m; i++) {
    for (int j = (1); j <= (int)n; j++)
      node[j] = (pair<int, int>){f[j][w[i].a], f[j][w[i].b]};
    sort(node + 1, node + 1 + n);
    int Max = node[n].second;
    int ans = node[n].first * 2;
    for (int j = (n - 1); j >= (int)1; j--) {
      if (node[j].second > Max) ans = min(ans, Max + node[j].first + w[i].v);
      Max = max(Max, node[j].second);
    }
    ans = min(ans, Max * 2);
    Res = min(Res, ans);
  }
  if (Res & 1)
    printf("%d.5", Res / 2);
  else
    printf("%d\n", Res / 2);
  return 0;
}
