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;
inline int power(int a, int b) {
  long long res = a, ans = 1;
  for (; b; b >>= 1, res = res * res % mod)
    if (b & 1) ans = ans * res % mod;
  return ans;
}
struct node {
  int a, b, id, type;
  friend inline int operator<(const node &a, const node &b) {
    return 1ll * a.a * b.b > 1ll * b.a * a.b;
  }
};
priority_queue<node> q;
int n;
int v[100010], x[100010], p[100010];
int prodp[100010], prod1p[100010], now[100010], ans, fa[100010], rest,
    vis[100010];
int qd[100010];
inline int gf(int a) { return fa[a] == a ? a : fa[a] = gf(fa[a]); }
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] * power(100, mod - 2) % mod;
    fa[i] = i;
    prodp[i] = p[i];
    prod1p[i] = (1 - p[i] + mod) % mod;
    now[i] = 1;
  }
  for (int i = 1; i < n; i++) {
    q.push(node{x[i + 1] - x[i], v[i + 1] + v[i], i, 0});
    if (v[i] != v[i + 1])
      q.push(node{x[i + 1] - x[i], abs(v[i + 1] - v[i]), i, 1});
  }
  rest = 1;
  while (!q.empty()) {
    node nown = q.top();
    q.pop();
    int id = nown.id, x = 1ll * nown.a * power(nown.b, mod - 2) % mod;
    if (nown.type == 0) {
      vis[id] = 1;
      int l = gf(id), r = gf(id + 1);
      if (qd[id] == 'l' || qd[id + 1] == 'r') {
        continue;
      }
      if (qd[id] == 'r' && qd[id + 1] == 'l') {
        ans = (ans + 1ll * rest * x) % mod;
        return cout << ans << endl, 0;
      }
      if (qd[id] == 'r') {
        int tmp = rest;
        rest = 1ll * rest * prodp[r] % mod * power(now[r], mod - 2) % mod;
        ans = (ans + 1ll * (tmp - rest + mod) * x) % mod;
        for (int i = id + 1; vis[i - 1]; i++) {
          if (qd[i] == 'l') return cout << ans << endl, 0;
          qd[i] = 'r';
        }
        fa[r] = l;
      } else if (qd[id + 1] == 'l') {
        int tmp = rest;
        rest = 1ll * rest * prod1p[l] % mod * power(now[l], mod - 2) % mod;
        ans = (ans + 1ll * (tmp - rest + mod) * x) % mod;
        for (int i = id; i && vis[i]; i--) {
          if (qd[i] == 'r') return cout << ans << endl, 0;
          qd[i] = 'l';
        }
        fa[l] = r;
      } else {
        int tmp = rest;
        fa[l] = r;
        rest = 1ll * rest * power(now[l], mod - 2) % mod *
               power(now[r], mod - 2) % mod;
        now[r] = (1ll * now[r] * prod1p[l] + 1ll * now[l] * prodp[r] + mod -
                  1ll * prodp[r] * prod1p[l] % mod) %
                 mod;
        rest = 1ll * rest * now[r] % mod;
        prodp[r] = 1ll * prodp[r] * prodp[l] % mod;
        prod1p[r] = 1ll * prod1p[r] * prod1p[l] % mod;
        ans = (ans + 1ll * (tmp - rest + mod) * x) % mod;
      }
    } else {
      int f = gf(id);
      if (v[id] > v[id + 1]) {
        int i, tmp = rest;
        for (i = id; i && vis[i]; i--) {
          if (qd[i] == 'r') return cout << (ans + 1ll * rest * x) % mod, 0;
          if (qd[i] == 'l') break;
        }
        rest = 1ll * rest * power(now[f], mod - 2) % mod;
        for (; i++ != id;) {
          qd[i] = 'l';
          rest = 1ll * rest * (mod + 1 - p[i]) % mod;
          now[f] = 1ll * power(mod + 1 - p[i], mod - 2) *
                   (now[f] - prodp[f] + mod) % mod;
          prodp[f] = 1ll * prodp[f] * power(p[i], mod - 2) % mod;
          prod1p[f] = 1ll * prod1p[f] * power(mod + 1 - p[i], mod - 2) % mod;
        }
        rest = 1ll * rest * now[f] % mod;
        ans = (ans + 1ll * (tmp - rest + mod) * x) % mod;
      } else {
        int i, tmp = rest;
        for (i = id + 1; vis[i - 1]; i++) {
          if (qd[i] == 'l')
            return cout << (ans + 1ll * rest * x) % mod << endl, 0;
          if (qd[i] == 'r') break;
        }
        rest = 1ll * rest * power(now[f], mod - 2) % mod;
        for (; i-- != id + 1;) {
          qd[i] = 'r';
          rest = 1ll * rest * p[i] % mod;
          now[f] =
              1ll * power(p[i], mod - 2) * (now[f] - prod1p[f] + mod) % mod;
          prodp[f] = 1ll * prodp[f] * power(p[i], mod - 2) % mod;
          prod1p[f] = 1ll * prod1p[f] * power(mod + 1 - p[i], mod - 2) % mod;
        }
        rest = 1ll * rest * now[f] % mod;
        ans = (ans + 1ll * (tmp - rest + mod) * x) % mod;
      }
    }
  }
  return cout << ans << endl, 0;
}