#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 51, MOD = 998244353, INVP = 828542813;   struct Matrix {     int num[2][2];     Matrix() { memset(num, 0, sizeof(num)); }     inline int *operator[](const int &x) { return num[x]; }     inline const int *operator[](const int &x) const { return num[x]; }   };   struct SegmentTree {     int l, r;     Matrix val;   };   struct Query {     int d, v, id, dl, dr;     inline bool operator<(const Query &rhs) const {       return (long long int)d * rhs.v < (long long int)v * rhs.d;     }   };   SegmentTree tree[MAXN << 2];   Matrix mat[MAXN];   Query qry[MAXN << 2];   Matrix id, m1, m2, r;   int n, pr, qcnt, res, r2;   int x[MAXN], v[MAXN];   inline int read() {     register int num = 0, neg = 1;     register char ch = getchar();     while (!isdigit(ch) && ch !=  - ) {       ch = getchar();     }     if (ch ==  - ) {       neg = -1;       ch = getchar();     }     while (isdigit(ch)) {       num = (num << 3) + (num << 1) + (ch -  0 );       ch = getchar();     }     return num * neg;   }   inline int qpow(int base, int exponent) {     int res = 1;     while (exponent) {       if (exponent & 1) {         res = (long long int)res * base % MOD;       }       base = (long long int)base * base % MOD, exponent >>= 1;     }     return res;   }   inline Matrix operator*(Matrix x, Matrix y) {     Matrix res;     res[0][0] =         ((long long int)x[0][0] * y[0][0] + (long long int)x[0][1] * y[1][0]) %         MOD;     res[0][1] =         ((long long int)x[0][0] * y[0][1] + (long long int)x[0][1] * y[1][1]) %         MOD;     res[1][0] =         ((long long int)x[1][0] * y[0][0] + (long long int)x[1][1] * y[1][0]) %         MOD;     res[1][1] =         ((long long int)x[1][0] * y[0][1] + (long long int)x[1][1] * y[1][1]) %         MOD;     return res;   }   inline void update(int node) {     tree[node].val = tree[node << 1].val * tree[(node << 1) | 1].val;   }   inline void create(int l, int r, int node) {     tree[node] = (SegmentTree){l, r};     if (l == r) {       return (void)(tree[node].val = mat[l]);     }     int mid = (l + r) >> 1;     create(l, mid, node << 1), create(mid + 1, r, (node << 1) | 1), update(node);   }   inline void change(int pos, int x, int node) {     if (tree[node].l == tree[node].r) {       return (void)(tree[node].val = mat[x]);     }     int mid = (tree[node].l + tree[node].r) >> 1;     change(pos, x, pos <= mid ? node << 1 : (node << 1) | 1), update(node);   }   int main() {     n = read(), id[0][0] = id[1][1] = 1;     for (register int i = 1; i <= n; i++) {       x[i] = read(), v[i] = read(), pr = (long long int)read() * INVP % MOD;       mat[i][0][1] = mat[i][1][1] = pr,       mat[i][0][0] = mat[i][1][0] = (MOD + 1 - pr) % MOD;     }     for (register int i = 2; i <= n; i++) {       qry[++qcnt] = (Query){x[i] - x[i - 1], v[i] + v[i - 1], i, 1, 0};       v[i] > v[i - 1]           ? qry[++qcnt] = (Query){x[i] - x[i - 1], v[i] - v[i - 1], i, 0, 0},             1 : 1;       v[i] < v[i - 1]           ? qry[++qcnt] = (Query){x[i] - x[i - 1], v[i - 1] - v[i], i, 1, 1},             1 : 1;     }     sort(qry + 1, qry + qcnt + 1), create(1, n, 1);     for (register int i = 1; i <= qcnt; i++) {       m1 = mat[qry[i].id], m2 = Matrix(),       r2 = (long long int)qry[i].d * qpow(qry[i].v, MOD - 2) % MOD;       m2[qry[i].dl][qry[i].dr] = m1[qry[i].dl][qry[i].dr];       mat[qry[i].id] = m2, change(qry[i].id, qry[i].id, 1);       r = tree[1].val,       res = (res + (long long int)r2 * (r[0][0] + r[0][1]) % MOD) % MOD;       m1[qry[i].dl][qry[i].dr] = 0, mat[qry[i].id] = m1;       change(qry[i].id, qry[i].id, 1);     }     printf( %d n , res);   }   