#include <bits/stdc++.h>
using namespace std;
const int MAX = 202, oo = 1 << 29, ML = 20000;
int d[MAX][MAX], c[MAX][MAX], A[ML], B[ML], W[ML];
int pos[MAX], u, v, w, L, R;
double X;
int CV[MAX];
bool cmp(int a, int b) {
  if (d[u][a] == d[u][b]) return d[v][a] < d[v][b];
  return d[u][a] < d[u][b];
}
int main() {
  int N, M, i, j, k, y = oo, p;
  scanf("%d%d", &N, &M);
  for (i = 0; i < N; i++) {
    for (j = 0; j < i; j++) d[i][j] = d[j][i] = c[i][j] = c[j][i] = oo;
    d[i][i] = c[i][i] = 0;
    pos[i] = i;
  }
  for (i = 0; i < M; i++) {
    scanf("%d%d%d", &u, &v, &w), u--, v--;
    A[i] = u, B[i] = v, W[i] = w;
    d[u][v] = d[v][u] = c[u][v] = c[v][u] = min(c[u][v], w);
  }
  for (k = 0; k < N; k++)
    for (i = 0; i < N; i++)
      if (d[i][k] < oo)
        for (j = 0; j < N; j++) d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
  for (i = 0; i < M; i++) {
    u = A[i], v = B[i], w = W[i];
    sort(pos, pos + N, cmp);
    for (j = 0, k = 0; j < N; j++) {
      p = pos[j];
      while (k && d[v][p] >= d[v][CV[k - 1]]) k--;
      CV[k++] = p;
    }
    if (k == 1) {
      p = CV[0];
      if (y <= min(d[u][p], d[v][p]) * 2) continue;
      L = u, R = v, p = CV[0], y = min(d[u][p], d[v][p]) * 2;
      X = d[u][p] > d[v][p] ? w : 0;
    } else {
      for (j = 0; j < k - 1; j++) {
        int _w = d[u][CV[j]] + d[v][CV[j + 1]] + w;
        if (_w < y) {
          y = _w;
          L = u, R = v, X = y * 0.5 - d[u][CV[j]];
        }
      }
    }
  }
  printf("%d", y / 2);
  if (y & 1) printf(".5");
  printf("\n");
  return 0;
}
