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 N = 1e5 + 5, mo = 998244353, V = 21e5;
int n, x[N], v[N], p[N], inv[V], i, j, k, ans;
struct mat {
  int a[2][2];
  inline mat operator*(const mat& rhs) {
    static mat ans;
    memset(ans.a, 0, sizeof ans.a);
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          ans.a[i][k] = (ans.a[i][k] + 1ll * a[i][j] * rhs.a[j][k]) % mo;
    return ans;
  }
} aa[N], T[N << 2];
void build(int i, int l, int r) {
  if (l == r) {
    T[i] = aa[l];
    return;
  }
  int m = l + r >> 1;
  build(i << 1, l, m);
  build(i << 1 | 1, m + 1, r);
  T[i] = T[i << 1] * T[i << 1 | 1];
}
struct A {
  int fz, fm, *p, i;
  bool operator<(const A& rhs) const {
    return 1ll * fz * rhs.fm < 1ll * rhs.fz * fm;
  }
} a[N * 3];
int xb;
inline int getp() {
  return (1ll * p[1] * (T[1].a[1][0] + T[1].a[1][1]) +
          1ll * (100 - p[1]) * (T[1].a[0][0] + T[1].a[0][1])) %
         mo * inv[100] % mo;
}
void mdy(int i, int l, int r, int k) {
  if (l == r) {
    T[i] = aa[l];
    return;
  }
  int m = l + r >> 1;
  if (k <= m)
    mdy(i << 1, l, m, k);
  else
    mdy(i << 1 | 1, m + 1, r, k);
  T[i] = T[i << 1] * T[i << 1 | 1];
}
int main() {
  for (i = 1; i < V; ++i)
    inv[i] = i == 1 ? 1 : 1ll * (mo - mo / i) * inv[mo % i] % mo;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d%d%d", x + i, v + i, p + i);
  if (n < 2) {
    puts("0");
    return 0;
  }
  for (i = 1; i < n; ++i) {
    for (j = 0; j < 2; ++j)
      for (k = 0; k < 2; ++k)
        aa[i].a[j][k] = 1ll * inv[100] * (k ? p[i + 1] : 100 - p[i + 1]) % mo;
    int d = x[i + 1] - x[i];
    a[++xb] = {d, v[i + 1] + v[i], &aa[i].a[1][0], i};
    if (v[i] < v[i + 1]) a[++xb] = {d, v[i + 1] - v[i], &aa[i].a[0][0], i};
    if (v[i] > v[i + 1]) a[++xb] = {d, v[i] - v[i + 1], &aa[i].a[1][1], i};
  }
  build(1, 1, n - 1);
  sort(a + 1, a + xb + 1);
  for (i = 1; i <= xb; ++i) {
    int ori = getp();
    *a[i].p = 0;
    mdy(1, 1, n - 1, a[i].i);
    ans = (ans + 1ll * inv[a[i].fm] * a[i].fz % mo * (ori + mo - getp())) % mo;
  }
  printf("%d\n", ans);
  return 0;
}