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 p = 998244353;
template <typename T>
inline T read() {
  register T sum = 0;
  register char cc = getchar();
  int sym = 1;
  while (cc != '-' && (cc > '9' || cc < '0')) cc = getchar();
  if (cc == '-') sym = -1, cc = getchar();
  sum = sum * 10 + cc - '0';
  cc = getchar();
  while (cc >= '0' && cc <= '9') sum = sum * 10 + cc - '0', cc = getchar();
  return sym * sum;
}
template <typename T>
inline T read(T &a) {
  a = read<T>();
  return a;
}
template <typename T, typename... Others>
inline void read(T &a, Others &...b) {
  a = read(a);
  read(b...);
}
int add(int x, int y) {
  x += y;
  return x >= p ? x - p : x;
}
int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + p : x;
}
void Add(int &x, int y) {
  x += y;
  if (x >= p) x -= p;
}
int mul(int x, int y) { return 1ll * x * y % p; }
int fpow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = mul(res, x);
    x = mul(x, x);
    y >>= 1;
  }
  return res;
}
struct Data {
  int s, v, p, a, b;
  bool operator<(const Data &o) const { return 1ll * s * o.v < 1ll * o.s * v; }
} Q[100010 << 2];
struct Matrix {
  int v[2][2];
  Matrix(int a = 0, int b = 0, int c = 0, int d = 0) {
    v[0][0] = a;
    v[0][1] = b;
    v[1][0] = c;
    v[1][1] = d;
  }
  Matrix operator*(const Matrix &o) const {
    Matrix res;
    for (int i : {0, 1})
      for (int j : {0, 1}) {
        res.v[i][j] = 0;
        for (int k : {0, 1}) Add(res.v[i][j], mul(v[i][k], o.v[k][j]));
      }
    return res;
  }
} M[100010], val[100010 << 2];
int n, ans, cnt, x[100010], v[100010], P[100010][2];
void build(int k, int l, int r) {
  if (l == r) {
    val[k] = M[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  val[k] = val[k << 1] * val[k << 1 | 1];
}
void change(int k, int l, int r, int x) {
  if (l == r) {
    val[k] = M[l];
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    change(k << 1, l, mid, x);
  else
    change(k << 1 | 1, mid + 1, r, x);
  val[k] = val[k << 1] * val[k << 1 | 1];
}
int Speed(int i, int a, int b) {
  if (a == 1 && b == 0) return v[i] + v[i + 1];
  if (a == 1 && b == 1) return v[i] - v[i + 1];
  if (a == 0 && b == 0) return v[i + 1] - v[i];
  return -1;
}
int main() {
  read(n);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    read(x[i], v[i], P[i][1]);
    P[i][1] = mul(P[i][1], fpow(100, p - 2));
    P[i][0] = sub(1, P[i][1]);
  }
  for (int i = 1; i < n; i++)
    for (int j : {0, 1})
      for (int k : {0, 1})
        if (Speed(i, j, k) > 0) {
          cnt += 1;
          Q[cnt] = {x[i + 1] - x[i], Speed(i, j, k), i, j, k};
        }
  for (int i = 0; i < n; i++)
    M[i] = Matrix(P[i + 1][0], P[i + 1][1], P[i + 1][0], P[i + 1][1]);
  build(1, 1, n - 1);
  sort(Q + 1, Q + 1 + cnt);
  for (int i = 1; i <= cnt; i++) {
    Matrix m1 = M[Q[i].p], m2;
    m2.v[Q[i].a][Q[i].b] = P[Q[i].p + 1][Q[i].b];
    M[Q[i].p] = m2;
    change(1, 1, n - 1, Q[i].p);
    Matrix m3 = M[0] * val[1];
    int P = add(m3.v[0][0], m3.v[0][1]);
    Add(ans, mul(P, mul(Q[i].s, fpow(Q[i].v, p - 2))));
    m1.v[Q[i].a][Q[i].b] = 0;
    M[Q[i].p] = m1;
    change(1, 1, n - 1, Q[i].p);
  }
  printf("%d\n", ans);
  return 0;
}