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 long long mod = 998244353;
const long long INF = (1e+18) + 7;
const long double eps = 1e-6;
const long double pi = acos(-1.0);
using mat = pair<pair<long long, long long>, pair<long long, long long>>;
void debug(vector<int> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
void debug(mat &m) {
  cout << m.first.first << " " << m.first.second << endl;
  cout << m.second.first << " " << m.second.second << endl;
}
long long mod_pow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
struct SegT {
 private:
  int sz;
  vector<mat> node;
  const mat init_c = {{1, 0}, {0, 1}};

 public:
  SegT(int n) {
    sz = 1;
    while (sz < n) sz *= 2;
    node.resize(2 * sz - 1, init_c);
  }
  SegT(vector<mat> v) {
    int n = v.size();
    sz = 1;
    while (sz < n) sz *= 2;
    node.resize(2 * sz - 1, init_c);
    for (int i = 0; i < n; i++) node[i + sz - 1] = v[i];
    for (int i = sz - 1 - 1; i >= 0; i--)
      node[i] = f(node[2 * i + 1], node[2 * i + 2]);
  }
  mat f(mat a, mat b) {
    mat res;
    res.first.first =
        (b.first.first * a.first.first + b.first.second * a.second.first) % mod;
    res.first.second =
        (b.first.first * a.first.second + b.first.second * a.second.second) %
        mod;
    res.second.first =
        (b.second.first * a.first.first + b.second.second * a.second.first) %
        mod;
    res.second.second =
        (b.second.first * a.first.second + b.second.second * a.second.second) %
        mod;
    return res;
  }
  void update(int k, int id) {
    k += sz - 1;
    if (id == 0)
      node[k].first.first = 0;
    else if (id == 3)
      node[k].second.second = 0;
    else if (id == 1)
      node[k].second.first = 0;
    while (k > 0) {
      k = (k - 1) / 2;
      node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }
  mat query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = sz;
    if (r <= a || b <= l)
      return init_c;
    else if (a <= l && r <= b)
      return node[k];
    else {
      mat vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      mat vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      mat res = f(vl, vr);
      return f(vl, vr);
    }
  }
};
long long inv100 = mod_pow(100, mod - 2);
bool comp(pair<pair<long long, long long>, pair<int, int>> a,
          pair<pair<long long, long long>, pair<int, int>> b) {
  pair<long long, long long> la = a.first, lb = b.first;
  if (la.first * lb.second != la.second * lb.first) {
    return la.first * lb.second < la.second * lb.first;
  } else
    return a.second < b.second;
}
void solve() {
  int n;
  cin >> n;
  vector<long long> x(n), v(n), p(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> v[i] >> p[i];
  }
  vector<pair<pair<long long, long long>, pair<int, int>>> al;
  for (int i = 0; i < n - 1; i++) {
    if (v[i] > v[i + 1]) {
      pair<long long, long long> z = {x[i + 1] - x[i], v[i] - v[i + 1]};
      al.push_back({z, {i, 0}});
    } else if (v[i] < v[i + 1]) {
      pair<long long, long long> z = {x[i + 1] - x[i], v[i + 1] - v[i]};
      al.push_back({z, {i, 3}});
    }
    pair<long long, long long> z = {x[i + 1] - x[i], v[i + 1] + v[i]};
    al.push_back({z, {i, 1}});
  }
  vector<mat> ori;
  for (int i = 1; i <= n - 1; i++) {
    long long x1 = p[i] * inv100 % mod;
    long long x2 = (100 - p[i]) * inv100 % mod;
    mat x = {{x1, x1}, {x2, x2}};
    ori.push_back(x);
  }
  pair<long long, long long> p0 = {p[0] * inv100 % mod,
                                   (100 - p[0]) * inv100 % mod};
  SegT st(ori);
  sort(al.begin(), al.end(), comp);
  long long ans = 0;
  for (int i = 0; i < al.size(); i++) {
    int id = al[i].second.first;
    int t = al[i].second.second;
    mat le = st.query(0, id);
    long long cl = 0;
    if (t == 0 || t == 1) {
      cl = le.first.first * p0.first + le.first.second * p0.second;
      cl %= mod;
    } else {
      cl = le.second.first * p0.first + le.second.second * p0.second;
      cl %= mod;
    }
    pair<long long, long long> p1 = {p[id + 1] * inv100 % mod,
                                     (100 - p[id + 1]) * inv100 % mod};
    mat ri = st.query(id + 1, n - 1);
    long long cr = 0;
    if (t == 0) {
      cr = ri.first.first * p1.first + ri.second.first * p1.first;
      cr %= mod;
    } else {
      cr = ri.first.second * p1.second + ri.second.second * p1.second;
      cr %= mod;
    }
    long long csum = cl * cr % mod;
    long long val =
        al[i].first.first * mod_pow(al[i].first.second, mod - 2) % mod;
    csum = csum * val % mod;
    ans += csum;
    st.update(id, t);
  }
  ans %= mod;
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}