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;
inline int qpow(int d, int z) {
  int ret = 1;
  for (; z; z >>= 1, d = 1ll * d * d % mod)
    if (z & 1) ret = 1ll * ret * d % mod;
  return ret;
}
int n;
int x[200050], v[200050], p[200050][2];
struct node2 {
  int id, l, r, v, x;
} lsh[200050 << 2];
int ls;
struct node {
  int a[2][2];
  inline void init() {
    a[0][0] = a[1][1] = 1;
    a[0][1] = a[1][0] = 0;
  }
  friend node operator*(const node &a, const node &b) {
    static node c;
    c.a[0][0] =
        (1ll * a.a[0][0] * b.a[0][0] + 1ll * a.a[0][1] * b.a[1][0]) % mod;
    c.a[0][1] =
        (1ll * a.a[0][0] * b.a[0][1] + 1ll * a.a[0][1] * b.a[1][1]) % mod;
    c.a[1][0] =
        (1ll * a.a[1][0] * b.a[0][0] + 1ll * a.a[1][1] * b.a[1][0]) % mod;
    c.a[1][1] =
        (1ll * a.a[1][0] * b.a[0][1] + 1ll * a.a[1][1] * b.a[1][1]) % mod;
    return c;
  }
} mt[200050 << 2], a[200050];
inline int getv(int id, int l, int r) {
  if (!l && !r) return v[id + 1] - v[id];
  if (!l && r) return 0;
  if (l && !r) return v[id + 1] + v[id];
  return v[id] - v[id + 1];
}
inline bool cmp(const node2 &a, const node2 &b) {
  return 1ll * a.x * b.v < 1ll * b.x * a.v;
}
inline void build(int g, int l, int r) {
  if (l == r) {
    mt[g] = a[l];
    return;
  }
  const int m = l + r >> 1;
  build(g << 1, l, m);
  build(g << 1 | 1, m + 1, r);
  mt[g] = mt[g << 1] * mt[g << 1 | 1];
}
inline void change(int g, int l, int r, int x) {
  if (l == r) return mt[g] = a[l], void();
  const int m = l + r >> 1;
  if (x <= m)
    change(g << 1, l, m, x);
  else
    change(g << 1 | 1, m + 1, r, x);
  mt[g] = mt[g << 1] * mt[g << 1 | 1];
}
inline node ask(int g, int l, int r, int x, int y) {
  if (l > y || r < x) {
    return (node){1, 0, 0, 1};
  }
  if (l >= x && r <= y) return mt[g];
  const int m = l + r >> 1;
  node r1 = ask(g << 1, l, m, x, y), r2 = ask(g << 1 | 1, m + 1, r, x, y);
  return r1 * r2;
}
int main() {
  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[i][1]);
  const long long iv = qpow(100, mod - 2);
  for (int i = 1; i <= n; ++i) {
    p[i][1] = iv * p[i][1] % mod;
    p[i][0] = (mod + 1 - p[i][1]) % mod;
  }
  for (int i = 1; i < n; ++i) {
    lsh[++ls] = (node2){i, 0, 0, getv(i, 0, 0), x[i + 1] - x[i]};
    if (lsh[ls].v <= 0) --ls;
    lsh[++ls] = (node2){i, 0, 1, getv(i, 0, 1), x[i + 1] - x[i]};
    if (lsh[ls].v <= 0) --ls;
    lsh[++ls] = (node2){i, 1, 0, getv(i, 1, 0), x[i + 1] - x[i]};
    if (lsh[ls].v <= 0) --ls;
    lsh[++ls] = (node2){i, 1, 1, getv(i, 1, 1), x[i + 1] - x[i]};
    if (lsh[ls].v <= 0) --ls;
    a[i].a[0][0] = a[i].a[0][1] = p[i][0];
    a[i].a[1][0] = a[i].a[1][1] = p[i][1];
  }
  --n;
  build(1, 1, n);
  sort(lsh + 1, lsh + ls + 1, cmp);
  int ans = 0;
  node x, y;
  node2 d;
  int t1, t2;
  for (int i = 1; i <= ls; ++i) {
    d = lsh[i];
    t1 = -1, t2 = -1;
    if (d.id != 1)
      x = ask(1, 1, n, 1, d.id - 1);
    else
      t1 = p[d.id][d.l];
    if (d.id != n)
      y = ask(1, 1, n, d.id + 1, n);
    else
      t2 = p[d.id + 1][d.r];
    if (t1 < 0) t1 = 1ll * (x.a[0][d.l] + x.a[1][d.l]) * (p[d.id][d.l]) % mod;
    if (t2 < 0)
      t2 = (1ll * y.a[d.r][0] * p[n + 1][0] + 1ll * y.a[d.r][1] * p[n + 1][1]) %
           mod;
    ans = (1ll * t1 * t2 % mod * d.x % mod * qpow(d.v, mod - 2) + ans) % mod;
    a[d.id].a[d.l][d.r] = 0;
    change(1, 1, n, d.id);
  }
  cout << ans << endl;
  return 0;
}