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;
using ll = long long;
const ll mod = 998244353;
int n, x[1 << 17], v[1 << 17], p[1 << 17], _, $, f[1 << 17][3];
ll ans;
struct st {
  int x, y;
} q[1 << 20];
ll po(ll a, ll b) {
  ll r = 1;
  for (; b; b /= 2, a = a * a % mod)
    if (b & 1) r = r * a % mod;
  return r;
}
struct Rat {
  ll x, y;
  ll Q() { return x % mod * po(y % mod, mod - 2) % mod; }
} E[1 << 17][3];
bool operator<(Rat a, Rat b) { return a.x * b.y < b.x * a.y; }
bool operator==(Rat a, Rat b) { return a.x * b.y == b.x * a.y; }
struct node {
  ll a[2][2];
};
node operator+(node a, node b) {
  node c;
  memset(c.a, 0, sizeof c.a);
  for (int i : {0, 1})
    for (int j : {0, 1})
      for (int k : {0, 1}) {
        if (j == 0 && k == 0 && f[$][2]) continue;
        if (j == 1 && k == 1 && f[$][1]) continue;
        if (j == 1 && k == 0 && f[$][0]) continue;
        for (int l : {0, 1}) (c.a[i][l] += a.a[i][j] * b.a[k][l]) %= mod;
      }
  return c;
}
struct segTree {
  node a[1 << 18];
  void build(int p = 1, int tl = 1, int tr = n) {
    if (tl == tr) {
      a[p].a[0][0] = 1 - ::p[tl], a[p].a[1][1] = ::p[tl];
      return;
    }
    int mid = tl + tr >> 1;
    build(p * 2, tl, mid);
    build(p * 2 + 1, mid + 1, tr);
    $ = mid, a[p] = a[p * 2] + a[p * 2 + 1];
  }
  void ins(int x, int p = 1, int tl = 1, int tr = n) {
    if (tl == tr) return;
    int mid = tl + tr >> 1;
    if (x <= mid)
      ins(x, p * 2, tl, mid);
    else
      ins(x, p * 2 + 1, mid + 1, tr);
    $ = mid, a[p] = a[p * 2] + a[p * 2 + 1];
  }
  node qry(int l, int r, int p = 1, int tl = 1, int tr = n) {
    if (l <= tl && tr <= r) return a[p];
    int mid = tl + tr >> 1;
    if (r <= mid) return qry(l, r, p * 2, tl, mid);
    if (l > mid) return qry(l, r, p * 2 + 1, mid + 1, tr);
    node L = qry(l, r, p * 2, tl, mid), R = qry(l, r, p * 2 + 1, mid + 1, tr);
    $ = mid;
    return L + R;
  }
} tr;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", x + i, v + i, p + i),
        p[i] = 1ll * p[i] * po(100, mod - 2) % mod;
  for (int i = 1; i < n; i++) {
    E[i][0] = {x[i + 1] - x[i], v[i] + v[i + 1]}, q[++_] = {i, 0};
    if (v[i] > v[i + 1])
      E[i][1] = {x[i + 1] - x[i], v[i] - v[i + 1]}, q[++_] = {i, 1};
    if (v[i] < v[i + 1])
      E[i][2] = {x[i + 1] - x[i], v[i + 1] - v[i]}, q[++_] = {i, 2};
  }
  sort(q + 1, q + 1 + _, [&](st a, st b) { return E[a.x][a.y] < E[b.x][b.y]; });
  tr.build();
  for (int i = 1; i <= _; i++) {
    Rat now = E[q[i].x][q[i].y];
    node a = tr.qry(1, q[i].x), b = tr.qry(q[i].x + 1, n);
    ll v = now.Q() *
           (a.a[0][q[i].y == 2 ? 0 : 1] + a.a[1][q[i].y == 2 ? 0 : 1]) % mod *
           (b.a[q[i].y == 1 ? 1 : 0][0] + b.a[q[i].y == 1 ? 1 : 0][1]) % mod;
    (ans += v) %= mod;
    f[q[i].x][q[i].y] = 1;
    tr.ins(q[i].x);
    tr.ins(q[i].x + 1);
  }
  printf("%lld\n", (ans + mod) % mod);
  return 0;
}