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, P = 998244353;
int add(int x, int y) {
  x += y;
  return x >= P ? x - P : x;
}
int fpw(int x, int y) {
  int s = 1;
  for (; y; y >>= 1, x = (long long)x * x % P)
    if (y & 1) s = (long long)s * x % P;
  return s;
}
int inv100 = fpw(100, P - 2);
struct matrix {
  int a[2][2];
  int* operator[](int i) { return a[i]; }
};
matrix operator*(matrix A, matrix B) {
  matrix C;
  C[0][0] = ((long long)A[0][0] * B[0][0] + (long long)A[0][1] * B[1][0]) % P;
  C[0][1] = ((long long)A[0][0] * B[0][1] + (long long)A[0][1] * B[1][1]) % P;
  C[1][0] = ((long long)A[1][0] * B[0][0] + (long long)A[1][1] * B[1][0]) % P;
  C[1][1] = ((long long)A[1][0] * B[0][1] + (long long)A[1][1] * B[1][1]) % P;
  return C;
}
struct node {
  int l, r;
  matrix A;
} tr[N * 4];
matrix M[N];
void up(int u) { tr[u].A = tr[u << 1].A * tr[u << 1 | 1].A; }
void build(int u, int l, int r) {
  tr[u].l = l, tr[u].r = r;
  if (l == r) {
    tr[u].A = M[l];
    return;
  }
  int m = l + r >> 1;
  build(u << 1, l, m), build(u << 1 | 1, m + 1, r), up(u);
}
void update(int u, int x) {
  if (tr[u].r < x || x < tr[u].l) return;
  if (tr[u].l == tr[u].r) {
    tr[u].A = M[x];
    return;
  }
  update(u << 1, x), update(u << 1 | 1, x), up(u);
}
struct data {
  int u, v, p, x, y;
} a[N * 2];
bool cmp(data a, data b) { return (long long)a.u * b.v < (long long)b.u * a.v; }
int x[N], v[N], p[N];
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int main() {
  int n = read(), m = 0;
  for (int i = 1; i <= n; ++i) x[i] = read(), v[i] = read(), p[i] = read();
  for (int i = 1; i <= n - 1; ++i) {
    int d = x[i + 1] - x[i];
    a[++m] = (data){d, v[i] + v[i + 1], i + 1, 1, 0};
    if (v[i] != v[i + 1])
      a[++m] = (data){d, abs(v[i] - v[i + 1]), i + 1, v[i] > v[i + 1],
                      v[i] > v[i + 1]};
  }
  sort(a + 1, a + 1 + m, cmp);
  for (int i = 1; i <= n; ++i) {
    int t = (long long)p[i] * inv100 % P;
    M[i][0][1] = M[i][1][1] = t, M[i][0][0] = M[i][1][0] = P + 1 - t;
  }
  build(1, 1, n);
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    int t = a[i].p;
    matrix tm = M[t];
    M[t][0][0] = M[t][0][1] = M[t][1][0] = M[t][1][1] = 0;
    int tmp = (long long)p[t] * inv100 % P;
    M[t][a[i].x][a[i].y] = a[i].y == 1 ? tmp : P + 1 - tmp;
    update(1, t);
    int p = add(tr[1].A[0][0], tr[1].A[0][1]);
    ans = (ans + (long long)p * a[i].u % P * fpw(a[i].v, P - 2)) % P;
    M[t] = tm, M[t][a[i].x][a[i].y] = 0, update(1, t);
  }
  printf("%d\n", ans);
  return 0;
}