Problem: For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.

Anvils come in different sizes and shapes. Quite often they get the hero stuck deep in the ground. But have you ever thought who throws anvils from the sky? From what height? We are sure that such questions have never troubled you!

It turns out that throwing an anvil properly is not an easy task at all. Let's describe one of the most popular anvil throwing models.

Let the height p of the potential victim vary in the range [0;a] and the direction of the wind q vary in the range [ - b;b]. p and q could be any real (floating) numbers. Then we can assume that the anvil will fit the toon's head perfectly only if the following equation has at least one real root: 

<image>

Determine the probability with which an aim can be successfully hit by an anvil.

You can assume that the p and q coefficients are chosen equiprobably and independently in their ranges.

Input

The first line contains integer t (1 ≤ t ≤ 10000) — amount of testcases.

Each of the following t lines contain two space-separated integers a and b (0 ≤ a, b ≤ 106).

Pretests contain all the tests with 0 < a < 10, 0 ≤ b < 10.

Output

Print t lines — the probability of a successful anvil hit for each testcase. The absolute or relative error of the answer should not exceed 10 - 6.

Examples

Input

2
4 2
1 2


Output

0.6250000000
0.5312500000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int MAX = 1000000;
void printArray(int N, int arr[]) {
  for (int n = 0; n < N; n++) printf("%d ", arr[n]);
  printf("\n");
}
void printVector(vector<int> &v) {
  for (int n = 0; n < v.size(); n++) printf("%d ", v[n]);
  printf("\n");
}
int maxInArray(int i, int j, int A[]) {
  int maxVal = -1e9;
  for (int k = i; k <= j; k++) {
    maxVal = max(maxVal, A[k]);
  }
  return maxVal;
}
int minInArray(int i, int j, int A[]) {
  int minVal = -1e9;
  for (int k = i; k <= j; k++) {
    minVal = min(minVal, A[k]);
  }
  return minVal;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0 || b == 0) return a ^ b;
  return gcd(b % a, a);
}
void zAlgorithm(int len, char s[], int *Z) {
  for (int n = 0; n < len; n++) Z[n] = 0;
  Z[0] = len;
  int l = 0, r = 0;
  for (int k = 1; k < len; k++) {
    if (!(k >= r)) {
      int p = k - l;
      if (Z[p] + k < r) {
        Z[k] = Z[p];
      } else {
        l = k;
        while (r < len && s[r] == s[r - k]) {
          r++;
        }
        Z[k] = r - k;
      }
    } else {
      int i = k, j = 0;
      while (i < len && s[i] == s[j]) {
        i++;
        j++;
      }
      l = k;
      r = i;
      Z[k] = j;
    }
  }
}
int findSmallestDivisor(int len, int *pre) {
  int k = 1;
  while (k <= len) {
    bool isMultiple = true;
    for (int i = 0; i < len; i += k) {
      if (pre[i] < k) {
        isMultiple = false;
        break;
      }
    }
    if (isMultiple) return k;
    k++;
  }
  return 0;
}
void seiveErathosthenes(int limit, vector<int> &primes) {
  if (limit < 2) return;
  bool isPrime[limit + 1];
  for (int i = 2; i < limit + 1; i++) isPrime[i] = true;
  for (int i = 2; i < limit + 1; i++) {
    if (isPrime[i]) {
      primes.push_back(i);
      for (int j = i * 2; j <= limit; j += i) {
        isPrime[j] = false;
      }
    }
  }
}
long long int numSubTree(int uu, vector<int> adjList[], int A[], int N) {
  stack<int> ss, s;
  ss.push(uu);
  while (ss.size()) {
    int u = ss.top();
    s.push(u);
    ss.pop();
    for (int i = 0; i < adjList[u].size(); i++) {
      int v = adjList[u][i];
      ss.push(v);
    }
  }
  long long int dp[N + 1];
  for (int n = 0; n < N + 1; n++) dp[n] = 0;
  while (s.size()) {
    int u = s.top();
    s.pop();
    long long int total = 1, prod = 1;
    bool isLeafNode = true;
    for (int i = 0; i < adjList[u].size(); i++) {
      isLeafNode = false;
      int v = adjList[u][i];
      if (A[uu] == A[v] && v >= uu) {
        continue;
      }
      prod = (prod * (dp[v] + 1)) % 1000000007;
    }
    dp[u] = prod;
  }
  return dp[uu];
}
vector<int> *getAdjListWithMin(int i, int D, int N, vector<int> adjList[],
                               int A[]) {
  vector<int> *modifiedAdjList = new vector<int>[N];
  stack<int> s;
  long long int minVal = A[i], maxVal = A[i] + D;
  bool visited[N];
  for (int n = 0; n < N; n++) {
    visited[n] = false;
  }
  s.push(i);
  while (s.size()) {
    int u = s.top();
    s.pop();
    visited[u] = true;
    for (int j = 0; j < adjList[u].size(); j++) {
      int v = adjList[u][j];
      if (!visited[v] && A[v] >= minVal && A[v] <= maxVal) {
        modifiedAdjList[u].push_back(v);
        s.push(v);
      }
    }
  }
  return modifiedAdjList;
}
void buildSparseTable(long long int((*fn)(long long int, long long int)), int N,
                      long long int A[], vector<long long int> sparseTable[]) {
  for (int i = 0; i < N; i++) {
    sparseTable[i].push_back(A[i]);
  }
  int j = 1;
  while ((1 << j) <= N) {
    for (int i = 0; (i + (1 << j)) <= N; i++) {
      sparseTable[i].push_back(fn(sparseTable[i][(j - 1)],
                                  sparseTable[i + (1 << (j - 1))][(j - 1)]));
    }
    j++;
  }
}
int sparseTableQuery(long long int identity,
                     long long int((*fn)(long long int, long long int)), int L,
                     int R, int N, vector<long long int> sparseTable[]) {
  int i = L;
  long long int total = identity;
  while (i <= R) {
    int j = 0;
    while ((i + (1 << (j + 1)) - 1) <= R) {
      j++;
    }
    total = fn(total, (sparseTable[i][j]));
    i = i + (1 << j);
  }
  return total;
}
int main(int argc, char const *argv[]) {
  int T = 0;
  scanf("%d", &T);
  for (int t = 0; t < T; t++) {
    double A = 0, B = 0;
    scanf("%lf %lf", &A, &B);
    if (B == 0.0) {
      printf("1.0\n");
    } else if (A == 0.0) {
      printf("0.5\n");
    } else {
      double K = min(A / 4.0, B);
      printf("%lf\n", 0.5 + (A * K - 2 * K * K) / (2 * A * B));
    }
  }
  return 0;
}