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 + 100, mod = 998244353, inf = 2e9;
int n, p[N], v[N], x[N], cnt, ans;
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = 1ll * ret * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return ret;
}
struct node {
  int x, y, p, q, tp;
  bool operator<(const node &tp) const {
    return 1ll * p * tp.q < 1ll * q * tp.p;
  }
} res[N * 3];
struct matrix {
  int s[2][2];
  void init(int o) {
    if (o == 1)
      for (int i = 0; i < 2; ++i)
        for (int j = 0; j < 2; ++j) s[i][j] = (i == j);
    else {
      for (int i = 0; i < 2; ++i)
        for (int j = 0; j < 2; ++j) s[i][j] = 0;
      s[0][0] = 1;
    }
  }
  matrix operator*(matrix b) {
    matrix ret;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        ret.s[i][j] = 0;
        for (int k = 0; k < 2; ++k)
          ret.s[i][j] = (ret.s[i][j] + 1ll * s[i][k] * b.s[k][j]) % mod;
      }
    return ret;
  }
} trans[N], I, H;
struct SegmentTree {
  int L[N << 2], R[N << 2];
  matrix F[N << 2];
  void build(int k, int l, int r) {
    L[k] = l, R[k] = r;
    if (l == r) {
      F[k] = trans[l];
      return;
    }
    int mid = l + r >> 1;
    build(k << 1, l, mid);
    build(k << 1 | 1, mid + 1, r);
    F[k] = F[k << 1] * F[k << 1 | 1];
  }
  matrix Query(int k, int l, int r) {
    if (r < l) return I;
    if (l <= L[k] && R[k] <= r) {
      return F[k];
    }
    int mid = L[k] + R[k] >> 1;
    matrix ret = I;
    if (l <= mid) ret = Query(k << 1, l, r);
    if (r > mid) ret = ret * Query(k << 1 | 1, l, r);
    return ret;
  }
  void Modify(int k, int x) {
    if (L[k] == R[k]) {
      F[k] = trans[x];
      return;
    }
    int mid = L[k] + R[k] >> 1;
    if (x <= mid)
      Modify(k << 1, x);
    else
      Modify(k << 1 | 1, x);
    F[k] = F[k << 1] * F[k << 1 | 1];
  }
} Tr;
int main() {
  scanf("%d", &n);
  for (int i = 1, c = qpow(100, mod - 2); i <= n; ++i)
    scanf("%d%d%d", &x[i], &v[i], &p[i]), p[i] = mod + 1 - 1ll * c * p[i] % mod,
                                          p[i] %= mod;
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    if (v[i] > v[i - 1])
      res[++cnt] = (node){i - 1, i, x[i] - x[i - 1], v[i] - v[i - 1], 0};
    res[++cnt] = (node){i - 1, i, x[i] - x[i - 1], v[i] + v[i - 1], 1};
    if (v[i - 1] > v[i])
      res[++cnt] = (node){i - 1, i, x[i] - x[i - 1], v[i - 1] - v[i], 2};
  }
  sort(res + 1, res + cnt + 1);
  I.init(1);
  H.init(2);
  for (int i = 1; i <= n; ++i)
    trans[i].s[0][0] = trans[i].s[1][0] = p[i],
    trans[i].s[0][1] = trans[i].s[1][1] = (mod + 1 - p[i]) % mod;
  Tr.build(1, 1, n);
  for (int i = 1; i <= cnt; ++i) {
    int x = res[i].x, y = res[i].y;
    matrix pre = Tr.Query(1, 1, x), suf = Tr.Query(1, y + 1, n), Y;
    Y.init(2);
    Y.s[0][0] = 0;
    if (res[i].tp == 0) Y.s[0][0] = p[y];
    if (res[i].tp == 1) Y.s[1][0] = p[y];
    if (res[i].tp == 2) Y.s[1][1] = (1 + mod - p[y]) % mod;
    matrix tmp = pre * Y * suf;
    ans = (ans + 1ll * (tmp.s[0][1] + tmp.s[0][0]) * res[i].p % mod *
                     qpow(res[i].q, mod - 2) % mod) %
          mod;
    if (res[i].tp == 0) trans[y].s[0][0] = 0;
    if (res[i].tp == 1) trans[y].s[1][0] = 0;
    if (res[i].tp == 2) trans[y].s[1][1] = 0;
    Tr.Modify(1, y);
  }
  printf("%d", ans);
  return 0;
}