#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
struct edge
{
    int v,w,k;
    edge(){}
    edge(int _v, int _w, int _k)
    {
        v = _v;
        w = _w;
        k = _k;
    }
};

const int N = 1e5 + 5;
const long long oo = 1e18;

vector <edge> adj[N];

long long dis[N];

int n,m,s,t;

bool mini(long long &a, long long b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("file.inp","r",stdin);
    cin >> n >> m >> s >> t;
    for (int i = 1; i <= m; i++)
    {
        int u,v,w,k;
        cin >> u >> v >> w >> k;
        adj[u].push_back(edge(v, w, k));
        adj[v].push_back(edge(u, w, k));
    }

    priority_queue <pair <long long, int>> heap;

    for (int i = 1; i <= n; i++)
        dis[i] = oo;

    dis[s] = 0;
    heap.push(mp(0, s));

    while (heap.size())
    {
        int u = heap.top().se;
        long long cur = -heap.top().fi;
        heap.pop();

        if (dis[u] != cur)
            continue;

        for (edge to : adj[u])
        {
            int v = to.v;
            int w = to.w;
            int k = to.k;

            long long st = cur / k * k + (cur % k > 0) * k;
            if (mini(dis[v], st + w))
                heap.push(mp(-dis[v], v));
        }
    }

    if (dis[t] == oo)
        cout << -1;
    else
        cout << dis[t];
    return 0;
}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 998244353 //1000000009
#define cont continue
#define PI 3.141592653589793238462643383279502
#define debug(n1) cout<<"debug... "<<n1<<"\n"
const ll INF=(1ll<<60)-1;//ll ans = 3e18 + 5;
#define sq(a) ( (a)*(a) )
////////////////////////////////////////////////////////
ld dp[101][101][101];

ld xd( ll i , ll j , ll k )
{
    if( dp[i][j][k] > 0 )
    return dp[i][j][k];
    if( i>=100 || j>=100 || k>=100 )
    return 0.0;

    dp[i][j][k] = (ld)i/(i+j+k)*( 1 + xd(i+1,j,k ) ) + (ld)j/(i+j+k)*( 1 + xd(i,j+1,k ) ) + (ld)k/(i+j+k)*( 1 + xd(i,j,k+1 ) ) ; 
    return dp[i][j][k];
}

////////////////////////////////////////////////////////
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tc=1;
    // cin>>tc;
    while(tc--)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        memset(dp,-1,sizeof(dp));
        ld ans = xd(a,b,c);
        cout<< fixed << setprecision(12) << ans;
    }
}
