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 int MOD = 998244353;
const int MAXN = 2e6 + 5;
struct md {
  int a;
  md() {}
  md(int a) : a(a % MOD) {}
};
md inv[MAXN];
md operator+(md a, md b) { return md(a.a + b.a); }
md operator+=(md& a, md b) { return a = a + b; }
md operator-(md a, md b) { return md(a.a - b.a + MOD); }
md operator*(md a, md b) { return md(a.a * 1ll * b.a % MOD); }
md operator/(md a, md b) { return a * md(inv[b.a]); }
md x[MAXN], v[MAXN], p[MAXN];
array<array<md, 2>, 2> seg[MAXN], arr[MAXN];
array<array<md, 2>, 2> merge(array<array<md, 2>, 2> a,
                             array<array<md, 2>, 2> b) {
  array<array<md, 2>, 2> c;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) c[i][j] = md(0);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++) c[i][j] += a[i][k] * b[k][j];
  return c;
}
array<array<md, 2>, 2> id;
void build(int l, int r, int k) {
  seg[k] = id;
  if (l == r) return;
  int m = (l + r) / 2;
  build(l, m, k * 2);
  build(m + 1, r, k * 2 + 1);
}
void upd(int l, int r, int k, int a, array<array<md, 2>, 2> v) {
  if (a < l || r < a) return;
  if (l == r) {
    seg[k] = v;
    return;
  }
  int m = (l + r) / 2;
  upd(l, m, k * 2, a, v);
  upd(m + 1, r, k * 2 + 1, a, v);
  seg[k] = merge(seg[k * 2], seg[k * 2 + 1]);
}
ostream& operator<<(ostream& o, md a) {
  o << a.a;
  return o;
}
int main() {
  id[0][0] = id[1][1] = md(1);
  id[0][1] = id[1][0] = md(0);
  inv[1] = md(1);
  for (int i = 2; i < MAXN; i++) inv[i] = md(0) - md(MOD / i) * inv[MOD % i];
  int n;
  scanf("%d", &n);
  build(0, n - 1, 1);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &x[i].a, &v[i].a, &p[i].a);
    p[i] = p[i] / md(100);
    arr[i][0] = arr[i][1] = {md(1) - p[i], p[i]};
    upd(0, n - 1, 1, i, arr[i]);
  }
  vector<array<int, 4>> ev;
  for (int i = 1; i < n; i++) {
    ev.push_back({x[i].a - x[i - 1].a, v[i].a + v[i - 1].a, i, 0});
    if (v[i].a < v[i - 1].a)
      ev.push_back({x[i].a - x[i - 1].a, -v[i].a + v[i - 1].a, i, -1});
    if (v[i].a > v[i - 1].a)
      ev.push_back({x[i].a - x[i - 1].a, v[i].a - v[i - 1].a, i, +1});
  }
  sort(ev.begin(), ev.end(), [](array<int, 4> l, array<int, 4> r) {
    return l[0] * 1ll * r[1] < r[0] * 1ll * l[1];
  });
  md ans = md(0), lst = md(0);
  for (int i = 0; i < (int)(ev).size(); i++) {
    md cur = md(ev[i][0]) / md(ev[i][1]);
    ans += (cur - lst) * (seg[1][0][0] + seg[1][1][1]);
    lst = cur;
    if (ev[i][3] == 0)
      arr[ev[i][2]][1][0] = md(0);
    else if (ev[i][3] == -1)
      arr[ev[i][2]][1][1] = md(0);
    else
      arr[ev[i][2]][0][0] = md(0);
    upd(0, n - 1, 1, ev[i][2], arr[ev[i][2]]);
  }
  ans = ans - lst * (seg[1][0][0] + seg[1][1][1]);
  printf("%d\n", ans.a);
  return 0;
}