#include <bits/stdc++.h>
using namespace std;
inline char nchar() {
  static const int bufl = 1 << 20;
  static char buf[bufl], *a = NULL, *b = NULL;
  return a == b && (b = (a = buf) + fread(buf, 1, bufl, stdin), a == b) ? EOF
                                                                        : *a++;
}
inline int read() {
  int x = 0, f = 1;
  char c = nchar();
  for (; !isdigit(c); c = nchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = nchar()) x = x * 10 + c - '0';
  return x * f;
}
const int maxn = 1e5 + 1;
int n, m;
namespace sgt {
struct D {
  double s, j;
  D(double s = 0, double j = 0) : s(s), j(j) {}
  inline void set() {
    int x = read(), y = read();
    double d = (double)x / y;
    d = (1 - d) / d;
    s = (j = d) + 1;
  }
  inline friend D operator+(D a, D b) {
    return D(a.s + a.j * (b.s - 1), a.j * b.j);
  }
} t[maxn << 1];
inline int ID(int l, int r) { return l + r | l != r; }
void build(int l, int r) {
  int x = ID(l, r);
  if (l == r) {
    t[x].set();
    return;
  }
  int mid = l + r >> 1;
  build(l, mid), build(mid + 1, r);
  t[x] = t[ID(l, mid)] + t[ID(mid + 1, r)];
}
void reset(int l, int r, int p) {
  int x = ID(l, r);
  if (l == r) {
    t[x].set();
    return;
  }
  int mid = l + r >> 1;
  p <= mid ? reset(l, mid, p) : reset(mid + 1, r, p);
  t[x] = t[ID(l, mid)] + t[ID(mid + 1, r)];
}
void reset(int p) { reset(1, n, p); }
D query(int L, int R, int l, int r) {
  if (L == l && R == r) return t[ID(L, R)];
  int mid = L + R >> 1;
  if (r <= mid) return query(L, mid, l, r);
  if (l > mid) return query(mid + 1, R, l, r);
  return query(L, mid, l, mid) + query(mid + 1, R, mid + 1, r);
}
double query(int l, int r) {
  D d = query(1, n, l, r);
  return 1. / d.s;
}
}  // namespace sgt
int main() {
  n = read(), m = read();
  sgt::build(1, n);
  while (m--) {
    int o = read();
    if (o == 1)
      sgt::reset(read());
    else {
      int l = read(), r = read();
      double ans = sgt::query(l, r);
      printf("%.12lf\n", ans);
    }
  }
  return 0;
}
