output_description: For each dataset in the input, one line should be output as specified below.
  An output line should not contain extra characters such as spaces.
  
  If one can travel from the starting city to the goal city, the time needed for
  the best route (a route with the shortest time) should be printed. The answer
  should not have an error greater than 0.001. You may output any number of
  digits after the decimal point, provided that the above accuracy condition is
  satisfied.
  
  If it is impossible to reach the goal city, the string "`unreachable`" should
  be printed. Note that all the letters of "`unreachable`" are in lowercase.
input_description: The input consists of multiple datasets, each in the following format.
  
  > _n_ _m_  
  >  _s_ _g_  
  >  _x_ 1 _y_ 1 _d_ 1 _c_ 1  
  >  ...  
  >  _x m _ _y m _ _d m _ _c m _  
  >
  
  Every input item in a dataset is a non-negative integer. Input items in the
  same line are separated by a space.
  
  The first line gives the size of the road network. _n_ is the number of cities
  in the network. You can assume that the number of cities is between 2 and 30,
  inclusive. _m_ is the number of roads between cities, which may be zero.
  
  The second line gives the trip. _s_ is the city index of the starting city.
  _g_ is the city index of the goal city. _s_ is not equal to _g_. You can
  assume that all city indices in a dataset (including the above two) are
  between 1 and _n_ , inclusive.
  
  The following _m_ lines give the details of roads between cities. The _i_ -th
  road connects two cities with city indices _x i _ and _y i _, and has a
  distance _d i _ (1 ≤ _i_ ≤ _m_). You can assume that the distance is between 1
  and 100, inclusive. The speed limit of the road is specified by _c i _. You
  can assume that the speed limit is between 1 and 30, inclusive.
  
  No two roads connect the same pair of cities. A road never connects a city
  with itself. Each road can be traveled in both directions.
  
  The last dataset is followed by a line containing two zeros (separated by a
  space).
attempt: # AOJ 1162: Discrete Speed
  # Python3 2018.7.15 bal4u
  
  INF = 0x7FFFFFFF
  import heapq
  
  
  def dijkstra(V, to, start, goal):
      node = [[[INF for k in range(32)] for j in range(V)] for i in range(V)]
      Q = []
      node[start][0][0] = 0
      heapq.heappush(Q, (0, start, 0, 0))
      while Q:
          t, s, v, p = heapq.heappop(Q)
          if s == goal and v == 1:
              return node[goal][p][v]
          for e, d, c in to[s]:
              if e == p:
                  continue
              for i in range(-1, 2):
                  nv = v + i
                  if nv > c or nv <= 0:
                      continue
                  nt = node[s][p][v] + d / nv
                  if nt < node[e][s][nv]:
                      node[e][s][nv] = nt
                      heapq.heappush(Q, (nt, e, nv, s))
      return -1
  
  
  while True:
      n, m = map(int, input().split())
      if n == 0:
          break
      s, g = map(int, input().split())
      s -= 1
      g -= 1
      to = [[] for i in range(n)]
      for i in range(m):
          x, y, d, c = map(int, input().split())
          x -= 1
          y -= 1
          to[x].append((y, d, c))
          to[y].append((x, d, c))
      ans = dijkstra(n, to, s, g)
      print(ans if ans >= 0 else "unreachable")
  
problem_description: D: Discrete Speed
  
  Consider car trips in a country where there is no friction. Cars in this
  country do not have engines. Once a car started to move at a speed, it keeps
  moving at the same speed. There are acceleration devices on some points on the
  road, where a car can increase or decrease its speed by 1. It can also keep
  its speed there. Your job in this problem is to write a program which
  determines the route with the shortest time to travel from a starting city to
  a goal city.
  
  There are several cities in the country, and a road network connecting them.
  Each city has an acceleration device. As mentioned above, if a car arrives at
  a city at a speed _v_ , it leaves the city at one of _v_ \- 1, _v_ , or _v_ \+
  1. The first road leaving the starting city must be run at the speed 1.
  Similarly, the last road arriving at the goal city must be run at the speed 1.
  
  The starting city and the goal city are given. The problem is to find the best
  route which leads to the goal city going through several cities on the road
  network. When the car arrives at a city, it cannot immediately go back the
  road it used to reach the city. No U-turns are allowed. Except this
  constraint, one can choose any route on the road network. It is allowed to
  visit the same city or use the same road multiple times. The starting city and
  the goal city may be visited during the trip.
  
  For each road on the network, its distance and speed limit are given. A car
  must run a road at a speed less than or equal to its speed limit. The time
  needed to run a road is the distance divided by the speed. The time needed
  within cities including that for acceleration or deceleration should be
  ignored.
samples: [{"input": "0\n    1 2\n    5 4\n    1 5\n    1 2 1 1\n    2 3 2 2\n    3 4 2 2\n    4 5 1 1\n    6 6\n    1 6\n    1 2 2 1\n    2 3 2 1\n    3 6 2 1\n    1 4 2 30\n    4 5 3 30\n    5 6 2 30\n    6 7\n    1 6\n    1 2 1 30\n    2 3 1 30\n    3 1 1 30\n    3 4 100 30\n    4 5 1 30\n    5 6 1 30\n    6 4 1 30\n    0 0", "output": "unreachable\n    4.00000\n    5.50000\n    11.25664"}]