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;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;
const LL MOD = 998244353;
inline LL mul(LL a, LL b) { return a * b % MOD; }
inline LL add(LL a, LL b) { return (a + b) % MOD; }
LL modpow(LL a, LL n) {
  LL res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = mul(res, a);
    a = mul(a, a);
  }
  return res;
}
inline LL modinv(LL a) { return modpow(a, MOD - 2); }
struct Matrix {
  LL v[2][2];
  Matrix(int d = 0) {
    memset(v, 0, sizeof v);
    if (d) v[0][0] = v[1][1] = d;
  }
  Matrix operator+(const Matrix& m) const {
    Matrix res;
    for (int i : {0, 1}) {
      for (int j : {0, 1}) {
        res.v[i][j] = add(v[i][j], m.v[i][j]);
      }
    }
    return res;
  }
  Matrix operator*(const Matrix& m) const {
    Matrix res;
    for (int i : {0, 1}) {
      for (int j : {0, 1}) {
        for (int k : {0, 1}) {
          res.v[i][j] += mul(v[i][k], m.v[k][j]);
        }
        res.v[i][j] %= MOD;
      }
    }
    return res;
  }
  LL sum_all() const {
    LL res = 0;
    for (int i : {0, 1}) {
      for (int j : {0, 1}) {
        res += v[i][j];
      }
    }
    return res % MOD;
  }
};
Matrix ID(1);
struct SegmentTree {
  int sz;
  vector<Matrix> tree;
  void merge(int node) { tree[node] = tree[2 * node + 1] * tree[2 * node]; }
  SegmentTree(int n) {
    for (sz = 1; sz < n; sz <<= 1)
      ;
    tree.resize(2 * sz);
  }
  void update(int i, int x, int y, LL val) {
    int node = sz + i;
    tree[node].v[x][y] = val;
    for (node /= 2; node >= 1; node /= 2) {
      merge(node);
    }
  }
  Matrix query(int l, int r, int node = 1, int x = 0, int y = -1) {
    if (y == -1) y = sz;
    if (l >= y || r <= x) return ID;
    if (l <= x && y <= r) return tree[node];
    return query(l, r, 2 * node + 1, (x + y) / 2, y) *
           query(l, r, 2 * node, x, (x + y) / 2);
  }
};
using Frac = pair<LL, LL>;
using Event = pair<Frac, int>;
bool cmpFrac(const Frac& a, const Frac& b) {
  return a.first * b.second < b.first * a.second;
}
struct Info {
  int i, righti, rightii;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<LL> x(n + 1), v(n + 1), lt(n + 1), rt(n + 1);
  const LL inv100 = modinv(100);
  for (int i = 1; i <= n; i++) {
    LL p;
    cin >> x[i] >> v[i] >> p;
    p = mul(p, inv100);
    rt[i] = p;
    lt[i] = add(1, MOD - p);
  }
  SegmentTree pre(n + 2);
  pre.update(1, 0, 0, lt[1]);
  pre.update(1, 1, 1, rt[1]);
  vector<Event> events;
  vector<Info> info;
  for (int i = 1; i + 1 <= n; i++) {
    LL gap = x[i + 1] - x[i];
    for (bool righti : {0, 1}) {
      for (bool rightii : {0, 1}) {
        LL rvel = (rightii ? -1 : 1) * v[i + 1] - (righti ? -1 : 1) * v[i];
        if (rvel <= 0) {
          pre.update(i + 1, rightii, righti, rightii ? rt[i + 1] : lt[i + 1]);
        } else {
          Frac tm(gap, rvel);
          events.push_back({tm, info.size()});
          info.push_back({i, righti, rightii});
        }
      }
    }
  }
  sort(events.rbegin(), events.rend(), [](const Event& a, const Event& b) {
    return cmpFrac(a.first, b.first);
  });
  LL ans = 0;
  LL tot = pre.query(1, n + 1).sum_all();
  for (auto& e : events) {
    auto tm = e.first;
    int idx = e.second;
    int i = info[idx].i;
    int righti = info[idx].righti;
    int rightii = info[idx].rightii;
    pre.update(i + 1, rightii, righti, rightii ? rt[i + 1] : lt[i + 1]);
    auto res = pre.query(1, n + 1);
    LL acttm = mul(tm.first, modinv(tm.second));
    LL cur = res.sum_all();
    cur = add(cur, MOD - tot);
    ans = add(ans, mul(acttm, cur));
    tot = add(cur, tot);
  }
  cout << ans << '\n';
  return 0;
}