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 = 100000;
const int MOD = 998244353;
inline int add(int x, int y) { return (x + y >= MOD ? x + y - MOD : x + y); }
inline int sub(int x, int y) { return (x - y < 0 ? x - y + MOD : x - y); }
inline int mul(int x, int y) { return 1LL * x * y % MOD; }
int pow_mod(int b, int p) {
  int ret = 1;
  for (int i = p; i; i >>= 1, b = mul(b, b))
    if (i & 1) ret = mul(ret, b);
  return ret;
}
const int INV100 = pow_mod(100, MOD - 2);
struct matrix {
  int m[2][2];
  matrix() { m[0][0] = m[0][1] = m[1][0] = m[1][1] = 0; }
  friend matrix operator*(matrix A, matrix B) {
    matrix C;
    C.m[0][0] = add(mul(A.m[0][0], B.m[0][0]), mul(A.m[0][1], B.m[1][0]));
    C.m[0][1] = add(mul(A.m[0][0], B.m[0][1]), mul(A.m[0][1], B.m[1][1]));
    C.m[1][0] = add(mul(A.m[1][0], B.m[0][0]), mul(A.m[1][1], B.m[1][0]));
    C.m[1][1] = add(mul(A.m[1][0], B.m[0][1]), mul(A.m[1][1], B.m[1][1]));
    return C;
  }
};
matrix M[MAXN + 5];
int p[MAXN + 5];
matrix get(int i, int type) {
  if (type == 1)
    M[i].m[0][1] = 0;
  else if (type == 2)
    M[i].m[0][0] = M[i].m[0][1] = 0;
  else if (type == 3)
    M[i].m[1][0] = M[i].m[1][1] = 0;
  return M[i];
}
struct segtree {
  int le[4 * MAXN + 5], ri[4 * MAXN + 5];
  matrix s[4 * MAXN + 5];
  void pushup(int x) { s[x] = s[(x << 1 | 1)] * s[(x << 1)]; }
  void build(int x, int l, int r) {
    le[x] = l, ri[x] = r;
    if (l == r) {
      s[x] = get(l, 0);
      return;
    }
    int m = (l + r) >> 1;
    build((x << 1), l, m), build((x << 1 | 1), m + 1, r);
    pushup(x);
  }
  void modify(int x, int p, matrix k) {
    if (le[x] == ri[x]) {
      s[x] = k;
      return;
    }
    int m = (le[x] + ri[x]) >> 1;
    modify(p <= m ? (x << 1) : (x << 1 | 1), p, k);
    pushup(x);
  }
} T;
struct node {
  int x, v, i, type;
  node() {}
  node(int _x, int _v, int _i, int _t) : x(_x), v(_v), i(_i), type(_t) {}
  friend bool operator<(node a, node b) {
    return 1LL * a.x * b.v < 1LL * b.x * a.v;
  }
} a[2 * MAXN + 5];
int x[MAXN + 5], v[MAXN + 5];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x[i], &v[i], &p[i]), p[i] = mul(p[i], INV100);
    M[i].m[0][0] = M[i].m[0][1] = sub(1, p[i]);
    M[i].m[1][0] = M[i].m[1][1] = p[i];
  }
  T.build(1, 1, n);
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    a[++cnt] = node(x[i + 1] - x[i], v[i + 1] + v[i], i + 1, 1);
    if (v[i + 1] > v[i])
      a[++cnt] = node(x[i + 1] - x[i], v[i + 1] - v[i], i + 1, 2);
    if (v[i + 1] < v[i])
      a[++cnt] = node(x[i + 1] - x[i], v[i] - v[i + 1], i, 3);
  }
  sort(a + 1, a + cnt + 1);
  int ans = 0, pro = 0;
  for (int i = 1; i <= cnt; i++) {
    T.modify(1, a[i].i, get(a[i].i, a[i].type));
    int t = mul(a[i].x, pow_mod(a[i].v, MOD - 2));
    int p = sub(sub(1, add(T.s[1].m[0][0], T.s[1].m[1][0])), pro);
    ans = add(ans, mul(p, t));
    pro = sub(1, add(T.s[1].m[0][0], T.s[1].m[1][0]));
  }
  printf("%d\n", ans);
}