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 = 110000;
const int P = 998244353;
const int INV100 = 828542813;
void exgcd(int a, int b, int& x, int& y) {
  if (b == 0)
    x = 1, y = 0;
  else
    exgcd(b, a % b, y, x), y -= a / b * x;
}
inline int inv(int a) {
  int x, y;
  exgcd(a, P, x, y);
  return (x % P + P) % P;
}
struct Matrix {
  int n, m, a[3][3];
  Matrix() {}
  Matrix(int r, int c) : n(r), m(c) { memset(a, 0, sizeof a); }
  Matrix operator*(const Matrix& b) const {
    Matrix c(n, b.m);
    for (int i = 0; i < n; i++)
      for (int k = 0; k < m; k++)
        for (int j = 0; j < b.m; j++)
          c.a[i][j] = (c.a[i][j] + 1ll * a[i][k] * b.a[k][j]) % P;
    return c;
  }
} w[MAXN];
struct SegmenTree {
  struct Node {
    int l, r;
    Matrix val;
  } tr[4 * MAXN];
  void pushup(int o) { tr[o].val = tr[(o << 1)].val * tr[(o << 1 | 1)].val; }
  void build(int o, int l, int r) {
    tr[o].l = l;
    tr[o].r = r;
    if (l == r) {
      tr[o].val = w[l];
      return;
    }
    int mid = l + r >> 1;
    build((o << 1), l, mid);
    build((o << 1 | 1), mid + 1, r);
    pushup(o);
  }
  void update(int o, int p) {
    if (tr[o].l == tr[o].r) {
      tr[o].val = w[p];
      return;
    }
    int mid = tr[o].l + tr[o].r >> 1;
    if (p <= mid)
      update((o << 1), p);
    else
      update((o << 1 | 1), p);
    pushup(o);
  }
} st;
struct Pipe {
  int x, v, p;
  Pipe() {}
  Pipe(int a, int b, int c) : x(a), v(b), p(c) {}
} a[MAXN];
struct Movement {
  int id, d0, d1;
  Movement() {}
  Movement(int a, int b, int c) : id(a), d0(b), d1(c) {}
  bool operator<(const Movement& rhs) const {
    return 1ll * (a[id].x - a[id - 1].x) *
               (rhs.d0 * a[rhs.id - 1].v - rhs.d1 * a[rhs.id].v) <
           1ll * (a[rhs.id].x - a[rhs.id - 1].x) *
               (d0 * a[id - 1].v - d1 * a[id].v);
  }
  void set(bool k) {
    if (d0 == 1)
      if (d1 == 1)
        w[id].a[0][0] = k * a[id].p;
      else
        w[id].a[0][1] = k * (1 - a[id].p + P) % P;
    else if (d1 == 1)
      w[id].a[1][0] = k * a[id].p;
    else
      w[id].a[1][1] = k * (1 - a[id].p + P) % P;
  }
  int meettime() {
    return 1ll * (a[id].x - a[id - 1].x) *
           inv(d0 * a[id - 1].v - d1 * a[id].v) % P;
  }
} b[4 * MAXN];
int main() {
  int n, m = 0;
  scanf("%d", &n);
  a[0] = Pipe(-(1E9 + 233), 1E6 + 233, 0);
  for (int i = 1; i <= n; i++) {
    int x, v, p;
    scanf("%d%d%d", &x, &v, &p);
    a[i] = Pipe(x, v, 1ll * p * INV100 % P);
    b[++m] = Movement(i, 1, -1);
    if (a[i].v < a[i - 1].v)
      b[++m] = Movement(i, 1, 1);
    else if (a[i].v > a[i - 1].v)
      b[++m] = Movement(i, -1, -1);
  }
  for (int i = 1; i <= n; i++) {
    w[i] = Matrix(2, 2);
    w[i].a[0][0] = w[i].a[1][0] = a[i].p;
    w[i].a[0][1] = w[i].a[1][1] = (1 - a[i].p + P) % P;
  }
  st.build(1, 1, n);
  sort(b + 1, b + m + 1);
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    Matrix t = w[b[i].id];
    w[b[i].id] = Matrix(2, 2);
    b[i].set(1);
    st.update(1, b[i].id);
    ans = (ans + 1ll * b[i].meettime() *
                     (st.tr[1].val.a[1][0] + st.tr[1].val.a[1][1])) %
          P;
    w[b[i].id] = t;
    b[i].set(0);
    st.update(1, b[i].id);
  }
  printf("%d\n", ans);
  return 0;
}