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 = 4e5 + 7, p = 998244353;
int n, k, x[N], v[N], w[N], pos[N];
struct node {
  int l, w;
} e[N << 1];
struct matrix {
  int ch[2][2];
} f, g, op[N << 2];
inline matrix operator*(matrix a, matrix b) {
  matrix c = g;
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= 1; j++)
      for (int k = 0; k <= 1; k++)
        c.ch[i][k] = (c.ch[i][k] + 1ll * a.ch[i][j] * b.ch[j][k]) % p;
  return c;
}
inline long long pows(long long u, int v) {
  long long ans = 1;
  while (v > 0) {
    if (v & 1) ans = ans * u % p;
    u = u * u % p, v = v >> 1;
  }
  return ans;
}
inline int getit(node u) {
  if (u.l == 3) return v[u.w] + v[u.w + 1];
  return abs(v[u.w] - v[u.w + 1]);
}
inline bool cmp(node a, node b) {
  int xa = x[a.w + 1] - x[a.w], ya = getit(a), xb = x[b.w + 1] - x[b.w],
      yb = getit(b);
  return 1ll * xa * yb < 1ll * xb * ya;
}
inline void build(int l, int r, int t) {
  if (l == r) {
    pos[l] = t;
    op[t].ch[0][0] = (1 - w[l]);
    op[t].ch[0][1] = w[l];
    op[t].ch[1][0] = (1 - w[l]);
    op[t].ch[1][1] = w[l];
    return;
  }
  int d = (l + r) >> 1;
  build(l, d, t << 1), build(d + 1, r, t << 1 | 1),
      op[t] = op[t << 1] * op[t << 1 | 1];
}
inline void update(int t) {
  while (t > 0) t = t >> 1, op[t] = op[t << 1] * op[t << 1 | 1];
}
inline int read() {
  int num = 0;
  char g = getchar(), t = '+';
  while (g < 48 || 57 < g) t = g, g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  if (t == '-') return -num;
  return num;
}
int main() {
  cin >> n, w[0] = 1;
  for (int i = 1; i <= n; i++)
    x[i] = read(), v[i] = read(), w[i] = read() * pows(100, p - 2) % p;
  for (int i = 1; i < n; i++) k++, e[k].l = 3, e[k].w = i;
  for (int i = 1; i < n; i++)
    if (v[i] < v[i + 1])
      k++, e[k].l = 1, e[k].w = i;
    else if (v[i] > v[i + 1])
      k++, e[k].l = 2, e[k].w = i;
  sort(e + 1, e + k + 1, cmp), build(1, n, 1);
  long long sum = 0;
  for (int i = 1; i <= k; i++) {
    matrix c = op[pos[e[i].w + 1]];
    int opt = 0;
    op[pos[e[i].w + 1]] = g;
    long long val = (x[e[i].w + 1] - x[e[i].w]) * pows(getit(e[i]), p - 2) % p;
    if (e[i].l == 1) {
      op[pos[e[i].w + 1]].ch[0][0] = 1 - w[e[i].w + 1], update(pos[e[i].w + 1]),
                      f = op[1];
      opt = (f.ch[0][0] + f.ch[0][1]) % p, op[pos[e[i].w + 1]] = c;
      op[pos[e[i].w + 1]].ch[0][0] = 0;
    }
    if (e[i].l == 2) {
      op[pos[e[i].w + 1]].ch[1][1] = w[e[i].w + 1], update(pos[e[i].w + 1]),
                      f = op[1];
      opt = (f.ch[0][0] + f.ch[0][1]) % p, op[pos[e[i].w + 1]] = c;
      op[pos[e[i].w + 1]].ch[1][1] = 0;
    }
    if (e[i].l == 3) {
      op[pos[e[i].w + 1]].ch[1][0] = 1 - w[e[i].w + 1], update(pos[e[i].w + 1]),
                      f = op[1];
      opt = (f.ch[0][0] + f.ch[0][1]) % p, op[pos[e[i].w + 1]] = c;
      op[pos[e[i].w + 1]].ch[1][0] = 0;
    }
    sum = (sum + val * opt) % p, update(pos[e[i].w + 1]);
  }
  cout << (sum + p) % p << endl;
}