#include <bits/stdc++.h>
using namespace std;
struct Segment {
  double LR, LL, RL, RR;
  static Segment casino(const double p) { return {p, 1 - p, 1 - p, p}; }
  static Segment unit() { return {1, 0, 1, 0}; }
};
Segment operator*(const Segment a, const Segment b) {
  const auto LR = (a.LR * b.LR) / (1 - b.LL * a.RR);
  const auto LL = 1 - LR;
  const auto RL = (b.RL * a.RL) / (1 - a.RR * b.LL);
  const auto RR = 1 - RL;
  return {LR, LL, RL, RR};
}
struct SegmentTree {
  int N;
  vector<Segment> data;
  SegmentTree(int N, const vector<double>& initial) : N(N), data(2 * N) {
    for (auto a = 0; a < N; a++) data[N + a] = Segment::casino(initial[a]);
    for (auto i = N - 1; i >= 1; i--) data[i] = data[2 * i] * data[2 * i + 1];
  }
  void update(const int a, const double p) {
    auto i = N + a;
    data[i] = Segment::casino(p);
    for (i /= 2; i >= 1; i /= 2) data[i] = data[2 * i] * data[2 * i + 1];
  }
  double query(const int a, const int b) const {
    auto left = Segment::unit(), right = Segment::unit();
    for (auto i = a + N, j = b + N + 1; i < j; i /= 2, j /= 2) {
      if (i % 2) left = left * data[i++];
      if (j % 2) right = data[--j] * right;
    }
    return (left * right).LR;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  auto initial = vector<double>();
  for (auto i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    initial.push_back(static_cast<double>(a) / b);
  }
  auto tree = SegmentTree(n, initial);
  for (auto i = 0; i < q; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      int i, a, b;
      cin >> i >> a >> b;
      i--;
      const auto p = static_cast<double>(a) / b;
      tree.update(i, p);
    } else if (type == 2) {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      cout << tree.query(l, r) << "\n";
    } else
      throw invalid_argument("Invalid operation type: " + to_string(type));
  }
}
