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 MAX_N = 1e5 + 10;
const long long MOD = 998244353;
long long sq(long long x) { return x * x % MOD; }
long long qpow(long long a, long long b) {
  return b ? sq(qpow(a, b / 2)) * (b & 1 ? a : 1) % MOD : 1;
}
long long inv(long long x) { return qpow(x, MOD - 2); }
struct Matrix {
  long long v[2][2];
  int n, m;
  Matrix(int n, int m) : n(n), m(m) { memset(v, 0, sizeof(v)); }
};
Matrix unit_matrix(int n) {
  Matrix res(n, n);
  for (int i = 0; i < n; i++) res.v[i][i] = 1;
  return res;
}
Matrix operator+(const Matrix &lhs, const Matrix &rhs) {
  Matrix res(lhs.n, lhs.m);
  for (int i = 0; i < lhs.n; i++)
    for (int j = 0; j < lhs.m; j++)
      res.v[i][j] = (lhs.v[i][j] + rhs.v[i][j]) % MOD;
  return res;
}
Matrix operator*(const Matrix &lhs, const Matrix &rhs) {
  Matrix res(lhs.n, rhs.m);
  for (int i = 0; i < lhs.n; i++) {
    for (int j = 0; j < rhs.m; j++) {
      for (int k = 0; k < lhs.m; k++) {
        (res.v[i][j] += lhs.v[i][k] * rhs.v[k][j]) %= MOD;
      }
    }
  }
  return res;
}
int N, X[MAX_N], V[MAX_N], P[MAX_N];
bool banned[MAX_N][2][2];
Matrix trans(int x) {
  Matrix res(2, 2);
  res.v[0][0] = res.v[1][0] = (1 + MOD - P[x]) % MOD;
  res.v[0][1] = res.v[1][1] = P[x];
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (banned[x][i][j]) res.v[i][j] = 0;
  return res;
}
struct SegTree {
  int l, r, m;
  SegTree *cl, *cr;
  Matrix v;
  SegTree(int l, int r)
      : l(l), r(r), m((l + r) / 2), cl(nullptr), cr(nullptr), v(2, 2) {
    if (l != r) {
      cl = new SegTree(l, m);
      cr = new SegTree(m + 1, r);
      v = cl->v * cr->v;
    } else {
      v = trans(l);
    }
  }
  Matrix query() { return v; }
  void modify(int x, Matrix mv) {
    if (l == r) {
      v = mv;
    } else {
      if (x <= m)
        cl->modify(x, mv);
      else
        cr->modify(x, mv);
      v = cl->v * cr->v;
    }
  }
} * segt;
struct Event {
  int x, d0, d1;
  long long frac_x, frac_y;
  Event(int x, int d0, int d1, long long frac_x, long long frac_y)
      : x(x), d0(d0), d1(d1), frac_x(frac_x), frac_y(frac_y) {}
};
bool operator<(const Event &lhs, const Event &rhs) {
  return lhs.frac_x * rhs.frac_y < rhs.frac_x * lhs.frac_y;
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d%d%d", &X[i], &V[i], &P[i]);
    P[i] = P[i] * inv(100) % MOD;
  }
  segt = new SegTree(1, N);
  vector<Event> events;
  for (int i = 2; i <= N; i++) {
    events.emplace_back(i - 1, 1, 0, X[i] - X[i - 1], V[i - 1] + V[i]);
    if (V[i - 1] > V[i]) {
      events.emplace_back(i - 1, 1, 1, X[i] - X[i - 1], V[i - 1] - V[i]);
    }
    if (V[i - 1] < V[i]) {
      events.emplace_back(i - 1, 0, 0, X[i] - X[i - 1], V[i] - V[i - 1]);
    }
  }
  sort(events.begin(), events.end());
  long long ans = 0;
  for (auto e : events) {
    Matrix t = trans(e.x + 1);
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        if (i != e.d0 || j != e.d1) t.v[i][j] = 0;
      }
    }
    segt->modify(e.x + 1, t);
    Matrix a(1, 2);
    a.v[0][0] = 1;
    Matrix b = segt->query();
    Matrix c = a * b;
    long long p = (c.v[0][0] + c.v[0][1]) % MOD;
    (ans += p * e.frac_x % MOD * inv(e.frac_y)) %= MOD;
    banned[e.x + 1][e.d0][e.d1] = true;
    segt->modify(e.x + 1, trans(e.x + 1));
  }
  printf("%lld\n", ans);
}