#include <bits/stdc++.h>
using namespace std;
int dist[205][205];
int edges[205 * 205][3];
int N, M;
int ans;
pair<int, int> events[205];
void test(int ind) {
  int u = edges[ind][0];
  int v = edges[ind][1];
  int c = edges[ind][2];
  for (int i = 1; i <= N; i++) {
    events[i].first = dist[u][i];
    events[i].second = dist[v][i];
  }
  sort(events + 1, events + N + 1);
  int maxB = events[N].second;
  ans = min(ans, events[N].first);
  for (int i = N - 1; i >= 1; i--) {
    int temp;
    if (events[i].first > maxB - c && maxB + c > events[i].first)
      temp = (events[i].first + maxB + c) / 2.0;
    else
      temp = max(events[i].first, maxB);
    ans = min(ans, temp);
    maxB = max(maxB, events[i].second);
  }
}
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) dist[i][j] = 1000000000;
    dist[i][i] = 0;
  }
  for (int i = 0; i < M; i++) {
    scanf("%d %d %d", &edges[i][0], &edges[i][1], &edges[i][2]);
    edges[i][2] *= 2;
    dist[edges[i][0]][edges[i][1]] =
        min(dist[edges[i][0]][edges[i][1]], edges[i][2]);
    dist[edges[i][1]][edges[i][0]] = dist[edges[i][0]][edges[i][1]];
  }
  for (int k = 1; k <= N; k++)
    for (int i = 1; i <= N; i++)
      for (int j = 1; j <= N; j++)
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
  ans = 1000000000;
  for (int i = 0; i < M; i++) {
    test(i);
  }
  printf("%.2lf\n", (double)ans / 2.0);
  return 0;
}
