#include <bits/stdc++.h>
inline int read() {
  int s = 0;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  do {
    s = s * 10 + c - '0';
  } while ((c = getchar()) >= '0' && c <= '9');
  return s;
}
const int N = 100010;
double tl[262144], tr[262144];
int S, n, m;
double query(int l, int r) {
  double l1 = 1, l2 = 1, r1 = 0, r2 = 0, lx, rx;
  for (l = l + S - 1, r = r + S + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1)
      lx = ((l1) * (tl[l ^ 1]) / ((1 - (r1) * (1 - (tl[l ^ 1]))))),
      rx = ((tr[l ^ 1]) + (1 - (tr[l ^ 1])) * (r1) * (tl[l ^ 1]) /
                              (1 - (r1) * (1 - (tl[l ^ 1])))),
      l1 = lx, r1 = rx;
    if (r & 1)
      lx = ((tl[r ^ 1]) * (l2) / ((1 - (tr[r ^ 1]) * (1 - (l2))))),
      rx = ((r2) +
            (1 - (r2)) * (tr[r ^ 1]) * (l2) / (1 - (tr[r ^ 1]) * (1 - (l2)))),
      l2 = lx, r2 = rx;
  }
  return ((l1) * (l2) / ((1 - (r1) * (1 - (l2)))));
}
int main() {
  int i;
  n = read();
  m = read();
  for (S = 1; S <= n + 2; S <<= 1)
    ;
  for (i = n + 1; i < S; i++) tl[S + i] = tr[S + i] = 1;
  for (i = 1; i <= n; i++) {
    double a = read();
    tl[S + i] = tr[S + i] = a / (double)read();
  }
  for (i = S - 1; i; i--) {
    tl[i] = ((tl[i + i]) * (tl[i + i + 1]) /
             ((1 - (tr[i + i]) * (1 - (tl[i + i + 1]))))),
    tr[i] = ((tr[i + i + 1]) + (1 - (tr[i + i + 1])) * (tr[i + i]) *
                                   (tl[i + i + 1]) /
                                   (1 - (tr[i + i]) * (1 - (tl[i + i + 1]))));
  };
  while (m--) {
    if (read() == 1) {
      int tg = read() + S;
      double p = read();
      p /= (double)read();
      tl[tg] = tr[tg] = p;
      for (tg >>= 1; tg; tg >>= 1) {
        tl[tg] = ((tl[tg + tg]) * (tl[tg + tg + 1]) /
                  ((1 - (tr[tg + tg]) * (1 - (tl[tg + tg + 1]))))),
        tr[tg] = ((tr[tg + tg + 1]) +
                  (1 - (tr[tg + tg + 1])) * (tr[tg + tg]) * (tl[tg + tg + 1]) /
                      (1 - (tr[tg + tg]) * (1 - (tl[tg + tg + 1]))));
      };
    } else {
      int l = read(), r = read();
      printf("%.10lf\n", query(l, r));
    }
  }
  return 0;
}
