Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n==0 and m==0) break;
        vector<vector<tuple<int,long double,long double>>> graph(n);
        int s,g;
        cin >> s >> g;
        --s;
        --g;
        rep(i,0,m){
            int x,y;
            long double d,c;
            cin >> x >> y >> d >> c;
            --x;
            --y;
            graph[x].emplace_back(make_tuple(y,d,c));
            graph[y].emplace_back(make_tuple(x,d,c));
        }

        vector<vector<long double>> dist(n,vector<long double>(31,inf));
        priority_queue<tuple<long double,int,int>,vector<tuple<long double,int,int>>,greater<tuple<long double,int,int>>> que;
        dist[s][0]=0;
        que.push(make_tuple(0,s,0));
        while(!que.empty()){
            const tuple<long double,int,int> tup=que.top();
            que.pop();
            const long double d=get<0>(tup);
            const int v=get<1>(tup),spd=get<2>(tup);
            if(d>dist[v][spd]) continue;
            for(const auto& e:graph[v]){
                const auto w=get<0>(e);
                rep(i,-1,2){
                    const int next_spd=spd+i;
                    if(next_spd<=0 or next_spd>get<2>(e)) continue;
                    const long double tmp_d=d+get<1>(e)/next_spd;
                    if(tmp_d>=dist[w][next_spd]) continue;
                    dist[w][next_spd]=tmp_d;
                    que.push(make_tuple(tmp_d,w,next_spd));
                }
            }
        }

        if(dist[g][1]==inf) cout << "unreachable" << endl;
        else cout << dist[g][1] << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n==0 and m==0) break;
        vector<vector<tuple<int,long double,long double>>> graph(n);
        int s,g;
        cin >> s >> g;
        --s;
        --g;
        rep(i,0,m){
            int x,y;
            long double d,c;
            cin >> x >> y >> d >> c;
            --x;
            --y;
            graph[x].emplace_back(make_tuple(y,d,c));
            graph[y].emplace_back(make_tuple(x,d,c));
        }

        vector<vector<long double>> dist(n,vector<long double>(31,inf));
        priority_queue<tuple<long double,int,int>,vector<tuple<long double,int,int>>,greater<tuple<long double,int,int>>> que;
        dist[s][0]=0;
        que.push(make_tuple(0,s,0));
        while(!que.empty()){
            const tuple<long double,int,int> tup=que.top();
            que.pop();
            const long double d=get<0>(tup);
            const int v=get<1>(tup),spd=get<2>(tup);
            if(d>dist[v][spd]) continue;
            for(const auto& e:graph[v]){
                const auto w=get<0>(e);
                rep(i,-1,2){
                    const int next_spd=spd+i;
                    if(next_spd<=0 or next_spd>get<2>(e)) continue;
                    const long double tmp_d=d+get<1>(e)/next_spd;
                    if(tmp_d>=dist[w][next_spd]) continue;
                    dist[w][next_spd]=tmp_d;
                    que.push(make_tuple(tmp_d,w,next_spd));
                }
            }
        }

        if(dist[g][1]==inf) cout << "unreachable" << endl;
        else cout << dist[g][1] << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}

Compiler output:
a.cc:104:11: error: redefinition of 'const int inf'
  104 | const int inf=1<<30;
      |           ^~~
a.cc:18:11: note: 'const int inf' previously defined here
   18 | const int inf=1<<30;
      |           ^~~
a.cc:105:21: error: redefinition of 'const long long int infll'
  105 | const long long int infll=1LL<<58;
      |                     ^~~~~
a.cc:19:21: note: 'const long long int infll' previously defined here
   19 | const long long int infll=1LL<<58;
      |                     ^~~~~
a.cc:106:14: error: redefinition of 'const double eps'
  106 | const double eps=1e-9;
      |              ^~~
a.cc:20:14: note: 'const double eps' previously defined here
   20 | const double eps=1e-9;
      |              ^~~
a.cc:107:11: error: redefinition of 'const int dx []'
  107 | const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
      |           ^~
a.cc:21:11: note: 'const int dx [4]' previously defined here
   21 | const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
      |           ^~
a.cc:107:27: error: redefinition of 'const int dy []'
  107 | const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
      |                           ^~
a.cc:21:27: note: 'const int dy [4]' previously defined here
   21 | const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
      |                           ^~
a.cc:109:32: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)'
  109 | template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
      |                                ^~~~~~~~
a.cc:23:32: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' previously declared here
   23 | template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
      |                                ^~~~~~~~
a.cc:118:6: error: redefinition of 'void solve()'
  118 | void solve(){
      |      ^~~~~
a.cc:32:6: note: 'void solve()' previously defined here
   32 | void solve(){
      |      ^~~~~
a.cc:166:5: error: redefinition of 'int main()'
  166 | int main(){
      |     ^~~~
a.cc:80:5: note: 'int main()' previously defined here
   80 | int main(){
      |     ^~~~