#define PROC “coconut” #include #include #include

using namespace std;

struct edge { int t, v; edge *next; };

const int maxn = 509; const int maxe = 6009; const double bseps = 1e-4; const double finf = 1e20;

int n, m, fp[maxn], st, vis[maxn], tvis; edge ebuf_arr[maxe], *ebuf(ebuf_arr), *head[maxn]; double d[maxn];

inline void addEdge(int u, int v, int w) { ebuf-> t = v; ebuf-> v = w; ebuf-> next = head[u]; head[u] = ebuf ++; // printf(“AE %d -> %d of %d\n”, u, v, w); }

#define recycle(x) {
if (x == maxn)
x = 0;
} bool check(double s) { static int q[maxn], iq[maxn]; int hd(0), tl(1); memset(iq, 0, sizeof(iq)); for (int i = 1; i <= n + 2; ++ i) d[i] = finf; d[q[0] = st] = 0; fp[st] = 0; while (hd ^ tl) { int p(q[hd ++]); recycle(hd); iq[p] = 0; vis[p] = ++ tvis; for (int q = fp[p]; q && q != st; q = fp[q]) if (vis[q] == tvis) return 1; else vis[q] = tvis; for (edge* e = head[p]; e; e = e-> next) if (d[p] + e-> v + s < d[e-> t]) { d[e-> t] = d[p] + e-> v + s; fp[e-> t] = p; if (!iq[e-> t]) { iq[e-> t] = 1; q[tl ++] = e-> t; recycle(tl); } } } return 0; }

int main() { #ifndef ONLINE_JUDGE freopen(PROC “.in”, “r”, stdin); freopen(PROC “.out”, “w”, stdout); #endif

scanf("%d%d", &n, &m);
st = n + 1;
for (int i = 0; i < m; ++ i) {
	int u, v, a, b, c, d;
	scanf("%d%d%d%d%d%d", &u, &v, &a, &b, &c, &d);
	addEdge(u, v, b + d);
	if (u != st && c)
		addEdge(v, u, a - d);
}
double l(0), r(10000);
memset(vis, 0, sizeof(vis));
tvis = 0;
while (l + bseps < r) {
	double mid((l + r + bseps) / 2.0);
	if (check(mid))
		l = mid;
	else
		r = mid - bseps;
}
printf("%.2lf\n", l);

}