func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void chmin(T &x, const T &y) {     if (x > y) x = y;   }   template <typename T>   void chmax(T &x, const T &y) {     if (x < y) x = y;   }   int read() {     char c;     while ((c = getchar()) <  - )       ;     if (c ==  - ) {       int x = (c = getchar()) -  0 ;       while ((c = getchar()) >=  0 ) x = x * 10 + c -  0 ;       return -x;     }     int x = c -  0 ;     while ((c = getchar()) >=  0 ) x = x * 10 + c -  0 ;     return x;   }   const int N = 2e5 + 5, D = 998244353;   int64_t mi(int64_t x, int y = D - 2) {     int64_t ans = 1;     while (y) {       if (y & 1) ans = ans * x % D;       x = x * x % D;       y >>= 1;     }     return ans;   }   void operator+=(pair<int64_t, int64_t> &a, const pair<int64_t, int64_t> &b) {     (a.first += b.first) %= D;     (a.second += b.second) %= D;   }   void mul(int64_t &a0, int64_t &a1, int64_t m[2][2]) {     int64_t b0 = (m[0][0] * a0 + m[0][1] * a1) % D,             b1 = (m[1][0] * a0 + m[1][1] * a1) % D;     a0 = b0;     a1 = b1;   }   int64_t m[2][2], m1[2][2];   namespace SEG {   const int64_t T = N * 4;   int64_t tag[T][2][2], sum[T][2];   int n;   void mul(int k, int64_t m[2][2]) {     for (int i = 0; i <= 1; ++i) {       ::mul(tag[k][0][i], tag[k][1][i], m);     }     ::mul(sum[k][0], sum[k][1], m);   }   void push_down(int k) {     if ((tag[k][0][0] - 1) % D || tag[k][0][1] || tag[k][1][0] ||         (tag[k][1][1] - 1) % D) {       mul((k * 2), tag[k]);       mul(((k * 2) + 1), tag[k]);       for (int i = 0; i <= 1; ++i)         for (int j = 0; j <= 1; ++j) tag[k][i][j] = i == j;     }   }   void push_up(int k) {     for (int i = 0; i <= 1; ++i)       sum[k][i] = (sum[(k * 2)][i] + sum[((k * 2) + 1)][i]) % D;   }   void add(int x, const pair<int64_t, int64_t> &a) {     int k = 1, l = 1, r = n;     while (1) {       (sum[k][0] += a.first) %= D;       (sum[k][1] += a.second) %= D;       if (l == r) break;       push_down(k);       if (x <= ((l + r) / 2)) {         k = (k * 2);         r = ((l + r) / 2);       } else {         k = ((k * 2) + 1);         l = ((l + r) / 2) + 1;       }     }   }   pair<int64_t, int64_t> query(int x) {     int k = 1, l = 1, r = n;     pair<int64_t, int64_t> ans = pair<int64_t, int64_t>(0, 0);     while (l != r) {       push_down(k);       if (x <= ((l + r) / 2)) {         ans +=             pair<int64_t, int64_t>(sum[((k * 2) + 1)][0], sum[((k * 2) + 1)][1]);         k = (k * 2);         r = ((l + r) / 2);       } else {         k = ((k * 2) + 1);         l = ((l + r) / 2) + 1;       }     }     ans += pair<int64_t, int64_t>(sum[k][0], sum[k][1]);     return ans;   }   int ql, qr;   void modify(int k, int l, int r) {     if (ql > r || qr < l) return;     if (ql <= l && qr >= r) {       mul(k, m);       return;     }     push_down(k);     modify((k * 2), l, ((l + r) / 2));     modify(((k * 2) + 1), ((l + r) / 2) + 1, r);     push_up(k);   }   void modify(int l, int r) {     ql = l;     qr = r;     modify(1, 1, n);   }   };  // namespace SEG   bool cmp(const pair<int, int> &a, const pair<int, int> &b) {     return 1LL * a.first * b.second < 1LL * a.second * b.first;   }   pair<int, int> q[N];   int t;   int main() {     int n = read();     static int x[N], v[N], p[N];     for (int i = 1; i <= n; ++i) {       x[i] = read();       v[i] = read();       p[i] = read() * mi(100) % D;     }     t = 1;     q[1] = pair<int, int>(1, 0);     for (int i = 2; i <= n; ++i) {       q[++t] = pair<int, int>(x[i] - x[i - 1], v[i] + v[i - 1]);       if (v[i] != v[i - 1])         q[++t] = pair<int, int>(x[i] - x[i - 1], abs(v[i] - v[i - 1]));     }     sort(q + 1, q + t + 1, cmp);     SEG::n = t;     SEG::add(t, pair<int64_t, int64_t>(1 - p[1], p[1]));     for (int i = 2; i <= n; ++i) {       int j0 =           lower_bound(q + 1, q + t,                       pair<int, int>(x[i] - x[i - 1], v[i] + v[i - 1]), cmp) -           q;       int j1 = lower_bound(q + 1, q + t,                            pair<int, int>(x[i] - x[i - 1], abs(v[i] - v[i - 1])),                            cmp) -                q;       pair<int64_t, int64_t> s0 = SEG::query(j0), s1 = SEG::query(j1);       int64_t np = p[i];       for (int i = 0; i <= 1; ++i)         for (int j = 0; j <= 1; ++j) m[i][j] = (i == 0) ? 1 - np : np;       SEG::modify(1, j0 - 1);       for (int i = 0; i <= 1; ++i)         for (int j = 0; j <= 1; ++j)           if (j == 1 && i == 0) {             m1[i][j] = m[i][j];             m[i][j] = 0;           } else             m1[i][j] = 0;       mul(s0.first, s0.second, m1);       SEG::modify(j0, j1 - 1);       SEG::add(j0, s0);       int ni = v[i] > v[i - 1] ? 0 : 1;       for (int i = 0; i <= 1; ++i)         for (int j = 0; j <= 1; ++j)           if (i == j && (i == ni)) {             m1[i][j] = m[i][j];             m[i][j] = 0;           } else             m1[i][j] = 0;       mul(s1.first, s1.second, m1);       SEG::modify(j1, t);       SEG::add(j1, s1);     }     auto S = [&](const pair<int64_t, int64_t> &a) -> int64_t {       return (a.first + a.second) % D;     };     int64_t ans = 0;     for (int i = 1; i <= t - 1; ++i)       (ans += (S(SEG::query(i)) - S(SEG::query(i + 1))) * q[i].first % D *               mi(q[i].second)) %= D;     cout << (ans + D) % D << endl;   }   