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 mod = 998244353;
using namespace std;
int n, p[2][100005], x[100005], v[100005], tl;
struct Mat {
  int a[2][2];
} M[100005];
Mat mt(int a, int b, int c, int d) {
  Mat m;
  m.a[0][0] = a;
  m.a[0][1] = b;
  m.a[1][0] = c;
  m.a[1][1] = d;
  return m;
}
Mat operator*(const Mat &p, const Mat &q) {
  Mat res = mt(0, 0, 0, 0);
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k)
        res.a[i][j] = (res.a[i][j] + (long long)p.a[i][k] * q.a[k][j]) % mod;
  return res;
}
struct query {
  int s, v, p, i, j;
} q[100005 << 2];
int cmp(query a, query b) {
  return (long long)a.s * b.v < (long long)b.s * a.v;
}
int get_speed(int i, int k1, int k2) {
  if (k1 == 0 && k2 == 1) return -1;
  if (k1 == 1 && k2 == 0) return v[i] + v[i + 1];
  if (k1 == 1 && k2 == 1) return v[i] - v[i + 1];
  if (k1 == 0 && k2 == 0) return v[i + 1] - v[i];
}
int qpow(int a, int b) {
  if (b == 0) return 1;
  long long d = qpow(a, b >> 1);
  d = d * d % mod;
  if (b & 1) d = d * a % mod;
  return d;
}
int inv(int x) { return qpow(x, mod - 2); }
struct segmentTree {
  Mat sum[100005 << 2];
  void pushup(int p) { sum[p] = sum[(p << 1)] * sum[(p << 1 | 1)]; }
  void build(int p, int l, int r) {
    if (l == r) {
      sum[p] = M[l];
      return;
    }
    int mid = (l + r) >> 1;
    build((p << 1), l, mid);
    build((p << 1 | 1), mid + 1, r);
    pushup(p);
  }
  void change(int l, int r, int p, int rt) {
    if (l == r) {
      sum[rt] = M[l];
      return;
    }
    int mid = (l + r) >> 1;
    if (p <= mid)
      change(l, mid, p, rt << 1);
    else
      change(mid + 1, r, p, rt << 1 | 1);
    pushup(rt);
  }
} sgt;
int main() {
  long long ans = 0;
  scanf("%d", &n);
  if (n == 1) return puts("0"), 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d", &x[i], &v[i], &p[1][i]);
    p[1][i] = (long long)p[1][i] * qpow(100, mod - 2) % mod;
    p[0][i] = (1 - p[1][i] + mod) % mod;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k) {
        if (get_speed(i, j, k) < 0) continue;
        q[++tl].s = x[i + 1] - x[i];
        q[tl].v = get_speed(i, j, k);
        q[tl].p = i;
        q[tl].i = j;
        q[tl].j = k;
      }
  }
  for (int i = 0; i < n; ++i)
    M[i] = mt(p[0][i + 1], p[1][i + 1], p[0][i + 1], p[1][i + 1]);
  sgt.build(1, 1, n - 1);
  Mat m1 = M[0] * sgt.sum[1];
  sort(q + 1, q + tl + 1, cmp);
  for (int i = 1; i <= tl; ++i) {
    Mat m1 = M[q[i].p], m2 = mt(0, 0, 0, 0);
    m2.a[q[i].i][q[i].j] = p[q[i].j][q[i].p + 1];
    M[q[i].p] = m2;
    sgt.change(1, n - 1, q[i].p, 1);
    Mat m3 = M[0] * sgt.sum[1];
    int P = (m3.a[0][0] + m3.a[0][1]) % mod;
    ans = ((ans + (long long)q[i].s % mod * inv(q[i].v) % mod * P % mod) % mod +
           mod % mod);
    m1.a[q[i].i][q[i].j] = 0;
    M[q[i].p] = m1;
    sgt.change(1, n - 1, q[i].p, 1);
  }
  printf("%d", ans);
}