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;
template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}
const int N = 1e5 + 7;
const int MAX = 1 << 17;
const int M = 998244353;
long long fast(long long a, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = r * a % M;
    a = a * a % M;
    n /= 2;
  }
  return r;
}
long long inv(long long a) { return fast(a, M - 2); }
long long rev(long long x) { return (1 + M - x >= M ? 1 - x : 1 + M - x); }
struct node {
  long long T[2][2], l, r;
  node() { T[0][0] = T[0][1] = T[1][0] = T[1][1] = 0; }
  long long get() {
    return ((long long)T[0][0] + T[0][1] + T[1][0] + T[1][1]) % M;
  }
};
int n;
long long X[N], V[N], P[N], invP[N][2];
node merge(const node &a, const node &b) {
  node r;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++)
        r.T[i][j] = (r.T[i][j] + a.T[i][k] * b.T[k][j] % M * invP[a.r][k]);
  r.T[0][0] %= M;
  r.T[0][1] %= M;
  r.T[1][0] %= M;
  r.T[1][1] %= M;
  r.l = a.l;
  r.r = b.r;
  return r;
}
void merge(const node &a, const node &b, node &r) {
  r.T[0][0] = r.T[0][1] = r.T[1][0] = r.T[1][1] = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++)
        r.T[i][j] = (r.T[i][j] + a.T[i][k] * b.T[k][j] % M * invP[a.r][k]);
  r.T[0][0] %= M;
  r.T[0][1] %= M;
  r.T[1][0] %= M;
  r.T[1][1] %= M;
  r.l = a.l;
  r.r = b.r;
}
node tree[2 * MAX];
void update(int e, long long v, int a, int b) {
  e += MAX;
  tree[e].T[a][b] = v;
  for (int i = e / 2; i >= 1; i /= 2)
    merge(tree[2 * i], tree[2 * i + 1], tree[i]);
}
node query(int a, int b) {
  a += MAX, b += MAX;
  if (a == b) return tree[a];
  node l = tree[a], r = tree[b];
  while (a / 2 != b / 2) {
    if (a % 2 == 0) l = merge(l, tree[a + 1]);
    if (b % 2 == 1) r = merge(tree[b - 1], r);
    a /= 2, b /= 2;
  }
  return merge(l, r);
}
struct event {
  long long d, t, p;
  int a, b, i;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n == 1) {
    cout << 0 << "\n";
    return 0;
  }
  long long inv100 = inv(100);
  for (int i = 1; i <= n; i++) {
    cin >> X[i] >> V[i] >> P[i];
    P[i] = P[i] * inv100 % M;
    invP[i][1] = inv(P[i]);
    invP[i][0] = inv(rev(P[i]));
  }
  n--;
  vector<event> events;
  for (int i = 1; i <= n; i++) {
    tree[i + MAX].l = i;
    tree[i + MAX].r = i + 1;
    tree[i + MAX].T[0][0] = rev(P[i]) * rev(P[i + 1]) % M;
    tree[i + MAX].T[0][1] = rev(P[i]) * P[i + 1] % M;
    tree[i + MAX].T[1][0] = P[i] * rev(P[i + 1]) % M;
    update(i, P[i] * P[i + 1] % M, 1, 1);
    events.push_back(
        {X[i + 1] - X[i], V[i + 1] + V[i], P[i] * rev(P[i + 1]) % M, 1, 0, i});
    if (V[i] > V[i + 1])
      events.push_back(
          {X[i + 1] - X[i], V[i] - V[i + 1], P[i] * P[i + 1] % M, 1, 1, i});
    if (V[i] < V[i + 1])
      events.push_back({X[i + 1] - X[i], V[i + 1] - V[i],
                        rev(P[i]) * rev(P[i + 1]) % M, 0, 0, i});
  }
  sort((events).begin(), (events).end(), [](const event &e1, const event &e2) {
    return e1.d * e2.t < e2.d * e1.t;
  });
  long long ans = 0, last = 1;
  for (auto e : events) {
    update(e.i, 0, e.a, e.b);
    node r = query(1, n);
    long long p = r.get();
    ans = (ans + (last - p) * e.d % M * inv(e.t) % M) % M;
    last = p;
  }
  cout << (ans + M) % M << "\n";
  return 0;
}