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 long long N = 1e5 + 7;
const long long INF = 1e9 + 7;
const long long mod = 998244353;
long long Pow(long long x, long long y) {
  long long ans = 1, now = x;
  while (y) {
    if (y & 1) ans = ans * now % mod;
    now = now * now % mod;
    y >>= 1;
  }
  return ans;
}
long long n;
long long X[N], v[N], p1[N], p2[N], mx[N], mi[N], f[N], h1[N], h2[N], hs[N];
struct pir {
  long long w1, w2, w;
};
pir mer(pir a, pir b) {
  return (pir){a.w1 * b.w1 % mod, a.w2 * b.w2 % mod,
               (a.w1 * b.w + b.w2 * a.w - a.w1 * b.w2 % mod + mod) % mod};
}
struct Tree {
  long long l, r;
  pir s;
} tr[N * 4];
void build(long long l, long long r, long long p) {
  tr[p] = (Tree){l, r, (pir){0, 0, 0}};
  if (l == r) {
    tr[p].s.w1 = p1[l];
    tr[p].s.w2 = p2[l];
    tr[p].s.w = (p1[l] + p2[l]) % mod;
    return;
  }
  long long mid = (l + r) >> 1;
  build(l, mid, p * 2);
  build(mid + 1, r, p * 2 + 1);
  tr[p].s = mer(tr[p * 2].s, tr[p * 2 + 1].s);
}
pir check(long long p, long long L, long long R) {
  if (L > R) {
    return (pir){1, 1, 1};
  }
  long long l = tr[p].l, r = tr[p].r;
  if (L <= l && R >= r) return tr[p].s;
  long long mid = (l + r) >> 1;
  if (L <= mid) {
    if (R > mid) return mer(check(p * 2, L, R), check(p * 2 + 1, L, R));
    return check(p * 2, L, R);
  }
  return check(p * 2 + 1, L, R);
}
struct tms {
  long long id, o1, o2, d, v;
} t[N * 4];
bool cmp(tms a, tms b) { return a.d * b.v < a.v * b.d; }
long long ff(long long x) { return (f[x] == x) ? x : f[x] = ff(f[x]); }
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++)
    scanf("%lld%lld%lld", &X[i], &v[i], &p1[i]);
  long long iv = Pow(100, mod - 2);
  for (long long i = 1; i <= n; i++) {
    p2[i] = p1[i] * iv % mod;
    p1[i] = (1 - p2[i] + mod) % mod;
  }
  build(1, n, 1);
  for (long long i = 1; i <= n; i++) {
    mx[i] = mi[i] = f[i] = i;
    h1[i] = INF;
    h2[i] = 0;
    hs[i] = 1;
  }
  long long cnt = 0;
  for (long long i = 1; i <= n - 1; i++) {
    t[++cnt] = (tms){i, 2, 1, X[i + 1] - X[i], v[i] + v[i + 1]};
    if (v[i] > v[i + 1])
      t[++cnt] = (tms){i, 2, 2, X[i + 1] - X[i], v[i] - v[i + 1]};
    if (v[i] < v[i + 1])
      t[++cnt] = (tms){i, 1, 1, X[i + 1] - X[i], v[i + 1] - v[i]};
  }
  sort(t + 1, t + cnt + 1, cmp);
  t[0].d = t[0].v = 0;
  long long ans = 0, pb = 1;
  for (long long i = 1; i <= cnt; i++) {
    ans = (ans + (t[i].d * Pow(t[i].v, mod - 2) % mod -
                  t[i - 1].d * Pow(t[i - 1].v, mod - 2) % mod + mod) *
                     pb) %
          mod;
    if (t[i].o1 ^ t[i].o2) {
      long long u = ff(t[i].id + 1);
      pb = pb * Pow(hs[u], mod - 2) % mod;
      pb = pb * Pow(hs[t[i].id], mod - 2) % mod;
      mx[u] = max(mx[u], mx[t[i].id]);
      mi[u] = min(mi[u], mi[t[i].id]);
      h1[u] = min(h1[u], h1[t[i].id]);
      h2[u] = max(h2[u], h2[t[i].id]);
      f[t[i].id] = u;
      if (h1[u] < h2[u]) {
        printf("%lld\n", ans);
        return 0;
      }
      pir e1 = check(1, mi[u], max(mi[u] - 1, h2[u]));
      pir e2 = check(1, max(mi[u] - 1, h2[u]) + 1, min(mx[u], h1[u]));
      pir e3 = check(1, min(mx[u], h1[u]) + 1, mx[u]);
      hs[u] = e1.w1 * e2.w % mod * e3.w2 % mod;
      pb = pb * hs[u] % mod;
    } else {
      long long u = ff(t[i].id);
      pb = pb * Pow(hs[u], mod - 2) % mod;
      if (t[i].o1 == 2)
        h2[u] = max(h2[u], t[i].id);
      else
        h1[u] = min(h1[u], t[i].id);
      if (h1[u] < h2[u]) {
        printf("%lld\n", ans);
        return 0;
      }
      pir e1 = check(1, mi[u], max(mi[u] - 1, h2[u]));
      pir e2 = check(1, max(mi[u] - 1, h2[u]) + 1, min(mx[u], h1[u]));
      pir e3 = check(1, min(mx[u], h1[u]) + 1, mx[u]);
      hs[u] = e1.w1 * e2.w % mod * e3.w2 % mod;
      pb = pb * hs[u] % mod;
    }
  }
  ans = (ans - t[cnt].d * Pow(t[cnt].v, mod - 2) % mod * pb % mod + mod) % mod;
  printf("%lld\n", ans);
  return 0;
}