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;
inline int rd() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (c >= '0') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f ? -x : x;
}
const int SIZE = 1e5 + 100;
const int Mod = 998244353;
int Pow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1LL * res * a % Mod;
    b >>= 1;
    a = 1LL * a * a % Mod;
  }
  return res;
}
int n;
int x[SIZE], v[SIZE], P[SIZE];
struct Matrix {
  int a[2][2];
  void Mult(const Matrix& x1) {
    int t00 = (1LL * a[0][0] * x1.a[0][0] + 1LL * a[0][1] * x1.a[1][0]) % Mod;
    int t01 = (1LL * a[0][0] * x1.a[0][1] + 1LL * a[0][1] * x1.a[1][1]) % Mod;
    int t10 = (1LL * a[1][0] * x1.a[0][0] + 1LL * a[1][1] * x1.a[1][0]) % Mod;
    int t11 = (1LL * a[1][0] * x1.a[0][1] + 1LL * a[1][1] * x1.a[1][1]) % Mod;
    a[0][0] = t00;
    a[0][1] = t01;
    a[1][0] = t10;
    a[1][1] = t11;
  }
};
struct TreeNode {
  int L, R;
  Matrix res;
} tree[SIZE << 2];
int ans[2], tmp[2];
void Up(int p) {
  tree[p].res = tree[(p << 1)].res;
  tree[p].res.Mult(tree[(p << 1 | 1)].res);
}
void Build(int L, int R, int p) {
  tree[p].L = L, tree[p].R = R;
  if (L == R) {
    tree[p].res.a[0][0] = (1 + Mod - P[L + 1]) % Mod,
    tree[p].res.a[0][1] = P[L + 1];
    tree[p].res.a[1][0] = (1 + Mod - P[L + 1]) % Mod,
    tree[p].res.a[1][1] = P[L + 1];
    return;
  }
  int mid = (L + R) >> 1;
  Build(L, mid, (p << 1)), Build(mid + 1, R, (p << 1 | 1));
  Up(p);
}
int A, B;
void Update(int x, int p) {
  if (tree[p].L == tree[p].R) {
    tree[p].res.a[A][B] = 0;
    return;
  }
  int mid = (tree[p].L + tree[p].R) >> 1;
  if (x <= mid)
    Update(x, (p << 1));
  else
    Update(x, (p << 1 | 1));
  Up(p);
}
void Query(int L, int R, int p) {
  if (tree[p].L == L && tree[p].R == R) {
    tmp[0] = (1LL * ans[0] * tree[p].res.a[0][0] +
              1LL * ans[1] * tree[p].res.a[1][0]) %
             Mod;
    tmp[1] = (1LL * ans[0] * tree[p].res.a[0][1] +
              1LL * ans[1] * tree[p].res.a[1][1]) %
             Mod;
    ans[0] = tmp[0];
    ans[1] = tmp[1];
    return;
  }
  int mid = (tree[p].L + tree[p].R) >> 1;
  if (R <= mid)
    Query(L, R, (p << 1));
  else if (L > mid)
    Query(L, R, (p << 1 | 1));
  else
    Query(L, mid, (p << 1)), Query(mid + 1, R, (p << 1 | 1));
}
struct Node {
  int a, b;
  int id;
  int S, v;
  bool operator<(const Node& x1) const {
    return 1LL * S * x1.v < 1LL * x1.S * v;
  }
} T[SIZE << 1];
void _main() {
  n = rd();
  if (n == 1) {
    puts("0");
    return;
  }
  int inv = Pow(100, Mod - 2);
  for (register int i = 1, _n = n; i <= _n; ++i)
    x[i] = rd(), v[i] = rd(), P[i] = 1LL * rd() * inv % Mod;
  int N = 0;
  for (register int i = 1, _n = n; i < _n; ++i) {
    T[++N] = (Node){1, 0, i, (x[i + 1] - x[i]), (v[i] + v[i + 1])};
    if (v[i] > v[i + 1])
      T[++N] = (Node){1, 1, i, (x[i + 1] - x[i]), (v[i] - v[i + 1])};
    if (v[i + 1] > v[i])
      T[++N] = (Node){0, 0, i, (x[i + 1] - x[i]), (v[i + 1] - v[i])};
  }
  sort(T + 1, T + N + 1);
  Build(1, n - 1, 1);
  int ANS = 0;
  for (register int i = 1, _n = N; i <= _n; ++i) {
    int id = T[i].id;
    A = T[i].a, B = T[i].b;
    ans[0] = (1 + Mod - P[1]) % Mod;
    ans[1] = P[1];
    if (1 < id) Query(1, id - 1, 1);
    tmp[0] = tmp[1] = 0;
    tmp[B] = 1LL * ans[A] * (B ? P[id + 1] : (1 + Mod - P[id + 1]) % Mod) % Mod;
    ans[0] = tmp[0], ans[1] = tmp[1];
    if (id + 1 <= n - 1) Query(id + 1, n - 1, 1);
    Update(id, 1);
    ANS =
        (ANS + 1LL * (ans[0] + ans[1]) * T[i].S % Mod * Pow(T[i].v, Mod - 2)) %
        Mod;
  }
  printf("%d\n", ANS);
}
int main() {
  _main();
  return 0;
}