#include <bits/stdc++.h>
const int BUFFER_SIZE = 1 << 25 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], *s;
  InputOutputStream() : s(ibuf) {
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s) x = x * 10 + (*s ^ '0');
    return *this;
  }
} IO;
template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) {
  return x < y ? x : y;
}
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) {
  return x > y ? x : y;
}
const int N_MAX = 100003, T_MAX = 400003;
double val[N_MAX];
struct SegmentTree {
  struct Data {
    double prod, sum;
    Data() : prod(1), sum(0) {}
    Data(double prod, double sum) : prod(prod), sum(sum) {}
    void operator+=(const Data &rhs) {
      sum += prod * rhs.sum, prod *= rhs.prod;
    }
    friend Data operator+(Data lhs, const Data &rhs) {
      lhs += rhs;
      return lhs;
    }
  } node[T_MAX];
  void build(int k, int l, int r) {
    if (l == r) {
      node[k] = Data(val[l], val[l]);
      return;
    }
    build((k << 1), l, ((l + r) >> 1)),
        build((k << 1 | 1), ((l + r) >> 1) + 1, r);
    node[k] = node[(k << 1)] + node[(k << 1 | 1)];
  }
  void modify(int k, int l, int r, int x, double v) {
    if (l == r) {
      node[k] = Data(v, v);
      return;
    }
    x <= ((l + r) >> 1) ? modify((k << 1), l, ((l + r) >> 1), x, v)
                        : modify((k << 1 | 1), ((l + r) >> 1) + 1, r, x, v);
    node[k] = node[(k << 1)] + node[(k << 1 | 1)];
  }
  Data query(int k, int l, int r, int x, int y) {
    if (x <= l && r <= y) return node[k];
    Data o;
    if (x <= ((l + r) >> 1)) o += query((k << 1), l, ((l + r) >> 1), x, y);
    if (((l + r) >> 1) < y)
      o += query((k << 1 | 1), ((l + r) >> 1) + 1, r, x, y);
    return o;
  }
} tree;
int main() {
  int n, Q;
  IO >> n >> Q;
  for (int i = 1; i <= n; ++i) {
    int a, b;
    IO >> a >> b;
    double p = (double)a / b;
    val[i] = (1 - p) / p;
  }
  tree.build(1, 1, n);
  for (int i = 1; i <= Q; ++i) {
    int type;
    IO >> type;
    if (type == 1) {
      int x, a, b;
      IO >> x >> a >> b;
      double p = (double)a / b;
      tree.modify(1, 1, n, x, (1 - p) / p);
    } else {
      int l, r;
      IO >> l >> r;
      printf("%.10lf\n", (double)1 / (tree.query(1, 1, n, l, r).sum + 1));
    }
  }
  return 0;
}
