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 int MOD = 998244353;
template <typename T>
struct modular {
  constexpr modular() : val(0) {}
  constexpr modular(const modular<T>& _m) : val(_m.val) {}
  template <typename U>
  constexpr modular(const U& _r = U()) {
    val = -MOD <= _r && _r < MOD ? _r : _r % MOD;
    if (val < 0) {
      val += MOD;
    }
  }
  const T operator()() { return val; }
  template <typename U>
  explicit operator U() const {
    return static_cast<U>(val);
  }
  modular<T>& operator+=(const modular<T>& _m) {
    if ((val += _m.val) >= MOD) {
      val -= MOD;
    }
    return *this;
  }
  modular<T>& operator-=(const modular<T>& _m) {
    if ((val -= _m.val) < 0) {
      val += MOD;
    }
    return *this;
  }
  modular<T>& operator*=(const modular<T>& _m) {
    val = modular<T>(static_cast<int64_t>(val) * static_cast<int64_t>(_m.val))
              .val;
    return *this;
  }
  modular<T>& operator/=(const modular<T>& _m) {
    T a = _m.val, b = MOD, u = 0, v = 1;
    while (a != 0) {
      T q = b / a;
      b -= q * a;
      swap(a, b);
      u -= q * v;
      swap(u, v);
    }
    return *this *= u;
  }
  modular<T>& operator=(const modular<T>& _m) {
    val = _m.val;
    return *this;
  }
  template <typename U>
  modular<T>& operator+=(const U& _r) {
    return *this += modular<T>(_r);
  }
  template <typename U>
  modular<T>& operator-=(const U& _r) {
    return *this -= modular<T>(_r);
  }
  template <typename U>
  modular<T>& operator*=(const U& _r) {
    return *this *= modular<T>(_r);
  }
  template <typename U>
  modular<T>& operator/=(const U& _r) {
    return *this /= modular<T>(_r);
  }
  template <typename U>
  modular<T>& operator=(const U& _r) {
    val = modular<T>(_r).val;
    return *this;
  }
  modular<T> operator-() { return modular<T>(-val); }
  template <typename U>
  friend bool operator==(const modular<U>&, const modular<U>&);
  friend std::istream& operator>>(std::istream& os, modular<T>& _m) {
    os >> _m.val;
    _m *= 1;
    return os;
  }
  friend std::ostream& operator<<(std::ostream& os, const modular<T>& _m) {
    return os << _m.val;
  }
  template <typename U>
  modular<T> exp(U e) {
    modular<T> res = 1;
    modular<T> b = val;
    if (e < 0) {
      b = 1 / b;
      e *= -1;
    }
    for (; e; e >>= 1) {
      if (e & 1) {
        res *= b;
      }
      b *= b;
    }
    return res;
  }

 private:
  T val;
};
template <typename T>
inline modular<T> operator+(const modular<T>& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) += _rhs;
}
template <typename T, typename U>
inline modular<T> operator+(const modular<T>& _lhs, const U& _rhs) {
  return modular<T>(_lhs) += _rhs;
}
template <typename T, typename U>
inline modular<T> operator+(const U& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) += _rhs;
}
template <typename T>
inline modular<T> operator-(const modular<T>& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) -= _rhs;
}
template <typename T, typename U>
inline modular<T> operator-(const modular<T>& _lhs, const U& _rhs) {
  return modular<T>(_lhs) -= _rhs;
}
template <typename T, typename U>
inline modular<T> operator-(const U& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) -= _rhs;
}
template <typename T>
inline modular<T> operator*(const modular<T>& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) *= _rhs;
}
template <typename T, typename U>
inline modular<T> operator*(const modular<T>& _lhs, const U& _rhs) {
  return modular<T>(_lhs) *= _rhs;
}
template <typename T, typename U>
inline modular<T> operator*(const U& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) *= _rhs;
}
template <typename T>
inline modular<T> operator/(const modular<T>& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) /= _rhs;
}
template <typename T, typename U>
inline modular<T> operator/(const modular<T>& _lhs, const U& _rhs) {
  return modular<T>(_lhs) /= _rhs;
}
template <typename T, typename U>
inline modular<T> operator/(const U& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) /= _rhs;
}
template <typename T>
inline bool operator==(const modular<T>& _lhs, const modular<T>& _rhs) {
  return _lhs.val == _rhs.val;
}
template <typename T, typename U>
inline bool operator==(const modular<T>& _lhs, const U& _rhs) {
  return _lhs == modular<T>(_rhs);
}
template <typename T, typename U>
inline bool operator==(const U& _lhs, const modular<T>& _rhs) {
  return modular<T>(_lhs) == _rhs;
}
template <typename T>
inline bool operator!=(const modular<T>& _lhs, const modular<T>& _rhs) {
  return !(_lhs == _rhs);
}
template <typename T, typename U>
inline bool operator!=(const modular<T>& _lhs, const U& _rhs) {
  return !(_lhs == _rhs);
}
template <typename T, typename U>
inline bool operator!=(const U& _lhs, const modular<T>& _rhs) {
  return !(_lhs == _rhs);
}
template <typename M>
struct SegTree {
  using Op = function<M(const M&, const M&)>;
  M ID;
  Op op;
  int N;
  vector<M> a;
  SegTree(int n, M leaf_default, M _ID, Op _op) : ID(_ID), op(_op) {
    init_space(n);
    fill(a.begin() + N, a.begin() + N + n, leaf_default);
    build();
  }
  SegTree(const vector<M> leaves, M _ID, Op _op) : ID(_ID), op(_op) {
    int n = leaves.size();
    init_space(n);
    copy(leaves.begin(), leaves.end(), a.begin() + N);
    build();
  }
  void init_space(int n) {
    N = 1;
    while (N < n) N <<= 1;
    a.assign(N << 1, ID);
  }
  inline void pull(int i) { a[i] = op(a[i << 1], a[i << 1 | 1]); }
  void build() {
    for (int i = N - 1; i >= 1; i--) pull(i);
  }
  void assign(int p, M val) {
    assert(0 <= p && p < N);
    for (a[p += N] = val; p >>= 1;) pull(p);
  }
  void cancel(int p, int x, int y) {
    for (a[p += N][x][y] = 0; p >>= 1;) pull(p);
  }
  M query(int l, int r) const {
    assert(0 <= l && r <= N);
    M resl(ID), resr(ID);
    for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = op(resl, a[l++]);
      if (r & 1) resr = op(a[--r], resr);
    }
    return op(resl, resr);
  }
  M query_point(int p) const {
    assert(0 <= p && p < N);
    return a[p + N];
  }
  M query_all() const { return a[1]; }
};
struct Event {
  int dist, velo, i;
  int x, y;
  Event() {}
  Event(int _dist, int _velo, int _i, int _x, int _y)
      : dist(_dist), velo(_velo), i(_i), x(_x), y(_y) {}
  bool operator<(const Event& _oth) const {
    return 1ll * dist * _oth.velo < 1ll * _oth.dist * velo;
  }
};
void solve() {
  int n;
  cin >> n;
  vector<int> X(n), V(n);
  vector<modular<int> > P(n);
  modular<int> i100 = modular<int>(1) / 100;
  for (int i = 0; i < n; i++) {
    cin >> X[i] >> V[i] >> P[i];
    P[i] *= i100;
  }
  using M = array<array<modular<int>, 2>, 2>;
  vector<M> a(n);
  a[0][0] = {1 - P[0], 0};
  a[0][1] = {0, P[0]};
  vector<Event> evs;
  for (int i = 1; i < n; i++) {
    a[i][0] = {1 - P[i], P[i]};
    a[i][1] = {1 - P[i], P[i]};
    int dx = X[i] - X[i - 1];
    evs.emplace_back(dx, V[i] + V[i - 1], i, 1, 0);
    if (V[i] > V[i - 1]) {
      evs.emplace_back(dx, V[i] - V[i - 1], i, 0, 0);
    }
    if (V[i] < V[i - 1]) {
      evs.emplace_back(dx, V[i - 1] - V[i], i, 1, 1);
    }
  }
  sort(evs.begin(), evs.end());
  M ID;
  ID[0][0] = ID[1][1] = 1;
  auto mul = [](M u, M v) {
    M r;
    for (int i : {0, 1})
      for (int j : {0, 1})
        for (int k : {0, 1}) r[i][j] += u[i][k] * v[k][j];
    return r;
  };
  auto sum = [](M u) {
    modular<int> res = 0;
    for (int i : {0, 1})
      for (int j : {0, 1}) res += u[i][j];
    return res;
  };
  SegTree<M> seg(a, ID, mul);
  modular<int> prob = sum(seg.query_all());
  assert(prob == 1);
  modular<int> res = 0;
  for (auto& e : evs) {
    modular<int> tim = e.dist / modular<int>(e.velo);
    seg.cancel(e.i, e.x, e.y);
    auto nxt = sum(seg.query_all());
    modular<int> hold = prob - nxt;
    prob = nxt;
    res += hold * tim;
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}