#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-298.9609722) <= 0.01) { cout << lca(a,b)<<"|"<<a<<"|"<<b<< endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
#include <string>
#include <queue>

using namespace std;

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long double ld;

long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}

inline int myrand() {
  return abs((rand() << 15) ^ rand());
}

inline int rnd(int x) {
  return myrand() % x;
}

#define pb push_back
#define mp make_pair
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define sz(x) ((int)(x).size())
#define TASKNAME "text"

const int INF = (int) 1.01e9;
const ld EPS = 1e-9;

const ld PI = acos(-1.0L);

void precalc() {
}

int n, m;

vector<vector<int> > es;

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return 0;
  }
  es = vector<vector<int> >(n);
  for (int i = 0; i < n - 1; ++i) {
    int s, t;
    scanf("%d%d", &s, &t);
    --s, --t;
    es[s].pb(t), es[t].pb(s);
  }
  return 1;
}

const int maxn = (int) 1e5 + 10;

const int maxl = 17;
int pr[maxl][maxn];
long long func[maxn];
long long funcup[maxn];
int cnt[maxn];

int depth[maxn];

void dfs(int v, int pr) {
  cnt[v] = 1;
  func[v] = 0;
  for (int it = 0; it < sz(es[v]); ++it) {
    int u = es[v][it];
    if (u == pr) {
      continue;
    }
    depth[u] = depth[v] + 1;
    ::pr[0][u] = v;
    dfs(u, v);
    cnt[v] += cnt[u];
    func[v] += cnt[u] + func[u];
  }
}

void dfs2(int v, int pr) {
  //eprintf("func[%d] = %lld, funcup[%d] = %lld\n", v, func[v], v, funcup[v]);
  long long sum = funcup[v];
  for (int it = 0; it < sz(es[v]); ++it) {
    int u = es[v][it];
    if (u == pr) {
      continue;
    }
    sum += func[u] + cnt[u];
  }
  for (int it = 0; it < sz(es[v]); ++it) {
    int u = es[v][it];
    if (u == pr) {
      continue;
    }
    funcup[u] = sum - (func[u] + cnt[u]);
    funcup[u] += n - cnt[u];
    dfs2(u, v);
  }
}

int lca(int s, int t) {
  if (depth[s] < depth[t]) {
    swap(s, t);
  }
  for (int it = maxl - 1; it >= 0; --it) {
    if (depth[s] - (1 << it) >= depth[t]) {
      s = pr[it][s];
    }
  }
  if (s == t) {
    return s;
  }
  for (int it = maxl - 1; it >= 0; --it) {
    if (pr[it][s] != pr[it][t]) {
      s = pr[it][s], t = pr[it][t];
    }
  }
  return pr[0][s];
}

int goUp(int v, int d) {
  for (int two = 0; d; d >>= 1, ++two) {
    if (d & 1) {
      v = pr[two][v];
    }
  }
  return v;
}

void solve() {
  depth[0] = 0;
  pr[0][0] = 0;
  dfs(0, -1);
  funcup[0] = 0;
  dfs2(0, -1);
  for (int it = 1; it < maxl; ++it) {
    for (int v = 0; v < n; ++v) {
      pr[it][v] = pr[it - 1][pr[it - 1][v]];
    }
  }

  for (int iter = 0; iter < m; ++iter) {
    int s, t;
    scanf("%d%d", &s, &t);
    --s, --t;
    int g = lca(s, t);
    int vs[2] = {s, t};
    int cnts[2];
    long long fs[2];
    for (int iter = 0; iter < 2; ++iter) {
      int v = vs[iter];
      int &value = cnts[iter];
      long long &f = fs[iter];
      f = func[v];
      value = cnt[v];
      if (v == g) {
        int other = vs[!iter];

        int before = goUp(other, depth[other] - depth[g] - 1);
        value = n - cnt[before];
        f = funcup[before] - (n - cnt[before]);
      }
    }
    //eprintf("s = %d, t = %d, cnts = {%d,%d}, fs = {%lld,%lld}\n", s, t, cnts[0], cnts[1], fs[0], fs[1]);
    ld res = depth[s] + depth[t] - 2 * depth[g] + 1;
    long long wh = (long long) cnts[0] * cnts[1];
    res += (ld) (fs[0] * cnts[1]) / wh;
    res += (ld) (fs[1] * cnts[0]) / wh;
    if (abs(res-308.7638) <= 0.001) { cout << s << "|"<< t << "|" << g << endl; }
    printf("%.18f\n", (double) res);
  }
}

int main() {
  srand(rdtsc());
#ifdef DEBUG
  freopen(TASKNAME".out", "w", stdout);
  assert(freopen(TASKNAME".in", "r", stdin));
#endif

  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time: %.18lf\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-285.087358) <= 0.01) { cout << lca(a,b)<<"|"<<a<<"|"<<b<< endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			if (abs(1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << endl; }
            cout << fixed << " " << setprecision(10) << dist(a, b) + (double) tot / (double) choices + 1 << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
        }
    }
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];

            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }
            cout << fixed << " " << setprecision(10) << dist(a, b) + (double) tot / (double) choices + 1 << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }

            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            cout << fixed << setprecision(10) << ans << endl;
            if (abs(ans-273.049) <= 0.01) { cout << a << " " << b << endl; }
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-298.9609722) <= 0.01) { cout << a << " " << b << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			if (abs(1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0-285.0873580)<=0.01) { cout << lc<<"|"<<u<<"|"<<v<<endl;}
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;

ll dp[4010][8010];

int main() {
    dp[0][4000] = 1;
    FOR(i, 1, 4005) {
        F0R(j, 8005) {
            if (dp[i-1][j] > 0) {
                dp[i][j-1] = (dp[i][j-1] + dp[i-1][j]) % MOD;
                dp[i][j+1] = (dp[i][j+1] + dp[i-1][j]) % MOD;
            }
            dp[i][3999] =  0;
        }
    }
    int a, b; cin >> a >> b;
    string s; cin >> s;
    int k = 0;
    int minx = 0;
    F0R(i, b) {
        if (s[i] == '(') { k+=1; }
        else { k-= 1; }
        minx = min(minx, k);
    }
    int st = -minx;
    cout << st << endl;
    ll ans = 0;
    F0R(len, a-b+1) {
        int other = a-b-len;
        F0R(val, 4005) {
            if (dp[len][val] == 0) { continue; }
            if (val - 4000 + minx < 0) { continue; }
            int side = val+k;
            ll add = (ll) dp[len][val] * (ll) dp[other][side];
            if (add > 0) { ans += add; ans %= MOD; }
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-308.7638386)<=0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-273.049) <= 0.01) { cout << a << " " << b << endl; }
            cout << fixed << setprecision(10) << ans << endl;
            if (abs(ans-273.049) <= 0.01) { cout << a << " " << b << endl; }
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }
            cout << fixed << " " << setprecision(10) << dist(a, b) + (double) tot / (double) choices + 1 << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-298.9609722) <= 0.01) { cout << lca(a,b)<<"|"<<a<<"|"<<b<< endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            if (abs(ans-273.049) <= 0.01) { cout << a << " " << b << endl; }

            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            cout << fixed << setprecision(10) << ans << endl;
            if (abs(ans-273.049) <= 0.01) { cout << a << " " << b << endl; }
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];

            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }.
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << sztop << "|"<<sumbot<<"|"<<sumtop<< endl; }

            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 18;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-298.9609722) <= 0.01) { cout << choices << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];

            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }.
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << sztop << "|"<<sumbot<<"|"<<sumtop<<endl; }
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			if (abs(1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0-273.049)<=0.01) { cout << lc<<"|"<<u<<"|"<<v<<endl;}
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];

            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << sztop << "|"<<sumbot<<"|"<<sumtop<<endl; }
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			if (abs(1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<"|"<<(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])<<endl;}
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }
            cout << fixed << " " << setprecision(10) << dist(a, b) + (double) tot / (double) choices + 1 << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }

        }
    }
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int MN = 1e5 + 100;
const int LG = 22;

int dp1[MN] , dp2[MN] , cnt1[MN] , cnt2[MN];
int n,q;
int h[MN],par[MN][LG];
vector<int>edges[MN];

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0,int pr=0,int lvl =0)
{
	h[s] = lvl , cnt1[s] = 1,par[s][0] = pr;
	for(int i=0;i<edges[s].size();++i)
		if(edges[s][i] != pr){
			dfs1(edges[s][i] , s , lvl+1);
			cnt1[s] += cnt1[edges[s][i]];
			dp1[s] += dp1[edges[s][i]] + cnt1[edges[s][i]];
		}
}

void dfs2(int s=0,int pr =0)
{
	for(int i=0;i<edges[s].size();++i)
		if(edges[s][i] != pr){
			cnt2[edges[s][i]] = cnt2[s] + cnt1[s] - cnt1[edges[s][i]];
			dp2[edges[s][i]] = dp2[s] + cnt2[edges[s][i]] + dp1[s] - dp1[edges[s][i]] - cnt1[edges[s][i]];
			dfs2(edges[s][i] , s);
		}
}

void prep()
{
	dfs1();
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int getPar(int v,int d)
{
	for(int i=LG-1;i>=0;--i)
		if(d&(1<<i))
			v = par[v][i];
	return v;
}

int lca(int v, int u)  // v could be the ancestor
{
	u = getPar(u, h[u]-h[v]);
	if(u == v)
		return u;
	for(int i=LG-1;i>=0;--i)
		if(par[u][i] != par[v][i])
			u = par[u][i] , v = par[v][i];
	return par[u][0];
}

void solve()
{
	cout.precision(20);
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		cin >> u >> v;
		--u,--v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(v,u);
		if(v == w){
			ans = (double)dp1[u]/cnt1[u] + (double)(h[v]+h[u]-2*h[w]);
			int t = getPar(u , h[u]-h[w]-1);
			ans += (double)dp2[t]/cnt2[t] - 1;
		}else{
			ans = (double)dp1[v]/cnt1[v] + (double)dp1[u]/cnt1[u] + (double)(h[v] + h[u] - 2*h[w]);
		}
		cout << fixed << ans+1 << endl;
	}
}

main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

const int MN = 1e5 + 10;
const int LG = 22;

int n,q;
vector<int>edges[MN];
int h[MN], par[MN][LG], sz[MN], dp[MN],sum[MN];
bool mk[MN];
bool flag;

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0)
{
	mk[s] = true , sz[s] = 1;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		h[edges[s][i]] = h[s] + 1;
		par[edges[s][i]][0] = s;
		dfs1(edges[s][i]);
		sz[s] += sz[edges[s][i]];
		sum[s] += sum[edges[s][i]] + sz[edges[s][i]];
	}
}

void dfs2(int s=0)
{
	mk[s] = true;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		dp[edges[s][i]] = dp[s] + n - sz[edges[s][i]] + sum[s] - sum[edges[s][i]] - sz[edges[s][i]];
		dfs2(edges[s][i]);
	}
}

void prep()
{
	dfs1();
	memset(mk , false , sizeof mk);
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int tmp;

int lca(int u,int v) // v can be an ancestor
{
	int r = 0;
	for(int i=LG-1;i>=0;--i)
		if(h[u] - (1<<i) > h[v])
			u = par[u][i] , r += (1<<i);
	if(par[u][0] == v){
		flag = true;
		tmp = u;
		return r+1;
	}
	if(h[u] != h[v]) ++r, u = par[u][0];
	for(int i=LG-1;i>=0;--i)
		if(par[v][i] != par[u][i])
			v = par[v][i] , u = par[u][i] , r += 2;
	return r+2;
}

void solve()
{
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		flag = false;
		cin >> u >> v;
		--u , --v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(u,v);
		if(flag)ans = (double)(dp[v] + sum[v] - sum[tmp] - sz[tmp])*1.0/(n-sz[tmp]) + (double)sum[u]/sz[u]*1.0 + (double)w;
		else ans = (double)1.0*sum[u]/sz[u] + (double)1.0*sum[v]/sz[v] + w;
		cout << setprecision(12) << ans+1 << endl;
	}
}

main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int MN = 1e5 + 100;
const int LG = 22;

int dp1[MN] , dp2[MN] , cnt1[MN] , cnt2[MN];
int n,q;
int h[MN],par[MN][LG];
vector<int>edges[MN];

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0,int pr=0,int lvl =0)
{
	h[s] = lvl , cnt1[s] = 1,par[s][0] = pr;
	for(int i=0;i<edges[s].size();++i)
		if(edges[s][i] != pr){
			dfs1(edges[s][i] , s , lvl+1);
			cnt1[s] += cnt1[edges[s][i]];
			dp1[s] += dp1[edges[s][i]] + cnt1[edges[s][i]];
		}
}

void dfs2(int s=0,int pr =0)
{
	for(int i=0;i<edges[s].size();++i)
		if(edges[s][i] != pr){
			cnt2[edges[s][i]] = cnt2[s] + cnt1[s] - cnt1[edges[s][i]];
			dp2[edges[s][i]] = dp2[s] + cnt2[edges[s][i]] + dp1[s] - dp1[edges[s][i]] - cnt1[edges[s][i]];
			dfs2(edges[s][i] , s);
		}
}

void prep()
{
	dfs1();
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
	for(int i=0;i<n;++i)
		cout << i+1<< ' ' << cnt2[i] << ' ' << dp2[i] << endl;
}

int getPar(int v,int d)
{
	for(int i=LG-1;i>=0;--i)
		if(d&(1<<i))
			v = par[v][i];
	return v;
}

int lca(int v, int u)  // v could be the ancestor
{
	u = getPar(u, h[u]-h[v]);
	if(u == v)
		return u;
	for(int i=LG-1;i>=0;--i)
		if(par[u][i] != par[v][i])
			u = par[u][i] , v = par[v][i];
	return par[u][0];
}

void solve()
{
	cout.precision(20);
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		cin >> u >> v;
		--u,--v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(v,u);
		if(v == w){
			ans = (double)dp1[u]/cnt1[u] + (double)(h[v]+h[u]-2*h[w]);
			int t = getPar(u , h[u]-h[w]-1);
			ans += (double)dp2[t]/cnt2[t] - 1;
		}else{
			ans = (double)dp1[v]/cnt1[v] + (double)dp1[u]/cnt1[u] + (double)(h[v] + h[u] - 2*h[w]);
		}
		cout << fixed << ans+1 << endl;
	}
}

main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

const int MN = 1e5 + 100;
const int LG = 25;

int n,q;
vector<int>edges[MN];
int h[MN], par[MN][LG], sz[MN], dp[MN],sum[MN];
bool mk[MN];
bool flag;

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0)
{
	mk[s] = true , sz[s] = 1;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		h[edges[s][i]] = h[s] + 1;
		par[edges[s][i]][0] = s;
		dfs1(edges[s][i]);
		sz[s] += sz[edges[s][i]];
		sum[s] += sum[edges[s][i]] + sz[edges[s][i]];
	}
}

void dfs2(int s=0)
{
	mk[s] = true;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		dp[edges[s][i]] = dp[s] + n - sz[edges[s][i]] + sum[s] - sum[edges[s][i]] - sz[edges[s][i]];
		dfs2(edges[s][i]);
	}
}

void prep()
{
	dfs1();
	memset(mk , false , sizeof mk);
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int tmp;

int lca(int u,int v) // v can be an ancestor
{
	int r = 0;
	for(int i=LG-1;i>=0;--i)
		if(h[u] - (1<<i) > h[v])
			u = par[u][i] , r += (1<<i);
	if(par[u][0] == v){
		flag = true;
		tmp = u;
		return r+1;
	}
	if(h[u] != h[v]) ++r, u = par[u][0];
	for(int i=LG-1;i>=0;--i)
		if(par[v][i] != par[u][i])
			v = par[v][i] , u = par[u][i] , r += 2;
	return r+2;
}

void solve()
{
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		flag = false;
		cin >> u >> v;
		--u , --v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(u,v);
		if(flag)ans = (double)(dp[v] + sum[v] - sum[tmp] - sz[tmp])*1.0/(n-sz[tmp]) + (double)sum[u]/sz[u]*1.0 + (double)w;
		else ans = (double)1.0*sum[u]/sz[u] + (double)1.0*sum[v]/sz[v] + (double)w;
		cout << setprecision(12) << ans+1 << endl;
	}
}

main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

const int MN = 1e5 + 10;
const int LG = 22;

int n,q;
vector<int>edges[MN];
int h[MN], par[MN][LG], sz[MN], dp[MN],sum[MN];
bool mk[MN];
bool flag;

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0)
{
	mk[s] = true , sz[s] = 1;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		h[edges[s][i]] = h[s] + 1;
		par[edges[s][i]][0] = s;
		dfs1(edges[s][i]);
		sz[s] += sz[edges[s][i]];
		sum[s] += sum[edges[s][i]] + sz[edges[s][i]];
	}
}

void dfs2(int s=0)
{
	mk[s] = true;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		dp[edges[s][i]] = dp[s] + n - sz[edges[s][i]] + sum[s] - sum[edges[s][i]] - sz[edges[s][i]];
		dfs2(edges[s][i]);
	}
}

void prep()
{
	dfs1();
	memset(mk , false , sizeof mk);
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int tmp;

int lca(int u,int v) // v can be an ancestor
{
	int r = 0;
	for(int i=LG-1;i>=0;--i)
		if(h[u] - (1<<i) > h[v])
			u = par[u][i] , r += (1<<i);
	if(par[u][0] == v){
		flag = true;
		tmp = u;
		return r+1;
	}
	if(h[u] != h[v]) ++r, u = par[u][0];
	for(int i=LG-1;i>=0;--i)
		if(par[v][i] != par[u][i])
			v = par[v][i] , u = par[u][i] , r += 2;
	return r+2;
}

void solve()
{
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		flag = false;
		cin >> u >> v;
		--u , --v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(u,v);
		if(flag)ans = (double)(dp[v] + sum[v] - sum[tmp] - sz[tmp])*1.0/(n-sz[tmp]) + (double)sum[u]/sz[u]*1.0 + (double)w;
		else ans = (double)1.0*sum[u]/sz[u] + (double)1.0*sum[v]/sz[v] + (double)w;
		cout << setprecision(12) << ans+1 << endl;
	}
}

main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

const int MN = 1e5 + 10;
const int LG = 22;

int n,q;
vector<int>edges[MN];
int h[MN], par[MN][LG], sz[MN], dp[MN],sum[MN];
bool mk[MN];
bool flag;

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0)
{
	mk[s] = true , sz[s] = 1;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		h[edges[s][i]] = h[s] + 1;
		par[edges[s][i]][0] = s;
		dfs1(edges[s][i]);
		sz[s] += sz[edges[s][i]];
		sum[s] += sum[edges[s][i]] + sz[edges[s][i]];
	}
}

void dfs2(int s=0)
{
	mk[s] = true;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		dp[edges[s][i]] = dp[s] + n - sz[edges[s][i]] + sum[s] - sum[edges[s][i]] - sz[edges[s][i]];
		dfs2(edges[s][i]);
	}
}

void prep()
{
	dfs1();
	memset(mk , false , sizeof mk);
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int tmp;

int lca(int u,int v) // v can be an ancestor
{
	int r = 0;
	for(int i=LG-1;i>=0;--i)
		if(h[u] - (1<<i) > h[v])
			u = par[u][i] , r += (1<<i);
	if(par[u][0] == v){
		flag = true;
		tmp = u;
		return r+1;
	}
	if(h[u] != h[v]) ++r, u = par[u][0];
	for(int i=LG-1;i>=0;--i)
		if(par[v][i] != par[u][i])
			v = par[v][i] , u = par[u][i] , r += 2;
	return r+2;
}

void solve()
{
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		flag = false;
		cin >> u >> v;
		--u , --v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(u,v);
		if(flag) ans = (dp[v] + sum[v] - sum[tmp] - sz[tmp])*1.0/(n-sz[tmp]) + sum[u]/sz[u]*1.0 + w  ;
		else ans = 1.0*sum[u]/sz[u] + 1.0*sum[v]/sz[v] + w;
		cout << setprecision(12) << ans+1 << endl;
	}
}

int main()
{
	input();
	prep();
	solve();
	return 0;
}


// In the name of God
// Code by: mrMaster

#include <bits/stdc++.h>

using namespace std;

const int MN = 1e5 + 10;
const int LG = 22;

int n,q;
vector<int>edges[MN];
int h[MN], par[MN][LG], sz[MN], dp[MN],sum[MN];
bool mk[MN];
bool flag;

void input()
{
	int a,b;
	cin >> n >> q;
	for(int i=0;i<n-1;++i){
		cin >> a >> b;
		--a,--b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}

void dfs1(int s=0)
{
	mk[s] = true , sz[s] = 1;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		h[edges[s][i]] = h[s] + 1;
		par[edges[s][i]][0] = s;
		dfs1(edges[s][i]);
		sz[s] += sz[edges[s][i]];
		sum[s] += sum[edges[s][i]] + sz[edges[s][i]];
	}
}

void dfs2(int s=0)
{
	mk[s] = true;
	for(int i=0;i<edges[s].size();++i){
		if(mk[edges[s][i]]) continue;
		dp[edges[s][i]] = dp[s] + n - sz[edges[s][i]] + sum[s] - sum[edges[s][i]] - sz[edges[s][i]];
		dfs2(edges[s][i]);
	}
}

void prep()
{
	dfs1();
	memset(mk , false , sizeof mk);
	dfs2();
	for(int i=1;i<LG;++i)
		for(int j=0;j<n;++j)
			par[j][i] = par[par[j][i-1]][i-1];
}

int tmp;

int lca(int u,int v) // v can be an ancestor
{
	int r = 0;
	for(int i=LG-1;i>=0;--i)
		if(h[u] - (1<<i) > h[v])
			u = par[u][i] , r += (1<<i);
	if(par[u][0] == v){
		flag = true;
		tmp = u;
		return r+1;
	}
	if(h[u] != h[v]) ++r, u = par[u][0];
	for(int i=LG-1;i>=0;--i)
		if(par[v][i] != par[u][i])
			v = par[v][i] , u = par[u][i] , r += 2;
	return r+2;
}

void solve()
{
	int u,v;
	double ans;
	for(int i=0;i<q;++i){
		flag = false;
		cin >> u >> v;
		--u , --v;
		if(h[u] < h[v]) swap(u,v);
		int w = lca(u,v);
		if(flag)ans = (double)(dp[v] + sum[v] - sum[tmp] - sz[tmp])*1.0/(n-sz[tmp]) + (double)sum[u]/sz[u]*1.0 + (double)w;
		else ans = (double)1.0*sum[u]/sz[u] + (double)1.0*sum[v]/sz[v] + w;
		cout << setprecision(12) << ans+1 << endl;
	}
}

int main()
{
	input();
	prep();
	solve();
	return 0;
}


// :)
// Be name khoda
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const int MAXLOG = 18;
const ll MOD = 1e9+7;

vector <int> g[MAX];
ll n, m, sum[MAX], sz[MAX], dp[MAX];
int par[MAX][18], h[MAX];

void dfs (int v, int parent = -1) {
	if (parent + 1)
		h[v] = h[parent] + 1;
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs(u, v);
		sz[v] += sz[u];
		sum[v] += sum[u];
	}
	sum[v] += sz[v];
	sz[v]++;
	return;
}

void dfs1 (int v, int parent = -1) {
	par[v][0] = parent;
	if (parent == -1)
		dp[v] = sum[v];
	else
		dp[v] = dp[parent] + n - 2 * sz[v];
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs1(u, v);
	}
	return;
}

int lca (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] + 1 && h[par[v][t]] >= h[u])
			v = par[v][t];
	if (v == u)
		return v;
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] != par[u][t]) {
			v = par[v][t];
			u = par[u][t];
		}
	return par[v][0];
}

int f (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int i = MAXLOG-1; i >= 0; i--)
		if (par[v][i] != -1 && h[par[v][i]] > h[u])
			v = par[v][i];
	return v;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n-1; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	memset(par, -1, sizeof par);
	dfs(0);
	dfs1(0);
	for (int t = 1; t < MAXLOG; t++)
		for (int i = 0; i < n; i++)
			if (par[i][t-1] != -1)
				par[i][t] = par[par[i][t-1]][t-1];
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		int k = lca(v, u);
		if (h[v] < h[u])
			swap(v, u);
		ll res1, res2;
		if (k == u) {
			ll len = h[v] - h[u];
			ll last = f(v, u);
			//cout << len << " len " << last << " last \n";
			res1 = (len + 1) * (n - sz[last]) * sz[v] + (dp[u] - sum[last] - sz[last]) * sz[v] + sum[v] * (n - sz[last]);
			res2 = (n - sz[last]) * sz[v];
		} else {
			ll len = h[v] + h[u] - 2 * h[k];
			res1 = (len + 1) * sz[v] * sz[u] + sum[v] * sum[u];
			res2 = sz[v] * sz[u];
		}
		//cout << res1 << " " << res2 << "\n";
		cout << fixed << setprecision(10) << (double) res1 / res2 << "\n";
	}
}


// :)
// Be name khoda
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const int MAXLOG = 18;
const ll MOD = 1e9+7;

vector <int> g[MAX];
ll n, m, sum[MAX], sz[MAX], dp[MAX];
int par[MAX][18], h[MAX];

void dfs (int v, int parent = -1) {
	if (parent + 1)
		h[v] = h[parent] + 1;
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs(u, v);
		sz[v] += sz[u];
		sum[v] += sum[u];
	}
	sum[v] += sz[v];
	sz[v]++;
	return;
}

void dfs1 (int v, int parent = -1) {
	par[v][0] = parent;
	if (parent == -1)
		dp[v] = sum[v];
	else
		dp[v] = dp[parent] + n - 2 * sz[v];
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs1(u, v);
	}
	return;
}

int lca (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] + 1 && h[par[v][t]] >= h[u])
			v = par[v][t];
	if (v == u)
		return v;
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] != par[u][t]) {
			v = par[v][t];
			u = par[u][t];
		}
	return par[v][0];
}

int f (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int i = MAXLOG-1; i >= 0; i--)
		if (par[v][i] != -1 && h[par[v][i]] > h[u])
			v = par[v][i];
	return v;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n-1; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	memset(par, -1, sizeof par);
	dfs(0);
	dfs1(0);
	for (int t = 1; t < MAXLOG; t++)
		for (int i = 0; i < n; i++)
			if (par[i][t-1] != -1)
				par[i][t] = par[par[i][t-1]][t-1];
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		int k = lca(v, u);
		if (h[v] < h[u])
			swap(v, u);
		long double res1, res2;
		if (k == u) {
			ll len = h[v] - h[u];
			ll last = f(v, u);
			//cout << len << " len " << last << " last \n";
			res2 = (n - sz[last]) * sz[v];
			res1 = (len + 1) + (dp[u] - sum[last] - sz[last]) * sz[v] / res2 + sum[v] * (n - sz[last]) / res2;
		} else {
			ll len = h[v] + h[u] - 2 * h[k];
			res2 = sz[v] * sz[u];
			res1 = (len + 1) + sum[v] * sum[u] / res2;
		}
		//cout << res1 << " " << res2 << "\n";
		cout << fixed << setprecision(10) << res1 << "\n";
	}
}


// :)
// Be name khoda
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const int MAXLOG = 20;
const ll MOD = 1e9+7;

vector <int> g[MAX];
ll n, m, sum[MAX], sz[MAX], dp[MAX];
int par[MAX][20], h[MAX];

void dfs (int v, int parent = -1) {
	if (parent + 1)
		h[v] = h[parent] + 1;
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs(u, v);
		sz[v] += sz[u];
		sum[v] += sum[u];
	}
	sum[v] += sz[v];
	sz[v]++;
	return;
}

void dfs1 (int v, int parent = -1) {
	par[v][0] = parent;
	if (parent == -1)
		dp[v] = sum[v];
	else
		dp[v] = dp[parent] + n - 2 * sz[v];
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs1(u, v);
	}
	return;
}

int lca (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] + 1 && h[par[v][t]] >= h[u])
			v = par[v][t];
	if (v == u)
		return v;
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] != par[u][t]) {
			v = par[v][t];
			u = par[u][t];
		}
	return par[v][0];
}

int f (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int i = MAXLOG-1; i >= 0; i--)
		if (par[v][i] != -1 && h[par[v][i]] > h[u])
			v = par[v][i];
	return v;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n-1; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	memset(par, -1, sizeof par);
	dfs(0);
	dfs1(0);
	for (int t = 1; t < MAXLOG; t++)
		for (int i = 0; i < n; i++)
			if (par[i][t-1] != -1)
				par[i][t] = par[par[i][t-1]][t-1];
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		int k = lca(v, u);
		if (h[v] < h[u])
			swap(v, u);
		long double res1, res2;
		if (k == u) {
			ll len = h[v] - h[u];
			ll last = f(v, u);
			//cout << len << " len " << last << " last \n";
			res2 = (n - sz[last]) * sz[v];
			res1 = (len + 1) + (dp[u] - sum[last] - sz[last]) * sz[v] / res2 + sum[v] * (n - sz[last]) / res2;
		} else {
			ll len = h[v] + h[u] - 2 * h[k];
			res2 = sz[v] * sz[u];
			res1 = (len + 1) + sum[v] * sum[u] / res2;
		}
		//cout << res1 << " " << res2 << "\n";
		cout << fixed << setprecision(10) << res1 << "\n";
	}
}


// :)
// Be name khoda
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const int MAXLOG = 20;
const ll MOD = 1e9+7;

vector <int> g[MAX];
ll n, m, sum[MAX], sz[MAX], dp[MAX];
int par[MAX][20], h[MAX];

void dfs (int v, int parent = -1) {
	if (parent + 1)
		h[v] = h[parent] + 1;
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs(u, v);
		sz[v] += sz[u];
		sum[v] += sum[u];
	}
	sum[v] += sz[v];
	sz[v]++;
	return;
}

void dfs1 (int v, int parent = -1) {
	par[v][0] = parent;
	if (parent == -1)
		dp[v] = sum[v];
	else
		dp[v] = dp[parent] + n - 2 * sz[v];
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs1(u, v);
	}
	return;
}

int lca (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] + 1 && h[par[v][t]] >= h[u])
			v = par[v][t];
	if (v == u)
		return v;
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] != par[u][t]) {
			v = par[v][t];
			u = par[u][t];
		}
	return par[v][0];
}

int f (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int i = MAXLOG-1; i >= 0; i--)
		if (par[v][i] != -1 && h[par[v][i]] > h[u])
			v = par[v][i];
	return v;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n-1; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	memset(par, -1, sizeof par);
	dfs(0);
	dfs1(0);
	for (int t = 1; t < MAXLOG; t++)
		for (int i = 0; i < n; i++)
			if (par[i][t-1] != -1)
				par[i][t] = par[par[i][t-1]][t-1];
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		int k = lca(v, u);
		if (h[v] < h[u])
			swap(v, u);
		long double res1, res2;
		if (k == u) {
			ll len = h[v] - h[u];
			ll last = f(v, u);
			//cout << len << " len " << last << " last \n";
			res2 = (n - sz[last]) * sz[v];
			res1 = (len + 1) + (dp[u] - sum[last] - sz[last]) * sz[v] / res2 + sum[v] * (n - sz[last]) / res2;
		} else {
			ll len = h[v] + h[u] - 2 * h[k];
			res2 = sz[v] * sz[u];
			res1 = (len + 1) + sum[v] * sum[u] / res2;
			if (sum[v] * sum[u] / sum[u] != sum[v])
				return cout << ":/\n", 0;
		}
		//cout << res1 << " " << res2 << "\n";
		cout << fixed << setprecision(10) << res1 << "\n";
	}
}


// :)
// Be name khoda
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const int MAXLOG = 20;
const ll MOD = 1e9+7;

vector <int> g[MAX];
ll n, m, sum[MAX], sz[MAX], dp[MAX];
int par[MAX][20], h[MAX];

void dfs (int v, int parent = -1) {
	if (parent + 1)
		h[v] = h[parent] + 1;
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs(u, v);
		sz[v] += sz[u];
		sum[v] += sum[u];
	}
	sum[v] += sz[v];
	sz[v]++;
	return;
}

void dfs1 (int v, int parent = -1) {
	par[v][0] = parent;
	if (parent == -1)
		dp[v] = sum[v];
	else
		dp[v] = dp[parent] + n - 2 * sz[v];
	for (auto u : g[v]) {
		if (u == parent)
			continue;
		dfs1(u, v);
	}
	return;
}

int lca (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] + 1 && h[par[v][t]] >= h[u])
			v = par[v][t];
	if (v == u)
		return v;
	for (int t = MAXLOG-1; t >= 0; t--)
		if (par[v][t] != par[u][t]) {
			v = par[v][t];
			u = par[u][t];
		}
	return par[v][0];
}

int f (int v, int u) {
	if (h[v] < h[u])
		swap(v, u);
	for (int i = MAXLOG-1; i >= 0; i--)
		if (par[v][i] != -1 && h[par[v][i]] > h[u])
			v = par[v][i];
	return v;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n-1; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	memset(par, -1, sizeof par);
	dfs(0);
	dfs1(0);
	for (int t = 1; t < MAXLOG; t++)
		for (int i = 0; i < n; i++)
			if (par[i][t-1] != -1)
				par[i][t] = par[par[i][t-1]][t-1];
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v;
		--u;
		int k = lca(v, u);
		if (h[v] < h[u])
			swap(v, u);
		long double res1, res2;
		if (k == u) {
			ll len = h[v] - h[u];
			ll last = f(v, u);
			//cout << len << " len " << last << " last \n";
			res2 = (n - sz[last]) * sz[v];
			res1 = (len + 1) + (dp[u] - sum[last] - sz[last]) * sz[v] / res2 + sum[v] * (n - sz[last]) / res2;
		} else {
			ll len = h[v] + h[u] - 2 * h[k];
			res2 = sz[v] * sz[u];
			res1 = (len + 1) + sum[v] * sum[u] / res2;
			if (sum[u] != 0 && sum[v] * sum[u] / sum[u] != sum[v])
				return cout << ":/\n", 0;
		}
		//cout << res1 << " " << res2 << "\n";
		cout << fixed << setprecision(10) << res1 << "\n";
	}
}