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 unsigned gen_seed =
    std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long invmod(long long a, long long modulo) {
  long long x, y;
  long long g = gcd(a, modulo, x, y);
  if (g != 1) {
    return -1;
  } else {
    x = (x % modulo + modulo) % modulo;
    return x;
  }
}
class stree {
 public:
  std::vector<long long> t;
  std::vector<long long> pp;
  int s;
  void build(int n, int v, int tl, int tr) {
    if (v == 1) {
      t.resize(n * 4);
      pp = std::vector<long long>(n * 4, 1);
      s = n;
    }
    if (tl == tr)
      t[v] = 1;
    else {
      int tm = (tl + tr) / 2;
      build(n, v * 2, tl, tm);
      build(n, v * 2 + 1, tm + 1, tr);
      t[v] = t[v * 2] + t[v * 2 + 1];
    }
  }
  void push(int v, int tl, int tr) {
    if (pp[v] == 1) return;
    t[v] = t[v] * pp[v] % mod;
    if (tl != tr) {
      pp[2 * v] = pp[2 * v] * pp[v] % mod;
      pp[2 * v + 1] = pp[2 * v + 1] * pp[v] % mod;
    }
    pp[v] = 1;
  }
  void update(int v, int tl, int tr, int l, int r, long long val) {
    if (l == tl && tr == r) {
      pp[v] = pp[v] * val % mod;
      push(v, tl, tr);
      return;
    }
    if (l > r) {
      push(v, tl, tr);
      return;
    } else {
      push(v, tl, tr);
      int tm = (tl + tr) / 2;
      update(v * 2, tl, tm, l, min(r, tm), val);
      update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
      t[v] = (t[v * 2] + t[v * 2 + 1]) % mod;
    }
  }
  void set(int v, int tl, int tr, int pos, long long val) {
    if (pos > tr || pos < tl) {
      push(v, tl, tr);
      return;
    } else if (tl == tr) {
      pp[v] = 1;
      t[v] = val;
      return;
    } else {
      push(v, tl, tr);
      int tm = (tl + tr) / 2;
      set(v * 2, tl, tm, pos, val);
      set(v * 2 + 1, tm + 1, tr, pos, val);
      t[v] = (t[v * 2] + t[v * 2 + 1]) % mod;
    }
  }
  long long get(int v, int tl, int tr, int l, int r) {
    push(v, tl, tr);
    if (l > r) return 0;
    if (tl == l && r == tr) return t[v];
    int tm = (tl + tr) / 2;
    long long ret = (get(v * 2, tl, tm, l, min(r, tm)) +
                     get(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)) %
                    mod;
    t[v] = (t[v * 2] + t[v * 2 + 1]) % mod;
    return ret;
  }
};
bool comp(const pair<std::pair<long long, long long>, int>& a,
          const pair<std::pair<long long, long long>, int>& b) {
  if (a.first.first * b.first.second < a.first.second * b.first.first ||
      (a.first.first * b.first.second == a.first.second * b.first.first &&
       a.second < b.second))
    return true;
  else
    return false;
}
int main() {
  int n;
  scanf("%d", &n);
  set<std::pair<int, int>> s;
  std::vector<long long> l(n);
  std::vector<long long> r(n);
  std::vector<long long> bi(n, 0);
  std::vector<long long> v(n);
  std::vector<long long> x(n);
  long long curp = 1;
  long long i100 = invmod(100, mod);
  for (int i = 0; i < n; i++) {
    long long p;
    scanf("%lld %lld %lld", &x[i], &v[i], &p);
    s.insert(make_pair(i, i));
    l[i] = i100 * (100 - p) % mod;
    r[i] = i100 * p % mod;
  }
  vector<pair<std::pair<long long, long long>, int>> ev;
  for (int i = 0; i < n - 1; i++) {
    ev.push_back(make_pair(make_pair(x[i + 1] - x[i], v[i] + v[i + 1]), i + 1));
    if (v[i] != v[i + 1])
      ev.push_back(
          make_pair(make_pair(x[i + 1] - x[i], abs(v[i] - v[i + 1])), -i - 1));
  }
  sort(ev.begin(), ev.end(), comp);
  stree st;
  st.build(n, 1, 0, n - 1);
  long long ans = 0;
  for (auto x : ev) {
    if (x.second > 0) {
      auto it = s.lower_bound(make_pair(x.second, x.second));
      int l2 = it->first;
      int r2 = it->second;
      it--;
      int l1 = it->first;
      int r1 = it->second;
      s.erase(make_pair(l1, r1));
      s.erase(make_pair(l2, r2));
      long long in1 = st.get(1, 0, n - 1, l1, r1 - 1);
      long long in2 = st.get(1, 0, n - 1, l2, r2 - 1);
      long long pin = (l[l1] + r[l1] + in1) % mod * (l[l2] + r[l2] + in2) % mod;
      if (pin == 0) break;
      long long pout = curp * invmod(pin, mod) % mod;
      long long pend = (r[l1] + in1) * (l[l2] + in2) % mod;
      long long pendglobal = pend * pout % mod;
      ans = (ans +
             x.first.first * invmod(x.first.second, mod) % mod * pendglobal) %
            mod;
      s.insert(make_pair(l1, r2));
      st.update(1, 0, n - 1, l1, r1, r[l2]);
      st.update(1, 0, n - 1, r1, r2 - 1, l[l1]);
      l[l1] = l[l1] * l[l2] % mod;
      r[l1] = r[l1] * r[l2] % mod;
      long long pcont = (pin + mod - pend) % mod;
      curp = pout * pcont % mod;
    } else {
      int k = -1 - x.second;
      auto it = s.lower_bound(make_pair(k + 1, 0));
      it--;
      int l1 = it->first;
      int r1 = it->second;
      long long in1 = st.get(1, 0, n - 1, l1, r1 - 1);
      long long pin = (l[l1] + r[l1] + in1) % mod;
      if (pin == 0) break;
      long long pout = curp * invmod(pin, mod) % mod;
      long long pend = 0;
      if (v[k] > v[k + 1]) {
        pend = (st.get(1, 0, n - 1, l1, k - 1) + r[l1]) % mod;
        st.update(1, 0, n - 1, l1, k - 1, 0);
        r[l1] = 0;
      } else if (v[k + 1] > v[k]) {
        pend = (st.get(1, 0, n - 1, k + 1, r1 - 1) + l[l1]) % mod;
        st.update(1, 0, n - 1, k + 1, r1 - 1, 0);
        l[l1] = 0;
      }
      long long pendglobal = pend * pout % mod;
      ans = (ans +
             x.first.first * invmod(x.first.second, mod) % mod * pendglobal) %
            mod;
      long long pcont = (pin + mod - pend) % mod;
      curp = pout * pcont % mod;
    }
  }
  cout << ans;
}