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 MAXN = 2e5 + 51, MOD = 998244353, INVP = 828542813;
struct Matrix {
  int num[2][2];
  Matrix() { memset(num, 0, sizeof(num)); }
  inline int *operator[](const int &x) { return num[x]; }
  inline const int *operator[](const int &x) const { return num[x]; }
};
struct SegmentTree {
  int l, r;
  Matrix val;
};
struct Query {
  int d, v, id, dl, dr;
  inline bool operator<(const Query &rhs) const {
    return (long long int)d * rhs.v < (long long int)v * rhs.d;
  }
};
SegmentTree tree[MAXN << 2];
Matrix mat[MAXN];
Query qry[MAXN << 2];
Matrix id, m1, m2, r;
int n, pr, qcnt, res, r2;
int x[MAXN], v[MAXN];
inline int read() {
  register int num = 0, neg = 1;
  register char ch = getchar();
  while (!isdigit(ch) && ch != '-') {
    ch = getchar();
  }
  if (ch == '-') {
    neg = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch - '0');
    ch = getchar();
  }
  return num * neg;
}
inline int qpow(int base, int exponent) {
  int res = 1;
  while (exponent) {
    if (exponent & 1) {
      res = (long long int)res * base % MOD;
    }
    base = (long long int)base * base % MOD, exponent >>= 1;
  }
  return res;
}
inline Matrix operator*(Matrix x, Matrix y) {
  Matrix res;
  res[0][0] =
      ((long long int)x[0][0] * y[0][0] + (long long int)x[0][1] * y[1][0]) %
      MOD;
  res[0][1] =
      ((long long int)x[0][0] * y[0][1] + (long long int)x[0][1] * y[1][1]) %
      MOD;
  res[1][0] =
      ((long long int)x[1][0] * y[0][0] + (long long int)x[1][1] * y[1][0]) %
      MOD;
  res[1][1] =
      ((long long int)x[1][0] * y[0][1] + (long long int)x[1][1] * y[1][1]) %
      MOD;
  return res;
}
inline void update(int node) {
  tree[node].val = tree[node << 1].val * tree[(node << 1) | 1].val;
}
inline void create(int l, int r, int node) {
  tree[node] = (SegmentTree){l, r};
  if (l == r) {
    return (void)(tree[node].val = mat[l]);
  }
  int mid = (l + r) >> 1;
  create(l, mid, node << 1), create(mid + 1, r, (node << 1) | 1), update(node);
}
inline void change(int pos, int x, int node) {
  if (tree[node].l == tree[node].r) {
    return (void)(tree[node].val = mat[x]);
  }
  int mid = (tree[node].l + tree[node].r) >> 1;
  change(pos, x, pos <= mid ? node << 1 : (node << 1) | 1), update(node);
}
int main() {
  n = read(), id[0][0] = id[1][1] = 1;
  for (register int i = 1; i <= n; i++) {
    x[i] = read(), v[i] = read(), pr = (long long int)read() * INVP % MOD;
    mat[i][0][1] = mat[i][1][1] = pr,
    mat[i][0][0] = mat[i][1][0] = (MOD + 1 - pr) % MOD;
  }
  for (register int i = 2; i <= n; i++) {
    qry[++qcnt] = (Query){x[i] - x[i - 1], v[i] + v[i - 1], i, 1, 0};
    v[i] > v[i - 1]
        ? qry[++qcnt] = (Query){x[i] - x[i - 1], v[i] - v[i - 1], i, 0, 0},
          1 : 1;
    v[i] < v[i - 1]
        ? qry[++qcnt] = (Query){x[i] - x[i - 1], v[i - 1] - v[i], i, 1, 1},
          1 : 1;
  }
  sort(qry + 1, qry + qcnt + 1), create(1, n, 1);
  for (register int i = 1; i <= qcnt; i++) {
    m1 = mat[qry[i].id], m2 = Matrix(),
    r2 = (long long int)qry[i].d * qpow(qry[i].v, MOD - 2) % MOD;
    m2[qry[i].dl][qry[i].dr] = m1[qry[i].dl][qry[i].dr];
    mat[qry[i].id] = m2, change(qry[i].id, qry[i].id, 1);
    r = tree[1].val,
    res = (res + (long long int)r2 * (r[0][0] + r[0][1]) % MOD) % MOD;
    m1[qry[i].dl][qry[i].dr] = 0, mat[qry[i].id] = m1;
    change(qry[i].id, qry[i].id, 1);
  }
  printf("%d\n", res);
}