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;
int inv(long long int n) {
  int e = 998244353 - 2;
  long long int r = 1;
  while (e > 0) {
    if (e & 1) r *= n, r %= 998244353;
    e >>= 1;
    n *= n, n %= 998244353;
  }
  return r;
}
int x[100000], v[100000], p[100000], invp[100000], invp2[100000];
int tree[1 << 18][4];
int com(int i, int mid) {
  tree[i][0] =
      ((((long long int)tree[2 * i + 1][0] * tree[2 * i + 2][0]) % 998244353) *
       invp[mid + 1]) %
      998244353;
  tree[i][0] +=
      ((((long long int)tree[2 * i + 1][1] * tree[2 * i + 2][2]) % 998244353) *
       invp2[mid + 1]) %
      998244353;
  if (tree[i][0] >= 998244353) tree[i][0] -= 998244353;
  tree[i][1] =
      ((((long long int)tree[2 * i + 1][0] * tree[2 * i + 2][1]) % 998244353) *
       invp[mid + 1]) %
      998244353;
  tree[i][1] +=
      ((((long long int)tree[2 * i + 1][1] * tree[2 * i + 2][3]) % 998244353) *
       invp2[mid + 1]) %
      998244353;
  if (tree[i][1] >= 998244353) tree[i][1] -= 998244353;
  tree[i][2] =
      ((((long long int)tree[2 * i + 1][2] * tree[2 * i + 2][0]) % 998244353) *
       invp[mid + 1]) %
      998244353;
  tree[i][2] +=
      ((((long long int)tree[2 * i + 1][3] * tree[2 * i + 2][2]) % 998244353) *
       invp2[mid + 1]) %
      998244353;
  if (tree[i][2] >= 998244353) tree[i][2] -= 998244353;
  tree[i][3] =
      ((((long long int)tree[2 * i + 1][2] * tree[2 * i + 2][1]) % 998244353) *
       invp[mid + 1]) %
      998244353;
  tree[i][3] +=
      ((((long long int)tree[2 * i + 1][3] * tree[2 * i + 2][3]) % 998244353) *
       invp2[mid + 1]) %
      998244353;
  if (tree[i][3] >= 998244353) tree[i][3] -= 998244353;
  return 0;
}
int build(int s, int e, int i) {
  if (s == e) {
    tree[i][0] = ((long long int)p[s] * p[s + 1]) % 998244353;
    tree[i][1] = ((long long int)p[s] * (998244353 + 1 - p[s + 1])) % 998244353;
    tree[i][2] = ((long long int)(998244353 + 1 - p[s]) * p[s + 1]) % 998244353;
    tree[i][3] =
        ((long long int)(998244353 + 1 - p[s]) * (998244353 + 1 - p[s + 1])) %
        998244353;
    return 0;
  }
  int mid = (s + e) / 2;
  build(s, mid, 2 * i + 1), build(mid + 1, e, 2 * i + 2);
  com(i, mid);
  return 0;
}
int update(int s, int e, int ai, int i, int m) {
  if ((s > ai) || (e < ai))
    return 0;
  else if (s == e) {
    tree[i][m] = 0;
    return 0;
  }
  int mid = (s + e) / 2;
  update(s, mid, ai, 2 * i + 1, m), update(mid + 1, e, ai, 2 * i + 2, m);
  com(i, mid);
  return 0;
}
struct data {
  int n, d, i, m;
};
bool comp(data a, data b) {
  return (long long int)a.n * b.d < (long long int)b.n * a.d;
}
vector<data> poss;
int main() {
  int i;
  int n;
  int inv100 = inv(100);
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &x[i], &v[i], &p[i]),
        p[i] = ((long long int)p[i] * inv100) % 998244353;
    invp[i] = inv(p[i]), invp2[i] = inv(998244353 + 1 - p[i]);
  }
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  for (i = 1; i < n; i++) {
    poss.push_back((data){x[i] - x[i - 1], v[i] + v[i - 1], i - 1, 1});
    if (v[i - 1] > v[i])
      poss.push_back((data){x[i] - x[i - 1], v[i - 1] - v[i], i - 1, 0});
    else if (v[i - 1] < v[i])
      poss.push_back((data){x[i] - x[i - 1], v[i] - v[i - 1], i - 1, 3});
  }
  sort(poss.begin(), poss.end(), comp);
  long long int ans = 0;
  build(0, n - 2, 0);
  for (i = 0; i < poss.size(); i++) {
    int p1 =
        ((long long int)tree[0][0] + tree[0][1] + tree[0][2] + tree[0][3]) %
        998244353;
    update(0, n - 2, poss[i].i, 0, poss[i].m);
    int p2 =
        ((long long int)tree[0][0] + tree[0][1] + tree[0][2] + tree[0][3]) %
        998244353;
    long long int v = ((long long int)poss[i].n * inv(poss[i].d)) % 998244353;
    ans += v * (p1 - p2 + 998244353), ans %= 998244353;
  }
  printf("%I64d\n", ans);
  return 0;
}