Problem: An infinitely long Line Chillland Collider (LCC) was built in Chillland. There are n pipes with coordinates x_i that are connected to LCC. When the experiment starts at time 0, i-th proton flies from the i-th pipe with speed v_i. It flies to the right with probability p_i and flies to the left with probability (1 - p_i). The duration of the experiment is determined as the time of the first collision of any two protons. In case there is no collision, the duration of the experiment is considered to be zero.

Find the expected value of the duration of the experiment.

<image>Illustration for the first example

Input

The first line of input contains one integer n — the number of pipes (1 ≤ n ≤ 10^5). Each of the following n lines contains three integers x_i, v_i, p_i — the coordinate of the i-th pipe, the speed of the i-th proton and the probability that the i-th proton flies to the right in percentage points (-10^9 ≤ x_i ≤ 10^9, 1 ≤ v ≤ 10^6, 0 ≤ p_i ≤ 100). It is guaranteed that all x_i are distinct and sorted in increasing order.

Output

It's possible to prove that the answer can always be represented as a fraction P/Q, where P is an integer and Q is a natural number not divisible by 998 244 353. In this case, print P ⋅ Q^{-1} modulo 998 244 353.

Examples

Input


2
1 1 100
3 1 0


Output


1


Input


3
7 10 0
9 4 86
14 5 100


Output


0


Input


4
6 4 50
11 25 50
13 16 50
15 8 50


Output


150902884

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353, N_MAX = 1e5;
int n, from[2][N_MAX];
long long p[2][N_MAX], x[N_MAX], v[N_MAX], pr[2][N_MAX], ipr[2][N_MAX];
struct op {
  long long s, t;
  int i, dir;
};
vector<op> events;
struct seg {
  int l, r, left_to, right_from;
};
seg s[N_MAX];
int in[N_MAX];
int find(int x) { return (in[x] == x) ? x : in[x] = find(in[x]); }
void merge(int x, int y) { in[find(x)] = find(y); }
long long inv(long long a) {
  int k = MOD - 2;
  long long b = 1;
  while (k) {
    if (k % 2) b = b * a % MOD;
    a = a * a % MOD;
    k /= 2;
  }
  return b;
}
long long prod(bool t, int l, int r) {
  if (l > r) return 1;
  if (from[t][l] != from[t][r] || p[t][l] == 0) return 0;
  return (l == 0 ? pr[t][r] : pr[t][r] * ipr[t][l - 1] % MOD);
}
long long f[4 * N_MAX];
void init(int id, int l, int r) {
  if (l == r) {
    f[id] = 1;
    return;
  }
  int k = (l + r) / 2;
  init(2 * id, l, k);
  init(2 * id + 1, k + 1, r);
  long long left_prod = prod(0, l, k), right_prod = prod(1, k + 1, r);
  f[id] = (f[2 * id] * right_prod + left_prod * f[2 * id + 1] + MOD -
           left_prod * right_prod % MOD) %
          MOD;
}
long long away(int id, int a, int b, int l, int r) {
  if (a == l && b == r) return f[id];
  int k = (a + b) / 2;
  if (r <= k) return away(2 * id, a, k, l, r);
  if (k + 1 <= l) return away(2 * id + 1, k + 1, b, l, r);
  long long left_prod = prod(0, l, k), right_prod = prod(1, k + 1, r);
  return (away(2 * id, a, k, l, k) * right_prod +
          away(2 * id + 1, k + 1, b, k + 1, r) * left_prod + MOD -
          left_prod * right_prod % MOD) %
         MOD;
}
long long away(int l, int r) {
  if (l >= r) return 1;
  return away(1, 0, n - 1, l, r);
  int k = (l + r) / 2;
  long long left_prod = prod(0, l, k), right_prod = prod(1, k + 1, r);
  return (away(l, k) * right_prod + left_prod * away(k + 1, r) + MOD -
          left_prod * right_prod % MOD) %
         MOD;
}
long long calc(seg& s) {
  if (s.left_to >= s.right_from) return 0;
  return prod(0, s.l, s.left_to) *
         away(max(s.left_to + 1, s.l), min(s.right_from - 1, s.r)) % MOD *
         prod(1, s.right_from, s.r) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> v[i] >> p[1][i];
    p[1][i] = p[1][i] * inv(100) % MOD;
    p[0][i] = MOD + 1 - p[1][i];
    if (p[0][i] >= MOD) p[0][i] -= MOD;
  }
  for (int t = 0; t < 2; t++) {
    if (p[t][0] == 0)
      pr[t][0] = 1, from[t][0] = 1;
    else
      pr[t][0] = p[t][0], from[t][0] = 0;
    for (int i = 1; i < n; i++) {
      if (p[t][i] == 0)
        pr[t][i] = 1, from[t][i] = i + 1;
      else {
        from[t][i] = from[t][i - 1];
        pr[t][i] = pr[t][i - 1] * p[t][i] % MOD;
      }
    }
    for (int i = 0; i < n; i++) ipr[t][i] = (pr[t][i] ? inv(pr[t][i]) : 1);
  }
  init(1, 0, n - 1);
  for (int i = 0; i + 1 < n; i++) {
    op o;
    o.i = i, o.s = x[i + 1] - x[i], o.t = v[i] + v[i + 1], o.dir = 0;
    events.push_back(o);
    if (v[i] != v[i + 1]) {
      o.t = abs(v[i] - v[i + 1]);
      o.dir = (v[i] < v[i + 1] ? -1 : 1);
      events.push_back(o);
    }
  }
  sort(events.begin(), events.end(), [](const op& op1, const op& op2) -> bool {
    return op1.s * op2.t < op2.s * op1.t;
  });
  for (op& o : events) o.t = o.s * inv(o.t) % MOD;
  for (int i = 0; i < n; i++) {
    s[i].l = s[i].r = i;
    s[i].left_to = -1, s[i].right_from = n;
    in[i] = i;
  }
  long long E = 0, P = 1;
  for (op& o : events) {
    int i = o.i;
    if (o.dir == 0) {
      int i1 = find(i), i2 = find(i + 1);
      P = P * inv(calc(s[i1])) % MOD * inv(calc(s[i2])) % MOD;
      long long Q = P;
      seg act = s[i1];
      act.right_from = min(act.right_from, i);
      Q = Q * calc(act) % MOD;
      act = s[i2];
      act.left_to = max(act.left_to, i + 1);
      Q = Q * calc(act) % MOD;
      E = (E + Q * o.t) % MOD;
      s[i1].r = s[i2].r;
      merge(i2, i1);
      s[i1].left_to = max(s[i1].left_to, s[i2].left_to);
      s[i1].right_from = min(s[i1].right_from, s[i2].right_from);
      P = (P * calc(s[i1])) % MOD;
    } else {
      int i1 = find(i);
      seg act = s[i1];
      P = P * inv(calc(act)) % MOD;
      long long Q = P;
      if (o.dir == -1)
        act.left_to = max(act.left_to, i + 1);
      else
        act.right_from = min(act.right_from, i);
      Q = Q * calc(act) % MOD;
      E = (E + Q * o.t) % MOD;
      if (o.dir == -1)
        s[i1].right_from = min(s[i1].right_from, i + 1);
      else
        s[i1].left_to = max(s[i1].left_to, i);
      P = P * calc(s[i1]) % MOD;
    }
    if (P == 0) break;
  }
  cout << E << "\n";
  return 0;
}