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;
long long pw(long long val, int p) {
  long long res = 1;
  while (p != 0) {
    if ((p & 1) != 0) res = (res * val) % 998244353;
    p >>= 1;
    val = (val * val) % 998244353;
  }
  return res;
}
long long pinv = pw(100, 998244353 - 2);
long long pinv2 = (pinv * pinv) % 998244353;
struct State {
  vector<pair<int, int>> st[4];
};
vector<pair<int, int>> mrg(const vector<pair<int, int>>& v1,
                           const vector<pair<int, int>>& v2) {
  vector<pair<int, int>> res;
  res.reserve(v1.size() + v2.size());
  int p1 = 0;
  int p2 = 0;
  long long sum1 = 1;
  long long sum2 = 1;
  while (p1 < v1.size() && p2 < v2.size()) {
    if (v1[p1].first == v2[p2].first) {
      sum1 = (sum1 + 998244353 - v1[p1].second) % 998244353;
      long long p = (v1[p1].second * sum2 + v2[p2].second * sum1) % 998244353;
      sum2 = (sum2 + 998244353 - v2[p2].second) % 998244353;
      res.push_back(make_pair(v1[p1].first, (int)p));
      p1++;
      p2++;
    } else if (v1[p1].first < v2[p2].first) {
      sum1 = (sum1 + 998244353 - v1[p1].second) % 998244353;
      long long p = (v1[p1].second * sum2) % 998244353;
      res.push_back(make_pair(v1[p1].first, (int)p));
      p1++;
    } else {
      sum2 = (sum2 + 998244353 - v2[p2].second) % 998244353;
      long long p = (v2[p2].second * sum1) % 998244353;
      res.push_back(make_pair(v2[p2].first, (int)p));
      p2++;
    }
  }
  if (sum2 != 0) {
    while (p1 < v1.size()) {
      sum1 = (sum1 + 998244353 - v1[p1].second) % 998244353;
      long long p = (v1[p1].second * sum2) % 998244353;
      res.push_back(make_pair(v1[p1].first, (int)p));
      p1++;
    }
  }
  if (sum1 != 0) {
    while (p2 < v2.size()) {
      sum2 = (sum2 + 998244353 - v2[p2].second) % 998244353;
      long long p = (v2[p2].second * sum1) % 998244353;
      res.push_back(make_pair(v2[p2].first, (int)p));
      p2++;
    }
  }
  return res;
}
vector<pair<int, int>> add(int p, const vector<pair<int, int>>& v1,
                           const vector<pair<int, int>>& v2) {
  if (p == 0) return v1;
  if (p == 100) return v2;
  vector<pair<int, int>> res;
  res.reserve(v1.size() + v2.size());
  long long pL = ((100 - p) * pinv) % 998244353;
  long long pR = (p * pinv) % 998244353;
  int p1 = 0;
  int p2 = 0;
  while (p1 < v1.size() && p2 < v2.size()) {
    if (v1[p1].first == v2[p2].first) {
      long long p = (v1[p1].second * pL + v2[p2].second * pR) % 998244353;
      res.push_back(make_pair(v1[p1].first, (int)p));
      p1++;
      p2++;
    } else if (v1[p1].first < v2[p2].first) {
      long long p = (v1[p1].second * pL) % 998244353;
      res.push_back(make_pair(v1[p1].first, (int)p));
      p1++;
    } else {
      long long p = (v2[p2].second * pR) % 998244353;
      res.push_back(make_pair(v2[p2].first, (int)p));
      p2++;
    }
  }
  while (p1 < v1.size()) {
    long long p = (v1[p1].second * pL) % 998244353;
    res.push_back(make_pair(v1[p1].first, (int)p));
    p1++;
  }
  while (p2 < v2.size()) {
    long long p = (v2[p2].second * pR) % 998244353;
    res.push_back(make_pair(v2[p2].first, (int)p));
    p2++;
  }
  return res;
}
void joinState(State& res, long long p, const State& s1, const State& s2) {
  res.st[0] = add(p, mrg(s1.st[0], s2.st[0]), mrg(s1.st[2], s2.st[1]));
  res.st[1] = add(p, mrg(s1.st[1], s2.st[0]), mrg(s1.st[3], s2.st[1]));
  res.st[2] = add(p, mrg(s1.st[0], s2.st[2]), mrg(s1.st[2], s2.st[3]));
  res.st[3] = add(p, mrg(s1.st[1], s2.st[2]), mrg(s1.st[3], s2.st[3]));
}
int gcd(int a, int b) {
  while (b != 0) {
    int t = b;
    b = a % b;
    a = t;
  }
  return a;
}
pair<int, int> getFrac(int num, int den) {
  int cd = gcd(num, den);
  return make_pair(num / cd, den / cd);
}
int x[100000];
int v[100000];
int pr[100000];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> v[i] >> pr[i];
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  vector<pair<pair<int, int>, int>> comp;
  comp.reserve(n * 2);
  for (int i = 0; i + 1 < n; i++) {
    comp.emplace_back(getFrac(x[i + 1] - x[i], v[i] + v[i + 1]), i * 4 + 1);
    if (v[i] != v[i + 1]) {
      comp.emplace_back(getFrac(x[i + 1] - x[i], abs(v[i] - v[i + 1])),
                        i * 4 + (v[i] < v[i + 1] ? 0 : 3));
    };
  }
  auto cmp = [](const pair<pair<int, int>, int>& p1,
                const pair<pair<int, int>, int>& p2) {
    return p1.first.first * (long long)p2.first.second <
           p2.first.first * (long long)p1.first.second;
  };
  sort(comp.begin(), comp.end(), cmp);
  vector<State> probs(n - 1);
  vector<pair<int, int>> tvals;
  for (int i = 0; i < comp.size(); i++) {
    if (i == 0 || comp[i - 1].first != comp[i].first)
      tvals.push_back(comp[i].first);
    int idx = comp[i].second;
    probs[idx / 4].st[idx % 4].push_back(make_pair((int)tvals.size(), 1));
  }
  int pstep = 1;
  while (probs.size() > 1) {
    vector<State> probs_nxt((probs.size() + 1) / 2);
    for (int i = 0; i < probs.size() / 2; i++) {
      joinState(probs_nxt[i], pr[pstep * (1 + 2 * i)], probs[2 * i],
                probs[2 * i + 1]);
    }
    if (probs.size() % 2 != 0) {
      probs_nxt[probs_nxt.size() - 1] = probs[probs.size() - 1];
    }
    pstep *= 2;
    probs = probs_nxt;
  }
  auto resL = add(pr[0], probs[0].st[0], probs[0].st[1]);
  auto resR = add(pr[0], probs[0].st[2], probs[0].st[3]);
  auto resT = add(pr[n - 1], resL, resR);
  long long res = 0;
  for (int i = 0; i < resT.size(); i++) {
    int id = resT[i].first;
    long long term =
        (resT[i].second * (long long)tvals[id - 1].first) % 998244353;
    term = (term * pw(tvals[id - 1].second, 998244353 - 2)) % 998244353;
    res += term;
  }
  res %= 998244353;
  cout << res << endl;
  return 0;
}