Problem: There are n casinos lined in a row. If Memory plays at casino i, he has probability pi to win and move to the casino on the right (i + 1) or exit the row (if i = n), and a probability 1 - pi to lose and move to the casino on the left (i - 1) or also exit the row (if i = 1). 

We say that Memory dominates on the interval i... j if he completes a walk such that,

  * He starts on casino i. 
  * He never looses in casino i. 
  * He finishes his walk by winning in casino j. 



Note that Memory can still walk left of the 1-st casino and right of the casino n and that always finishes the process.

Now Memory has some requests, in one of the following forms:

  * 1 i a b: Set <image>. 
  * 2 l r: Print the probability that Memory will dominate on the interval l... r, i.e. compute the probability that Memory will first leave the segment l... r after winning at casino r, if she starts in casino l. 



It is guaranteed that at any moment of time p is a non-decreasing sequence, i.e. pi ≤ pi + 1 for all i from 1 to n - 1.

Please help Memory by answering all his requests!

Input

The first line of the input contains two integers n and q(1 ≤ n, q ≤ 100 000), — number of casinos and number of requests respectively.

The next n lines each contain integers ai and bi (1 ≤ ai < bi ≤ 109) — <image> is the probability pi of winning in casino i.

The next q lines each contain queries of one of the types specified above (1 ≤ a < b ≤ 109, 1 ≤ i ≤ n, 1 ≤ l ≤ r ≤ n).

It's guaranteed that there will be at least one query of type 2, i.e. the output will be non-empty. Additionally, it is guaranteed that p forms a non-decreasing sequence at all times.

Output

Print a real number for every request of type 2 — the probability that boy will "dominate" on that interval. Your answer will be considered correct if its absolute error does not exceed 10 - 4.

Namely: let's assume that one of your answers is a, and the corresponding answer of the jury is b. The checker program will consider your answer correct if |a - b| ≤ 10 - 4.

Example

Input

3 13
1 3
1 2
2 3
2 1 1
2 1 2
2 1 3
2 2 2
2 2 3
2 3 3
1 2 2 3
2 1 1
2 1 2
2 1 3
2 2 2
2 2 3
2 3 3


Output

0.3333333333
0.2000000000
0.1666666667
0.5000000000
0.4000000000
0.6666666667
0.3333333333
0.2500000000
0.2222222222
0.6666666667
0.5714285714
0.6666666667

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void Display(vector<double> row) {
  for (int i = 0; i < row.size(); i++) cout << row[i] << " ";
  cout << endl;
}
void Display(vector<vector<double> > matrix) {
  for (int i = 0; i < matrix.size(); i++) Display(matrix[i]);
  cout << endl;
}
vector<vector<double> > New(int n, int m, double x = 0.0) {
  return vector<vector<double> >(n, vector<double>(m, x));
}
vector<vector<double> > Ident(int n) {
  vector<vector<double> > Res = New(n, n);
  for (int i = 0; i < n; i++) Res[i][i] = 1.0;
  return Res;
}
void Multy(vector<vector<double> >& C, vector<vector<double> > A,
           vector<vector<double> > B) {
  assert(A[0].size() == B.size());
  assert(A.size() == C.size());
  assert(B[0].size() == C[0].size());
  for (int i = 0; i < C.size(); i++)
    for (int j = 0; j < C[0].size(); j++) C[i][j] = 0.0;
  for (int i = 0; i < C.size(); i++)
    for (int j = 0; j < C[0].size(); j++)
      for (int k = 0; k < A[0].size(); k++) C[i][j] += A[i][k] * B[k][j];
}
const int N = 100100;
const int M = 4 * N;
const double Eps = 1e-6;
int n;
int a[N];
int b[N];
vector<vector<double> > Tree[M];
bool isZero(double x) { return abs(x) < Eps; }
void Merge(int Node) {
  Multy(Tree[Node], Tree[(Node << 1)], Tree[(Node << 1 | 1)]);
}
void Build(int Node = 1, int L = 1, int R = n) {
  Tree[Node] = New(2, 2);
  if (L == R) {
    int i = L;
    Tree[Node][0][0] = 0.0;
    Tree[Node][0][1] = 1.0 * (a[i] - b[i]) / a[i];
    Tree[Node][1][0] = 1.0;
    Tree[Node][1][1] = 1.0 * b[i] / a[i];
    return;
  }
  Build((Node << 1), L, ((L + R) >> 1));
  Build((Node << 1 | 1), ((L + R) >> 1) + 1, R);
  Merge(Node);
}
void Update(int i, int Node = 1, int L = 1, int R = n) {
  if (L == R) {
    Tree[Node][0][0] = 0.0;
    Tree[Node][0][1] = 1.0 * (a[i] - b[i]) / a[i];
    Tree[Node][1][0] = 1.0;
    Tree[Node][1][1] = 1.0 * b[i] / a[i];
    return;
  }
  if (i <= ((L + R) >> 1))
    Update(i, (Node << 1), L, ((L + R) >> 1));
  else
    Update(i, (Node << 1 | 1), ((L + R) >> 1) + 1, R);
  Merge(Node);
}
void Query(vector<vector<double> >& Res, int i, int j, int Node = 1, int L = 1,
           int R = n) {
  if (i <= L && R <= j) return Multy(Res, Res, Tree[Node]);
  if (j < L || R < i) return;
  Query(Res, i, j, (Node << 1), L, ((L + R) >> 1));
  Query(Res, i, j, (Node << 1 | 1), ((L + R) >> 1) + 1, R);
}
int main() {
  int q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) scanf("%d%d", a + i, b + i);
  Build();
  while (q--) {
    int T;
    scanf("%d", &T);
    if (T == 1) {
      int i, x, y;
      scanf("%d%d%d", &i, &x, &y);
      a[i] = x;
      b[i] = y;
      Update(i);
    } else {
      int L, R;
      scanf("%d%d", &L, &R);
      vector<vector<double> > Res = Ident(2);
      Query(Res, L, R);
      double Ans = 1.0 / Res[1][1];
      if (Ans != Ans) Ans = 0.0;
      printf("%.10f\n", Ans);
    }
  }
}