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;
struct Mat {
  long long num[2][2];
  Mat() { num[0][0] = num[0][1] = num[1][0] = num[1][1] = 1; }
  Mat(long long a) {
    num[0][0] = num[0][1] = a;
    num[1][0] = 0;
    num[1][1] = (1 + 998244353 - a) % 998244353;
  }
  Mat friend operator*(Mat x1, Mat x2) {
    Mat x3;
    x3.num[0][0] =
        (x1.num[0][0] * x2.num[0][0] + x1.num[0][1] * x2.num[1][0]) % 998244353;
    x3.num[0][1] =
        (x1.num[0][0] * x2.num[0][1] + x1.num[0][1] * x2.num[1][1]) % 998244353;
    x3.num[1][0] =
        (x1.num[1][0] * x2.num[0][0] + x1.num[1][1] * x2.num[1][0]) % 998244353;
    x3.num[1][1] =
        (x1.num[1][0] * x2.num[0][1] + x1.num[1][1] * x2.num[1][1]) % 998244353;
    return x3;
  }
} mp;
struct Point {
  long long v, x;
  int no, k;
  bool friend operator<(Point x1, Point x2) {
    if (x1.x * x2.v == x2.x * x1.v) return x1.no < x2.no;
    return (x1.x * x2.v) > (x2.x * x1.v);
  }
} pp;
struct Node {
  int l, r, mid;
  Mat m;
} tre[400005];
long long p[100005], x[100005], v[100005], ni;
priority_queue<Point> pq;
long long ksm(long long x) {
  long long z = 1, y = 998244353 - 2;
  while (y) {
    if (y % 2) z = (z * x) % 998244353;
    y >>= 1;
    x = (x * x) % 998244353;
  }
  return z;
}
void build(int x, int l, int r) {
  tre[x].l = l;
  tre[x].r = r;
  tre[x].mid = (l + r) / 2;
  if (l == r) {
    tre[x].m.num[0][0] = tre[x].m.num[0][1] =
        (1 + 998244353 - p[l]) % 998244353;
    tre[x].m.num[1][0] = tre[x].m.num[1][1] = p[l];
  } else {
    build(x * 2, l, tre[x].mid);
    build(x * 2 + 1, tre[x].mid + 1, r);
    tre[x].m = tre[x * 2].m * tre[x * 2 + 1].m;
  }
}
Mat ask(int x, int l, int r) {
  if (tre[x].l == l && r == tre[x].r)
    return tre[x].m;
  else if (r <= tre[x].mid)
    return ask(x * 2, l, r);
  else if (l > tre[x].mid)
    return ask(x * 2 + 1, l, r);
  return ask(x * 2, l, tre[x].mid) * ask(x * 2 + 1, tre[x].mid + 1, r);
}
void change(int x, int y, int k) {
  if (tre[x].l == tre[x].r) {
    if (k == 1) tre[x].m.num[1][0] = 0;
    if (k == 2) tre[x].m.num[0][0] = 0;
    if (k == 3) tre[x].m.num[1][1] = 0;
  } else {
    if (y <= tre[x].mid)
      change(x * 2, y, k);
    else
      change(x * 2 + 1, y, k);
    tre[x].m = tre[x * 2].m * tre[x * 2 + 1].m;
  }
}
int main() {
  int n;
  ni = ksm(100);
  long long ans = 0, tp, pl, pr, ppl, ppr;
  scanf("%d", &n);
  scanf("%lld%lld%lld", &x[1], &v[1], &p[1]);
  p[1] = (p[1] * ni) % 998244353;
  for (int i = 1; i < n; i++) {
    pp.no = i;
    scanf("%lld%lld%lld", &x[i + 1], &v[i + 1], &p[i + 1]);
    p[i + 1] = (p[i + 1] * ni) % 998244353;
    pp.x = x[i + 1] - x[i];
    pp.k = 1;
    pp.v = v[i] + v[i + 1];
    pq.push(pp);
    if (v[i] < v[i + 1]) {
      pp.k = 2;
      pp.v = v[i + 1] - v[i];
      pq.push(pp);
    }
    if (v[i] > v[i + 1]) {
      pp.k = 3;
      pp.v = v[i] - v[i + 1];
      pq.push(pp);
    }
  }
  build(1, 0, n);
  while (!pq.empty()) {
    pp = pq.top();
    pq.pop();
    tp = (pp.x * ksm(pp.v)) % 998244353;
    mp = ask(1, pp.no + 1, n);
    pl = mp.num[0][0];
    pr = mp.num[1][0];
    ppl = ppr = 0;
    if (pp.k == 1) ppr = (pl * p[pp.no]) % 998244353;
    if (pp.k == 2) ppl = (pl * (1 + 998244353 - p[pp.no])) % 998244353;
    if (pp.k == 3) ppr = (pr * p[pp.no]) % 998244353;
    mp = ask(1, 0, pp.no - 1);
    pl = (ppl * mp.num[0][0] + ppr * mp.num[0][1]) % 998244353;
    pr = (ppl * mp.num[1][0] + ppr * mp.num[1][1]) % 998244353;
    ans = (ans + tp * (pl + pr)) % 998244353;
    change(1, pp.no, pp.k);
  }
  printf("%lld\n", ans);
  return 0;
}