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>
const int N = 100005, mod = 998244353;
int n, x[N], v[N], p[N];
int ans[N];
inline int qpow(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = 1ll * x * x % mod)
    if (y & 1) res = 1ll * res * x % mod;
  return res;
}
struct Frac {
  int p, q, x, dir;
} Fr[N << 1];
int cnt;
inline bool cmp(Frac a, Frac b) { return 1ll * a.q * b.p < 1ll * b.q * a.p; }
struct Matrix {
  int v[2][2];
  void init(int a = 0, int b = 0, int c = 0, int d = 0) {
    v[0][0] = a, v[0][1] = b, v[1][0] = c, v[1][1] = d;
    return;
  }
  Matrix operator*(Matrix& x) const {
    Matrix res;
    res.init();
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          res.v[i][j] = (res.v[i][j] + 1ll * v[i][k] * x.v[k][j] % mod) % mod;
    return res;
  }
} ex[N];
struct SgT {
  Matrix t[N << 2];
  inline int ls(int x) { return x << 1; }
  inline int rs(int x) { return x << 1 | 1; }
  inline void pushup(int x) {
    t[x] = t[ls(x)] * t[rs(x)];
    return;
  }
  void build(int x, int l, int r) {
    if (l == r) {
      t[x] = ex[l];
      return;
    }
    int mid = (l + r) >> 1;
    build(ls(x), l, mid), build(rs(x), mid + 1, r);
    pushup(x);
    return;
  }
  void update(int x, int l, int r, int p) {
    if (l == r) {
      t[x] = ex[l];
      return;
    }
    int mid = (l + r) >> 1;
    if (p <= mid)
      update(ls(x), l, mid, p);
    else
      update(rs(x), mid + 1, r, p);
    pushup(x);
    return;
  }
} T;
int main(void) {
  scanf("%d", &n);
  if (n == 1) return printf("0\n"), 0;
  for (int i = 1, iv = qpow(100, mod - 2); i <= n; ++i) {
    scanf("%d%d%d", x + i, v + i, p + i);
    p[i] = 1ll * p[i] * iv % mod;
    ex[i].init(p[i], (mod + 1 - p[i]) % mod, p[i], (mod + 1 - p[i]) % mod);
  }
  for (int i = 2; i <= n; ++i) {
    Fr[++cnt] = (Frac){v[i] + v[i - 1], x[i] - x[i - 1], i, 0};
    if (v[i] > v[i - 1])
      Fr[++cnt] = (Frac){v[i] - v[i - 1], x[i] - x[i - 1], i, 1};
    else if (v[i] < v[i - 1])
      Fr[++cnt] = (Frac){v[i - 1] - v[i], x[i] - x[i - 1], i, 2};
  }
  T.build(1, 1, n);
  std::sort(Fr + 1, Fr + 1 + cnt, cmp);
  for (int i = 1; i <= cnt + 1; ++i) {
    ans[i] = (T.t[1].v[0][0] + T.t[1].v[0][1]) % mod;
    if (i != cnt + 1) {
      int x = Fr[i].x;
      if (Fr[i].dir == 0)
        ex[x].v[0][1] = 0;
      else if (Fr[i].dir == 1)
        ex[x].v[1][1] = 0;
      else
        ex[x].v[0][0] = 0;
      T.update(1, 1, n, x);
    }
  }
  int res = 0;
  for (int i = 1; i <= cnt; ++i) {
    ans[i] = (ans[i] - ans[i + 1] + mod) % mod;
    res = (res + 1ll * Fr[i].q * qpow(Fr[i].p, mod - 2) % mod * ans[i] % mod) %
          mod;
  }
  printf("%d\n", res);
  return 0;
}