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;
const int MOD = 998244353;
const int inf = 2e9;
const double eps = 1e-10;
int n, x[N], v[N], p[N], tot, q[N];
struct data {
  int x, y, op, val;
  double tim;
} col[N * 2];
struct mat {
  int a[2][2];
  void clear() { memset(a, 0, sizeof(a)); }
} unit, t1[N * 4], t2[N * 4], m1[N], m2[N];
int ksm(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = (long long)ans * x % MOD;
    x = (long long)x * x % MOD;
    y >>= 1;
  }
  return ans;
}
bool cmp(data a, data b) {
  return a.tim > b.tim || fabs(a.tim - b.tim) < eps && a.x < b.x;
}
mat mul(mat a, mat b) {
  mat c;
  c.clear();
  for (int k = 0; k < 2; k++)
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        (c.a[i][j] += (long long)a.a[i][k] * b.a[k][j] % MOD) %= MOD;
  return c;
}
void ins1(int d, int l, int r, int x, int y, int z) {
  if (l == r) {
    int pp = z == 1 ? p[x + 1] : q[x + 1] % MOD;
    t1[d].a[y][z] = pp;
    return;
  }
  int mid = (l + r) / 2;
  if (x <= mid)
    ins1(d << 1, l, mid, x, y, z);
  else
    ins1(d << 1 | 1, mid + 1, r, x, y, z);
  t1[d] = mul(t1[d << 1], t1[d << 1 | 1]);
}
void ins2(int d, int l, int r, int x, int y, int z) {
  if (l == r) {
    int pp = y == 0 ? q[x - 1] % MOD : p[x - 1];
    t2[d].a[y][z] = pp;
    return;
  }
  int mid = (l + r) / 2;
  if (x <= mid)
    ins2(d << 1, l, mid, x, y, z);
  else
    ins2(d << 1 | 1, mid + 1, r, x, y, z);
  t2[d] = mul(t2[d << 1], t2[d << 1 | 1]);
}
mat query(int d, int l, int r, int x, int y, int op) {
  if (x > y) return unit;
  if (x <= l && r <= y) return op == 1 ? t1[d] : t2[d];
  int mid = (l + r) / 2;
  if (y <= mid)
    return query(d << 1, l, mid, x, y, op);
  else if (x > mid)
    return query(d << 1 | 1, mid + 1, r, x, y, op);
  else
    return mul(query(d << 1, l, mid, x, y, op),
               query(d << 1 | 1, mid + 1, r, x, y, op));
}
void build(int d, int l, int r) {
  if (l == r) {
    t1[d] = m1[l];
    t2[d] = m2[l];
    return;
  }
  int mid = (l + r) / 2;
  build(d << 1, l, mid);
  build(d << 1 | 1, mid + 1, r);
  t1[d] = mul(t1[d << 1], t1[d << 1 | 1]);
  t2[d] = mul(t2[d << 1], t2[d << 1 | 1]);
}
int main() {
  unit.a[0][0] = unit.a[1][1] = 1;
  scanf("%d", &n);
  int inv = ksm(100, MOD - 2) % MOD;
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &x[i], &v[i], &p[i]), p[i] = (long long)p[i] * inv % MOD,
                                          q[i] = (1 + MOD - p[i]) % MOD;
  for (int i = 2; i <= n; i++) {
    if (v[i] > v[i - 1]) {
      tot++;
      col[tot].x = i - 1;
      col[tot].y = i;
      col[tot].op = 0;
      col[tot].tim = (double)1.0 * (x[i] - x[i - 1]) / (v[i] - v[i - 1]);
      col[tot].val =
          (long long)(x[i] - x[i - 1]) * ksm(v[i] - v[i - 1], MOD - 2) % MOD;
    } else if (v[i] < v[i - 1]) {
      tot++;
      col[tot].x = i - 1;
      col[tot].y = i;
      col[tot].op = 2;
      col[tot].tim = (double)1.0 * (x[i] - x[i - 1]) / (v[i - 1] - v[i]);
      col[tot].val =
          (long long)(x[i] - x[i - 1]) * ksm(v[i - 1] - v[i], MOD - 2) % MOD;
    }
    if (v[i] >= v[i - 1]) m1[i - 1].a[1][1] = p[i], m2[i].a[1][1] = p[i - 1];
    if (v[i] <= v[i - 1]) m1[i - 1].a[0][0] = q[i], m2[i].a[0][0] = q[i - 1];
    tot++;
    col[tot].x = i - 1;
    col[tot].y = i;
    col[tot].op = 1;
    col[tot].tim = (double)1.0 * (x[i] - x[i - 1]) / (v[i] + v[i - 1]);
    col[tot].val =
        (long long)(x[i] - x[i - 1]) * ksm(v[i] + v[i - 1], MOD - 2) % MOD;
  }
  std::sort(col + 1, col + tot + 1, cmp);
  for (int i = 1; i < n; i++) m1[i].a[0][1] = p[i + 1];
  for (int i = 2; i <= n; i++) m2[i].a[0][1] = q[i - 1];
  build(1, 1, n);
  int ans = 0;
  for (int i = 1; i <= tot; i++) {
    mat w1 = query(1, 1, n, col[i].y, n - 1, 1),
        w2 = query(1, 1, n, 2, col[i].x, 2);
    int op = col[i].op, d1 = op == 0 ? 0 : 1, d2 = op == 2 ? 1 : 0;
    int p1 = ((long long)w1.a[d2][0] + (long long)w1.a[d2][1]) % MOD;
    int p2 = ((long long)w2.a[0][d1] + (long long)w2.a[1][d1]) % MOD;
    int val = (long long)p1 % MOD * p2 % MOD * col[i].val % MOD;
    val = (long long)val * (d1 ? p[col[i].x] : q[col[i].x]) % MOD;
    val = (long long)val * (d2 ? p[col[i].y] : q[col[i].y]) % MOD;
    (ans += val) %= MOD;
    if (!col[i].op)
      ins1(1, 1, n, col[i].x, 0, 0), ins2(1, 1, n, col[i].y, 0, 0);
    else if (col[i].op == 1)
      ins1(1, 1, n, col[i].x, 1, 0), ins2(1, 1, n, col[i].y, 1, 0);
    else
      ins1(1, 1, n, col[i].x, 1, 1), ins2(1, 1, n, col[i].y, 1, 1);
  }
  printf("%d\n", ans);
  return 0;
}