#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1e5 + 10;   const long long MOD = 998244353;   long long sq(long long x) { return x * x % MOD; }   long long qpow(long long a, long long b) {     return b ? sq(qpow(a, b / 2)) * (b & 1 ? a : 1) % MOD : 1;   }   long long inv(long long x) { return qpow(x, MOD - 2); }   struct Matrix {     long long v[2][2];     int n, m;     Matrix(int n, int m) : n(n), m(m) { memset(v, 0, sizeof(v)); }   };   Matrix unit_matrix(int n) {     Matrix res(n, n);     for (int i = 0; i < n; i++) res.v[i][i] = 1;     return res;   }   Matrix operator+(const Matrix &lhs, const Matrix &rhs) {     Matrix res(lhs.n, lhs.m);     for (int i = 0; i < lhs.n; i++)       for (int j = 0; j < lhs.m; j++)         res.v[i][j] = (lhs.v[i][j] + rhs.v[i][j]) % MOD;     return res;   }   Matrix operator*(const Matrix &lhs, const Matrix &rhs) {     Matrix res(lhs.n, rhs.m);     for (int i = 0; i < lhs.n; i++) {       for (int j = 0; j < rhs.m; j++) {         for (int k = 0; k < lhs.m; k++) {           (res.v[i][j] += lhs.v[i][k] * rhs.v[k][j]) %= MOD;         }       }     }     return res;   }   int N, X[MAX_N], V[MAX_N], P[MAX_N];   bool banned[MAX_N][2][2];   Matrix trans(int x) {     Matrix res(2, 2);     res.v[0][0] = res.v[1][0] = (1 + MOD - P[x]) % MOD;     res.v[0][1] = res.v[1][1] = P[x];     for (int i = 0; i < 2; i++)       for (int j = 0; j < 2; j++)         if (banned[x][i][j]) res.v[i][j] = 0;     return res;   }   struct SegTree {     int l, r, m;     SegTree *cl, *cr;     Matrix v;     SegTree(int l, int r)         : l(l), r(r), m((l + r) / 2), cl(nullptr), cr(nullptr), v(2, 2) {       if (l != r) {         cl = new SegTree(l, m);         cr = new SegTree(m + 1, r);         v = cl->v * cr->v;       } else {         v = trans(l);       }     }     Matrix query() { return v; }     void modify(int x, Matrix mv) {       if (l == r) {         v = mv;       } else {         if (x <= m)           cl->modify(x, mv);         else           cr->modify(x, mv);         v = cl->v * cr->v;       }     }   } * segt;   struct Event {     int x, d0, d1;     long long frac_x, frac_y;     Event(int x, int d0, int d1, long long frac_x, long long frac_y)         : x(x), d0(d0), d1(d1), frac_x(frac_x), frac_y(frac_y) {}   };   bool operator<(const Event &lhs, const Event &rhs) {     return lhs.frac_x * rhs.frac_y < rhs.frac_x * lhs.frac_y;   }   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) {       scanf( %d%d%d , &X[i], &V[i], &P[i]);       P[i] = P[i] * inv(100) % MOD;     }     segt = new SegTree(1, N);     vector<Event> events;     for (int i = 2; i <= N; i++) {       events.emplace_back(i - 1, 1, 0, X[i] - X[i - 1], V[i - 1] + V[i]);       if (V[i - 1] > V[i]) {         events.emplace_back(i - 1, 1, 1, X[i] - X[i - 1], V[i - 1] - V[i]);       }       if (V[i - 1] < V[i]) {         events.emplace_back(i - 1, 0, 0, X[i] - X[i - 1], V[i] - V[i - 1]);       }     }     sort(events.begin(), events.end());     long long ans = 0;     for (auto e : events) {       Matrix t = trans(e.x + 1);       for (int i = 0; i < 2; i++) {         for (int j = 0; j < 2; j++) {           if (i != e.d0 || j != e.d1) t.v[i][j] = 0;         }       }       segt->modify(e.x + 1, t);       Matrix a(1, 2);       a.v[0][0] = 1;       Matrix b = segt->query();       Matrix c = a * b;       long long p = (c.v[0][0] + c.v[0][1]) % MOD;       (ans += p * e.frac_x % MOD * inv(e.frac_y)) %= MOD;       banned[e.x + 1][e.d0][e.d1] = true;       segt->modify(e.x + 1, trans(e.x + 1));     }     printf( %lld n , ans);   }