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 N = 1e5 + 5, mod = 998244353;
int n, x[N], v[N], p[N][2], tot;
long long ans;
struct node {
  int id;
  bool d1, d2;
  long long x, y;
} cra[N << 1];
bool cmp(node a, node b) { return a.x * b.y < b.x * a.y; }
long long fpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
struct matrix {
  long long a[2][2];
  matrix operator*(const matrix x) const {
    matrix res;
    for (int i = 0; i <= 1; i++) {
      for (int j = 0; j <= 1; j++) {
        res.a[i][j] = 0;
        for (int k = 0; k <= 1; k++) {
          res.a[i][j] = (res.a[i][j] + a[i][k] * x.a[k][j]) % mod;
        }
      }
    }
    return res;
  }
} lim[N];
struct Seg_Tree {
  matrix d[N << 2];
  inline int ls(int u) { return u << 1; }
  inline int rs(int u) { return u << 1 | 1; }
  inline void push_up(int u) { d[u] = d[ls(u)] * d[rs(u)]; }
  void build(int u, int l, int r) {
    if (l == r) {
      d[u] = lim[l];
      return;
    }
    int mid = (l + r) >> 1;
    build(ls(u), l, mid);
    build(rs(u), mid + 1, r);
    push_up(u);
  }
  void update(int u, int l, int r, int x, matrix k) {
    if (l == r) {
      d[u] = k;
      return;
    }
    int mid = (l + r) >> 1;
    if (x <= mid) {
      update(ls(u), l, mid, x, k);
    } else {
      update(rs(u), mid + 1, r, x, k);
    }
    push_up(u);
  }
} t;
int main() {
  scanf("%d", &n);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  long long inv = fpow(100, mod - 2);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x[i], &v[i], &p[i][1]);
    p[i][1] = p[i][1] * inv % mod;
    p[i][0] = (1 - p[i][1] + mod) % mod;
    if (i > 1) {
      cra[++tot] = (node){i, 1, 0, x[i] - x[i - 1], v[i] + v[i - 1]};
      if (v[i - 1] > v[i]) {
        cra[++tot] = (node){i, 1, 1, x[i] - x[i - 1], v[i - 1] - v[i]};
      }
      if (v[i - 1] < v[i]) {
        cra[++tot] = (node){i, 0, 0, x[i] - x[i - 1], v[i] - v[i - 1]};
      }
    }
  }
  sort(cra + 1, cra + tot + 1, cmp);
  lim[1].a[0][0] = p[1][0], lim[1].a[0][1] = p[1][1],
  lim[1].a[1][0] = lim[1].a[1][1] = 0;
  for (int i = 2; i <= n; i++) {
    lim[i].a[0][0] = lim[i].a[1][0] = p[i][0];
    lim[i].a[0][1] = lim[i].a[1][1] = p[i][1];
  }
  t.build(1, 1, n);
  long long last = 1;
  for (int i = 1; i <= tot; i++) {
    int id = cra[i].id;
    long long tim = cra[i].x * fpow(cra[i].y, mod - 2) % mod;
    lim[id].a[cra[i].d1][cra[i].d2] = 0;
    t.update(1, 1, n, id, lim[id]);
    long long P = (t.d[1].a[0][0] + t.d[1].a[0][1]) % mod;
    ans = (ans + tim * (last - P + mod)) % mod;
    last = P;
  }
  printf("%lld\n", ans);
  return 0;
}