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 MOD = 998244353;
int add(int a, int b) { return (a + b) % MOD; }
void plu(int &a, int b) { a = add(a, b); }
int sub(int a, int b) { return (a - b + MOD) % MOD; }
int mul(int a, int b) { return (long long)a * b % MOD; }
int mul(int a, int b, int c) { return mul(mul(a, b), c); }
int sqr(int x) { return mul(x, x); }
int ksm(int a, int b) {
  return b == 0 ? 1 : mul(sqr(ksm(a, b >> 1)), b & 1 ? a : 1);
}
int inv(int a) { return ksm(a, MOD - 2); }
const int N = 100100;
int n;
int x[N], v[N], p[N][2];
struct X {
  int v[2][2];
};
struct SegTree {
  X val[4 * N];
  void upd(int id, int mid) {
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++) {
        val[id].v[i][j] = 0;
      }
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        for (int k = 0; k < 2; k++) {
          plu(val[id].v[i][j], mul(val[id << 1].v[i][k],
                                   val[(id << 1) | 1].v[k][j], p[mid + 1][k]));
        }
  }
  void build(int l, int r, int id) {
    if (l == r) {
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < 2; j++) {
          val[id].v[i][j] = 1;
        }
      return;
    }
    int mid = (l + r) >> 1;
    build(l, mid, id << 1);
    build(mid + 1, r, (id << 1) | 1);
    upd(id, mid);
  }
  void set(int x, const X &v, int l, int r, int id) {
    if (l == r) {
      val[id] = v;
      return;
    }
    int mid = (l + r) >> 1;
    if (x <= mid) {
      set(x, v, l, mid, id << 1);
    } else {
      set(x, v, mid + 1, r, (id << 1) | 1);
    }
    upd(id, mid);
  }
  const X &get(int x, int l, int r, int id) {
    if (l == r) {
      return val[id];
    }
    int mid = (l + r) >> 1;
    if (x <= mid) {
      return get(x, l, mid, id << 1);
    } else {
      return get(x, mid + 1, r, (id << 1) | 1);
    }
  }
  int query() {
    int ans = 0;
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++) {
        plu(ans, mul(p[1][i], val[1].v[i][j], p[n][j]));
      }
    return ans;
  }
};
const int INV2 = inv(2);
const int INV100 = inv(100);
struct E {
  int id, i, j, ta, tb;
  bool operator<(const E o) const {
    return (long long)ta * o.tb < (long long)o.ta * tb;
  }
};
vector<E> evs;
SegTree t;
void ae(int x, int i, int j) {
  int y = x + 1;
  int dv = i != j ? v[x] + v[y] : abs(v[x] - v[y]);
  int s = ::x[y] - ::x[x];
  evs.push_back({x, i, j, s, dv});
}
int main() {
  scanf("%d", &n);
  if (n == 1) {
    puts("0");
    exit(0);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x[i], &v[i], &p[i][1]);
    p[i][0] = 100 - p[i][1];
  }
  t.build(1, n - 1, 1);
  for (int i = 1; i <= n - 1; i++) {
    ae(i, 1, 0);
    if (v[i] < v[i + 1]) {
      ae(i, 0, 0);
    }
    if (v[i] > v[i + 1]) {
      ae(i, 1, 1);
    }
  }
  sort(evs.begin(), evs.end());
  int ans = 0;
  for (vector<E>::iterator it = evs.begin(); it != evs.end(); it++) {
    int dt = mul(it->ta % MOD, inv(it->tb % MOD));
    X tmp1;
    tmp1 = t.get(it->id, 1, n - 1, 1);
    X tmp2;
    memset(&tmp2, 0, sizeof(tmp2));
    swap(tmp2.v[it->i][it->j], tmp1.v[it->i][it->j]);
    t.set(it->id, tmp2, 1, n - 1, 1);
    int cb = mul(t.query(), dt);
    plu(ans, cb);
    t.set(it->id, tmp1, 1, n - 1, 1);
  }
  ans = mul(ans, ksm(INV100, n));
  printf("%d\n", ans);
  return 0;
}