func_code_string: #include <bits/stdc++.h>   using namespace std;   void Display(vector<double> row) {     for (int i = 0; i < row.size(); i++) cout << row[i] <<    ;     cout << endl;   }   void Display(vector<vector<double> > matrix) {     for (int i = 0; i < matrix.size(); i++) Display(matrix[i]);     cout << endl;   }   vector<vector<double> > New(int n, int m, double x = 0.0) {     return vector<vector<double> >(n, vector<double>(m, x));   }   vector<vector<double> > Ident(int n) {     vector<vector<double> > Res = New(n, n);     for (int i = 0; i < n; i++) Res[i][i] = 1.0;     return Res;   }   void Multy(vector<vector<double> >& C, vector<vector<double> > A,              vector<vector<double> > B) {     assert(A[0].size() == B.size());     assert(A.size() == C.size());     assert(B[0].size() == C[0].size());     for (int i = 0; i < C.size(); i++)       for (int j = 0; j < C[0].size(); j++) C[i][j] = 0.0;     for (int i = 0; i < C.size(); i++)       for (int j = 0; j < C[0].size(); j++)         for (int k = 0; k < A[0].size(); k++) C[i][j] += A[i][k] * B[k][j];   }   const int N = 100100;   const int M = 4 * N;   const double Eps = 1e-6;   int n;   int a[N];   int b[N];   vector<vector<double> > Tree[M];   bool isZero(double x) { return abs(x) < Eps; }   void Merge(int Node) {     Multy(Tree[Node], Tree[(Node << 1)], Tree[(Node << 1 | 1)]);   }   void Build(int Node = 1, int L = 1, int R = n) {     Tree[Node] = New(2, 2);     if (L == R) {       int i = L;       Tree[Node][0][0] = 0.0;       Tree[Node][0][1] = 1.0 * (a[i] - b[i]) / a[i];       Tree[Node][1][0] = 1.0;       Tree[Node][1][1] = 1.0 * b[i] / a[i];       return;     }     Build((Node << 1), L, ((L + R) >> 1));     Build((Node << 1 | 1), ((L + R) >> 1) + 1, R);     Merge(Node);   }   void Update(int i, int Node = 1, int L = 1, int R = n) {     if (L == R) {       Tree[Node][0][0] = 0.0;       Tree[Node][0][1] = 1.0 * (a[i] - b[i]) / a[i];       Tree[Node][1][0] = 1.0;       Tree[Node][1][1] = 1.0 * b[i] / a[i];       return;     }     if (i <= ((L + R) >> 1))       Update(i, (Node << 1), L, ((L + R) >> 1));     else       Update(i, (Node << 1 | 1), ((L + R) >> 1) + 1, R);     Merge(Node);   }   void Query(vector<vector<double> >& Res, int i, int j, int Node = 1, int L = 1,              int R = n) {     if (i <= L && R <= j) return Multy(Res, Res, Tree[Node]);     if (j < L || R < i) return;     Query(Res, i, j, (Node << 1), L, ((L + R) >> 1));     Query(Res, i, j, (Node << 1 | 1), ((L + R) >> 1) + 1, R);   }   int main() {     int q;     cin >> n >> q;     for (int i = 1; i <= n; i++) scanf( %d%d , a + i, b + i);     Build();     while (q--) {       int T;       scanf( %d , &T);       if (T == 1) {         int i, x, y;         scanf( %d%d%d , &i, &x, &y);         a[i] = x;         b[i] = y;         Update(i);       } else {         int L, R;         scanf( %d%d , &L, &R);         vector<vector<double> > Res = Ident(2);         Query(Res, L, R);         double Ans = 1.0 / Res[1][1];         if (Ans != Ans) Ans = 0.0;         printf( %.10f n , Ans);       }     }   }   