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>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int int_inf = 0x3f3f3f3f;
const long long ll_inf = 0x3f3f3f3f3f3f3f3f;
const int INT_INF = (int)((1ll << 31) - 1);
const double double_inf = 1e30;
const double eps = 1e-14;
inline int readint() {
  int x;
  scanf("%d", &x);
  return x;
}
inline int readstr(char *s) {
  scanf("%s", s);
  return strlen(s);
}
class cmpt {
 public:
  bool operator()(const int &x, const int &y) const { return x > y; }
};
int Rand(int x, int o) {
  if (!x) return 0;
  int tem = (int)((double)rand() / RAND_MAX * x) % x;
  return o ? tem + 1 : tem;
}
long long ll_rand(long long x, int o) {
  if (!x) return 0;
  long long tem = (long long)((double)rand() / RAND_MAX * x) % x;
  return o ? tem + 1 : tem;
}
void data_gen() {
  srand(time(0));
  freopen("in.txt", "w", stdout);
  int kases = 1;
  while (kases--) {
    long long sz = 1000;
    printf("%d %d\n", sz, sz);
    for (int i = (1); i <= (sz); i++) {
      int x = Rand(1e2, 1);
      int y = Rand(1e9, 1);
      if (x > y) swap(x, y);
      printf("%d %d\n", x, y);
    }
    for (int i = (1); i <= (sz); i++) {
      int o = Rand(2, 0);
      if (o) {
        printf("1 ");
        int pos = Rand(1000, 1);
        int x = Rand(1e9, 1), y = Rand(1e9, 1);
        if (x > y) swap(x, y);
        printf("%d %d %d\n", pos, x, y);
      } else {
        printf("2 ");
        int x = Rand(1000, 1), y = Rand(1e3, 1);
        if (x > y) swap(x, y);
        printf("%d %d\n", x, y);
      }
    }
  }
}
const int maxn = 1e5 + 10;
struct Seg {
  double l1, l2, r1, r2;
} seg[maxn << 2];
int n, q;
std ::pair<int, int> a[maxn];
void push_up(int u) {
  seg[u].l2 = seg[(u << 1)].l2 * seg[(u << 1 | 1)].l2 /
              (1 - seg[(u << 1)].r1 * seg[(u << 1 | 1)].l1);
  seg[u].l1 = seg[(u << 1)].l1 +
              seg[(u << 1)].l2 * seg[(u << 1)].r2 * seg[(u << 1 | 1)].l1 /
                  (1 - seg[(u << 1)].r1 * seg[(u << 1 | 1)].l1);
  seg[u].r1 = seg[(u << 1 | 1)].r1 +
              seg[(u << 1 | 1)].r2 * seg[(u << 1 | 1)].l2 * seg[(u << 1)].r1 /
                  (1 - seg[(u << 1)].r1 * seg[(u << 1 | 1)].l1);
  seg[u].r2 = seg[(u << 1)].r2 * seg[(u << 1 | 1)].r2 /
              (1 - seg[(u << 1)].r1 * seg[(u << 1 | 1)].l1);
}
double query1(int u, int l, int r, int L, int R);
double query3(int u, int l, int r, int L, int R);
double query4(int u, int l, int r, int L, int R);
double query(int u, int l, int r, int L, int R) {
  if (l == L && R == r) return seg[u].l2;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return query((u << 1), l, mid, L, R);
  else if (L >= mid)
    return query((u << 1 | 1), mid, r, L, R);
  double lhs = query((u << 1), l, mid, L, mid),
         rhs = query((u << 1 | 1), mid, r, mid, R);
  double L1 = query1((u << 1 | 1), mid, r, mid, R),
         R1 = query3((u << 1), l, mid, L, mid);
  return lhs * rhs / (1. - L1 * R1);
}
double query3(int u, int l, int r, int L, int R) {
  if (l == L && r == R) return seg[u].r1;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return query3((u << 1), l, mid, L, R);
  else if (L >= mid)
    return query3((u << 1 | 1), mid, r, L, R);
  double tem = query3((u << 1 | 1), mid, r, mid, R);
  double R2 = query4((u << 1 | 1), mid, r, mid, R);
  double R1 = query3((u << 1), l, mid, L, mid);
  double L2 = query((u << 1 | 1), mid, r, mid, R);
  double L1 = query1((u << 1 | 1), mid, r, mid, R);
  return tem + R2 * R1 * L2 / (1. - L1 * R1);
}
double query4(int u, int l, int r, int L, int R) {
  if (l == L && r == R) return seg[u].r2;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return query4((u << 1), l, mid, L, R);
  else if (L >= mid)
    return query4((u << 1 | 1), mid, r, L, R);
  double lhs =
      query4((u << 1), l, mid, L, mid) * query4((u << 1 | 1), mid, r, mid, R);
  double rhs =
      query3((u << 1), l, mid, L, mid) * query3((u << 1 | 1), mid, r, mid, R);
  return lhs / (1. - rhs);
}
double query1(int u, int l, int r, int L, int R) {
  if (l == L && R == r) return seg[u].l1;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return query1((u << 1), l, mid, L, R);
  else if (L >= mid)
    return query1((u << 1 | 1), mid, r, L, R);
  double tem = query1((u << 1), l, mid, L, mid);
  double L1 = query1((u << 1 | 1), mid, r, mid, R);
  double L2 = query((u << 1), l, mid, L, mid);
  double R2 = query4((u << 1), l, mid, L, mid);
  double R1 = query3((u << 1), l, mid, L, mid);
  return tem + L2 * L1 * R2 / (1. - R1 * L1);
}
void build(int u, int l, int r) {
  if (r - l < 2) {
    double p = (double)a[l].first / a[l].second;
    seg[u].l1 = 1 - p;
    seg[u].l2 = p;
    seg[u].r1 = p;
    seg[u].r2 = 1 - p;
    return;
  }
  int mid = (l + r) >> 1;
  build((u << 1), l, mid), build((u << 1 | 1), mid, r);
  push_up(u);
}
void update(int u, int l, int r, int L, int R, int lhs, int rhs) {
  if (l == L && r == R) {
    double p = (double)lhs / rhs;
    seg[u].l1 = 1 - p;
    seg[u].l2 = p;
    seg[u].r1 = p;
    seg[u].r2 = 1 - p;
    return;
  }
  int mid = (l + r) >> 1;
  if (R <= mid)
    update((u << 1), l, mid, L, R, lhs, rhs);
  else
    update((u << 1 | 1), mid, r, L, R, lhs, rhs);
  push_up(u);
}
double __get(int x, int y) { return query(1, 1, n + 1, x, y + 1); }
void __set(int x, int y, int z) { update(1, 1, n + 1, x, x + 1, y, z); }
int main() {
  int debug = 0;
  if (debug) freopen("in.txt", "r", stdin);
  while (~scanf("%d%d", &n, &q)) {
    for (int i = (1); i <= (n); i++) scanf("%d%d", &a[i].first, &a[i].second);
    build(1, 1, n + 1);
    for (int i = (1); i <= (q); i++) {
      int op, x, y, z;
      scanf("%d%d%d", &op, &x, &y);
      if (op == 1) {
        z = readint();
        __set(x, y, z);
      } else {
        double ans = __get(x, y);
        printf("%.10f\n", ans);
      }
    }
  }
  return 0;
}