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;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const long long mod = 998244353;
struct mat {
  long long a[2][2];
  mat() {
    for (long long i = 0; i <= 1; i++)
      for (long long j = 0; j <= 1; j++) a[i][j] = 0;
  }
} tree[200010 << 2];
const long long INF = 0x7f7f7f7f7f7f7f;
struct node {
  long long pos, p1, p2, val;
  double t;
} side[800010];
long long cnt;
long long ans, x[200010], v[200010], p[200010], n;
bool cmp1(node x, node y) { return x.t < y.t; }
inline long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return res;
}
inline mat mul(mat x, mat y) {
  mat res;
  for (long long i = 0; i <= 1; i++)
    for (long long j = 0; j <= 1; j++)
      for (long long k = 0; k <= 1; k++)
        res.a[i][j] = (res.a[i][j] + x.a[i][k] * y.a[k][j]) % mod;
  return res;
}
inline void insert(long long pos, long long p1, long long p2) {
  side[++cnt].pos = pos;
  side[cnt].p1 = p1, side[cnt].p2 = p2;
  if (p1 == 0 && p2 == 0) {
    long long tmp = v[pos] - v[pos - 1];
    if (tmp > 0)
      side[cnt].val = (x[pos] - x[pos - 1]) * qpow(tmp, mod - 2) % mod,
      side[cnt].t = (x[pos] - x[pos - 1]) * 1.0 / tmp;
    else
      side[cnt].val = INF, side[cnt].t = 1e20;
  }
  if (p1 == 0 && p2 == 1) side[cnt].val = INF, side[cnt].t = 1e20;
  if (p1 == 1 && p2 == 0)
    side[cnt].val = (x[pos] - x[pos - 1]) % mod *
                    qpow((v[pos] + v[pos - 1]) % mod, mod - 2) % mod,
    side[cnt].t = (x[pos] - x[pos - 1]) * 1.0 / (v[pos - 1] + v[pos]);
  if (p1 == 1 && p2 == 1) {
    long long tmp = v[pos - 1] - v[pos];
    if (tmp > 0)
      side[cnt].val = (x[pos] - x[pos - 1]) * qpow(tmp, mod - 2) % mod,
      side[cnt].t = (x[pos] - x[pos - 1]) * 1.0 / tmp;
    else
      side[cnt].val = INF, side[cnt].t = 1e20;
  }
}
inline void push_up(long long x) {
  tree[x] = mul(tree[x << 1], tree[x << 1 | 1]);
}
inline void build(long long l, long long r, long long x) {
  if (l == r) {
    tree[x].a[0][0] = tree[x].a[1][0] = (1 - p[l] + mod) % mod;
    tree[x].a[0][1] = tree[x].a[1][1] = p[l];
    return;
  }
  long long mid = l + r >> 1;
  build(l, mid, x << 1), build(mid + 1, r, x << 1 | 1);
  push_up(x);
  return;
}
inline void update(long long u, long long p1, long long p2, long long l,
                   long long r, long long x) {
  if (l == r) {
    tree[x].a[p1][p2] = 0;
    return;
  }
  long long mid = l + r >> 1;
  if (u <= mid)
    update(u, p1, p2, l, mid, x << 1);
  else
    update(u, p1, p2, mid + 1, r, x << 1 | 1);
  push_up(x);
  return;
}
inline mat query(long long ql, long long qr, long long l, long long r,
                 long long x) {
  if (ql > qr) {
    mat res;
    res.a[0][0] = res.a[1][1] = 1;
    return res;
  }
  if (ql <= l && qr >= r) return tree[x];
  long long mid = l + r >> 1;
  mat res;
  res.a[0][0] = res.a[1][1] = 1;
  if (ql <= mid) res = mul(res, query(ql, qr, l, mid, x << 1));
  if (qr > mid) res = mul(res, query(ql, qr, mid + 1, r, x << 1 | 1));
  return res;
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++)
    x[i] = read(), v[i] = read(), p[i] = read() * qpow(100ll, mod - 2) % mod;
  build(1, n, 1);
  for (long long i = 2; i <= n; i++)
    for (long long j = 0; j <= 1; j++)
      for (long long k = 0; k <= 1; k++) insert(i, j, k);
  sort(side + 1, side + cnt + 1, cmp1);
  for (long long i = 1; i <= cnt; i++) {
    if (side[i].val == INF) break;
    mat trans;
    trans.a[side[i].p1][side[i].p2] =
        (side[i].p2 ? p[side[i].pos] : (1 - p[side[i].pos] + mod) % mod);
    trans = mul(query(1, side[i].pos - 1, 1, n, 1), trans);
    trans = mul(trans, query(side[i].pos + 1, n, 1, n, 1));
    ans += (trans.a[0][0] + trans.a[0][1]) * side[i].val % mod;
    ans %= mod;
    update(side[i].pos, side[i].p1, side[i].p2, 1, n, 1);
  }
  printf("%lld\n", ans);
  return 0;
}