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;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 666666, mo = 998244353, inf = 0x3f3f3f3f;
inline void add(int &x, int y) { x = x + y < mo ? x + y : x + y - mo; }
inline void sub(int &x, int y) { x = x - y >= 0 ? x - y : x - y + mo; }
inline int power(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = 1LL * res * a % mo;
    a = 1LL * a * a % mo;
    n >>= 1;
  }
  return res;
}
int n, x[N], v[N], p[N], len, zhi[N];
bool zuo[N], you[N];
set<pair<int, int> > Set;
struct node {
  int pos, tp, a, b;
} s[N];
bool cmp(node x, node y) { return 1ll * x.a * y.b < 1ll * y.a * x.b; }
namespace yzr {
struct node {
  int ans, zuo, you;
} tree[N << 2];
node merge(node a, node b) {
  node c;
  c.zuo = 1ll * a.zuo * b.zuo % mo;
  c.you = 1ll * a.you * b.you % mo;
  c.ans =
      ((1ll * a.ans * b.you + 1ll * a.zuo * b.ans - 1ll * a.zuo * b.you) % mo +
       mo) %
      mo;
  return c;
}
void build(int k, int l, int r) {
  if (l == r) {
    tree[k].ans = 1;
    tree[k].zuo = 1 + mo - p[l];
    tree[k].you = p[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  tree[k] = merge(tree[k << 1], tree[k << 1 | 1]);
}
node qry(int k, int l, int r, int L, int R) {
  if (l == L && r == R) return tree[k];
  int mid = (L + R) >> 1;
  if (r <= mid) return qry(k << 1, l, r, L, mid);
  if (l > mid) return qry(k << 1 | 1, l, r, mid + 1, R);
  return merge(qry(k << 1, l, mid, L, mid),
               qry(k << 1 | 1, mid + 1, r, mid + 1, R));
}
int qry(int l, int r) {
  if (you[l] && zuo[r]) return 0;
  if (you[l]) return qry(1, l, r, 1, n).you;
  if (zuo[r]) return qry(1, l, r, 1, n).zuo;
  return qry(1, l, r, 1, n).ans;
}
}  // namespace yzr
int main() {
  read(n);
  for (register int i = (1); i <= (n); i++)
    read(x[i]), read(v[i]), read(p[i]),
        p[i] = 1ll * p[i] * power(100, mo - 2) % mo;
  for (register int i = (1); i <= (n - 1); i++) {
    s[++len] = (node){i, 0, x[i + 1] - x[i], v[i] + v[i + 1]};
    if (v[i] > v[i + 1])
      s[++len] = (node){i, 1, x[i + 1] - x[i], v[i] - v[i + 1]};
    if (v[i] < v[i + 1])
      s[++len] = (node){i, 2, x[i + 1] - x[i], -v[i] + v[i + 1]};
  }
  sort(s + 1, s + len + 1, cmp);
  for (register int i = (1); i <= (len); i++)
    zhi[i] = 1ll * s[i].a * power(s[i].b, mo - 2) % mo;
  int res = zhi[1], cur = 1;
  for (register int i = (1); i <= (n); i++) Set.insert(pair<int, int>(i, i));
  yzr::build(1, 1, n);
  for (register int j = (1); j <= (len); j++) {
    if (s[j].tp == 0) {
      set<pair<int, int> >::iterator it = Set.lower_bound(
                                         pair<int, int>(s[j].pos + 1, -inf)),
                                     it1;
      it1 = it;
      it1--;
      cur = 1ll * cur *
            power(1ll * yzr::qry((*it1).first, (*it1).second) *
                      yzr::qry((*it).first, (*it).second) % mo,
                  mo - 2) %
            mo;
      int L = (*it1).first, R = (*it).second;
      Set.erase(it);
      Set.erase(it1);
      Set.insert(pair<int, int>(L, R));
      cur = 1ll * cur * yzr::qry(L, R) % mo;
    } else if (s[j].tp == 1) {
      if (you[s[j].pos])
        cur = 0;
      else if (!zuo[s[j].pos]) {
        set<pair<int, int> >::iterator it =
            Set.lower_bound(pair<int, int>(s[j].pos, inf));
        it--;
        int L = (*it).first, R = (*it).second;
        cur = 1ll * cur *
              power(yzr::qry((*it).first, (*it).second) % mo, mo - 2) % mo;
        zuo[s[j].pos] = 1;
        Set.erase(it);
        Set.insert(pair<int, int>(L, s[j].pos));
        Set.insert(pair<int, int>(s[j].pos + 1, R));
        cur = 1ll * cur * yzr::qry(L, s[j].pos) % mo *
              yzr::qry(s[j].pos + 1, R) % mo;
      }
    } else {
      if (zuo[s[j].pos + 1])
        cur = 0;
      else if (!you[s[j].pos + 1]) {
        set<pair<int, int> >::iterator it =
            Set.lower_bound(pair<int, int>(s[j].pos + 1, inf));
        it--;
        int L = (*it).first, R = (*it).second;
        cur = 1ll * cur *
              power(yzr::qry((*it).first, (*it).second) % mo, mo - 2) % mo;
        you[s[j].pos + 1] = 1;
        Set.erase(it);
        Set.insert(pair<int, int>(L, s[j].pos));
        Set.insert(pair<int, int>(s[j].pos + 1, R));
        cur = 1ll * cur * yzr::qry(L, s[j].pos) % mo *
              yzr::qry(s[j].pos + 1, R) % mo;
      }
    }
    if (j < len)
      res = (res + 1ll * cur * (zhi[j + 1] - zhi[j] + mo)) % mo;
    else
      res = (res - 1ll * cur * zhi[j]) % mo;
  }
  cout << (res % mo + mo) % mo;
  return 0;
}