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 i64 = long long;
const int N = 100007, M = 2000007, P = 998244353;
char ibuf[1 << 22], *iS = ibuf;
i64 inv[M];
int x[N], v[N], p[N];
struct matrix {
  i64 a[2][2];
  matrix() { a[0][0] = a[0][1] = a[1][0] = a[1][1] = 0; }
  i64 *operator[](int x) { return a[x]; }
} b[N], t[4 * N];
matrix operator*(matrix &a, matrix &b) {
  matrix c;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k) (c[i][k] += a[i][j] * b[j][k]) %= P;
  return c;
}
struct node {
  int x, v, id;
  i64 *pos;
} a[2 * N];
int read() {
  int x = 0, f = 1;
  while (isspace(*iS)) ++iS;
  if (*iS == '-') f = -1, ++iS;
  while (isdigit(*iS)) (x *= 10) += *iS++ & 15;
  return f * x;
}
int calpr() {
  return (p[1] * (t[1][1][0] + t[1][1][1]) +
          (100 - p[1]) * (t[1][0][0] + t[1][0][1])) %
         P * inv[100] % P;
}
void pushup(int p) { t[p] = t[p << 1] * t[p << 1 | 1]; }
void build(int p, int l, int r) {
  if (l == r) return t[p] = b[l], void();
  build(p << 1, l, ((l + r) / 2)), build(p << 1 | 1, ((l + r) / 2) + 1, r),
      pushup(p);
}
void update(int p, int l, int r, int x) {
  if (l == r) return t[p] = b[x], void();
  x <= ((l + r) / 2) ? update(p << 1, l, ((l + r) / 2), x)
                     : update(p << 1 | 1, ((l + r) / 2) + 1, r, x),
      pushup(p);
}
int main() {
  fread(ibuf, 1, 1 << 22, stdin);
  int n = read(), m = 0;
  i64 ans = 0;
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= 2000000; ++i) inv[i] = (P - P / i) * inv[P % i] % P;
  if (n == 1) return puts("0"), 0;
  for (int i = 1; i <= n; ++i) x[i] = read(), v[i] = read(), p[i] = read();
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k)
        b[i][j][k] = inv[100] * (k ? p[i + 1] : 100 - p[i + 1]) % P;
    int d = x[i + 1] - x[i];
    a[++m] = {d, v[i + 1] + v[i], i, &b[i][1][0]};
    if (v[i] < v[i + 1]) a[++m] = {d, v[i + 1] - v[i], i, &b[i][0][0]};
    if (v[i] > v[i + 1]) a[++m] = {d, v[i] - v[i + 1], i, &b[i][1][1]};
  }
  build(1, 1, n - 1),
      std::sort(a + 1, a + m + 1, [](const node &a, const node &b) {
        return 1ll * a.x * b.v < 1ll * b.x * a.v;
      });
  for (int i = 1, x; i <= m; ++i)
    x = calpr(), *a[i].pos = 0, update(1, 1, n - 1, a[i].id),
    (ans += a[i].x * inv[a[i].v] % P * (P + x - calpr())) %= P;
  printf("%lld", ans);
}