#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>
using namespace std;
#define all(x) (x).begin(),x.end()
#define ii pair<int, int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define MAXN 100001
#define INF LLONG_MAX
int n, m;
vector<int> eList[MAXN], erList[MAXN];
vector<ll> cList[MAXN], crList[MAXN], dList[MAXN];
void dijkstra(int start, vector<int> *eList, vector<ll> *cList, vector<ll> &d) {
priority_queue<ii, vector<ii>, greater<ii> > q;
bool mark[MAXN];
memset(mark, 0, sizeof(mark));
d[start] = 0;
q.push(ii(0, start));
while (!q.empty()) {
ii top = q.top();
q.pop();
int i = top.second;
if (mark[i] == true) {
continue;
}
mark[i] = true;
for (int k = 0; k < (int)eList[i].size(); k++) {
int j = eList[i][k];
int c = cList[i][k];
if (mark[j] == false && d[j] > d[i] + c) {
d[j] = d[i] + c;
q.push(ii(d[j], j));
}
}
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
int u, v;
ll p, x;
for (int i = 0; i < m; i++) {
cin >> u >> v >> p >> x;
u--; v--;
eList[u].pb(v);
cList[u].pb(p);
dList[u].pb(x);
erList[v].pb(u);
crList[v].pb(p);
}
vector<ll> d(n, INF);
dijkstra(0, eList, cList, d);
vector<ll> dr(n, INF);
dijkstra(n-1, erList, crList, dr);
double res = INF;
for (int i = 0; i < n; i++) {
for (int k = 0; k < (int)eList[i].size(); k++) {
int j = eList[i][k];
if (d[i] != INF && dr[j] != INF) {
// cout << i << " " << j << " " << d[i] << " " << dr[j] << endl;
res = min(res, (d[i] + cList[i][k] + dr[j])*dList[i][k]*0.01);
}
}
}
cout << res << endl;
return 0;
}