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 <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int maxn = 100111;
const int mod = 998244353;
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ret;
}
struct matrix {
  int a[2][2];
  matrix() { memset(a, 0, sizeof(a)); }
  void set(int x) {
    a[0][1] = a[1][0] = 0;
    a[0][0] = a[1][1] = x;
  }
};
matrix operator*(const matrix &a, const matrix &b) {
  matrix ret;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++)
        ret.a[i][j] = (ret.a[i][j] + (long long)a.a[i][k] * b.a[k][j]) % mod;
  return ret;
}
bool operator==(const matrix &a, const matrix &b) {
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (a.a[i][j] != b.a[i][j]) return false;
  return true;
}
matrix seg[300111];
void modify(int p, const matrix &v, int tl, int tr, int t) {
  if (tl == tr) {
    seg[t] = v;
    return;
  }
  int mid = (tl + tr) >> 1;
  if (p <= mid)
    modify(p, v, tl, mid, (t << 1));
  else
    modify(p, v, mid + 1, tr, ((t << 1) | 1));
  seg[t] = seg[(t << 1)] * seg[((t << 1) | 1)];
}
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return (long long)a.first * b.second < (long long)a.second * b.first;
}
bool cmp2(const pair<pair<int, int>, int> &a,
          const pair<pair<int, int>, int> &b) {
  return cmp(a.first, b.first);
}
bool eq(const pair<int, int> &a, const pair<int, int> &b) {
  return (long long)a.first * b.second == (long long)a.second * b.first;
}
int x[maxn], p[maxn], v[maxn], n;
void setv(int pos, pair<int, int> t) {
  matrix cur;
  cur.a[0][1] = 1;
  if (cmp(t, make_pair(x[pos + 1] - x[pos], abs(v[pos + 1] - v[pos]))))
    cur.a[0][0] = cur.a[1][1] = 1;
  else {
    cur.a[0][0] = (v[pos + 1] <= v[pos]);
    cur.a[1][1] = (v[pos + 1] >= v[pos]);
  }
  if (cmp(t, make_pair(x[pos + 1] - x[pos], v[pos + 1] + v[pos])))
    cur.a[1][0] = 1;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      if (j == 0)
        cur.a[i][j] = (long long)cur.a[i][j] * (mod + 1 - p[pos + 1]) % mod;
      else
        cur.a[i][j] = (long long)cur.a[i][j] * p[pos + 1] % mod;
    }
  modify(pos, cur, 1, n - 1, 1);
}
int calc() {
  int prob = 0;
  matrix cur = seg[1];
  for (int j = 0; j < 2; j++)
    for (int k = 0; k < 2; k++) {
      int coef = cur.a[j][k];
      if (j == 0)
        coef = (long long)coef * (mod + 1 - p[1]) % mod;
      else
        coef = (long long)coef * p[1] % mod;
      prob += coef;
      if (prob >= mod) prob -= mod;
    }
  return prob;
}
int main() {
  get_int(n);
  for (int i = 1; i <= n; i++) {
    (get_int(x[i]) && (get_int(v[i]) && get_int(p[i])));
    p[i] = (long long)p[i] * qpow(100, mod - 2) % mod;
  }
  vector<pair<pair<int, int>, int> > vs;
  for (int pos = 1; pos < n; pos++) {
    if (v[pos] != v[pos + 1])
      vs.push_back(make_pair(
          make_pair(x[pos + 1] - x[pos], abs(v[pos + 1] - v[pos])), pos));
    vs.push_back(
        make_pair(make_pair(x[pos + 1] - x[pos], v[pos + 1] + v[pos]), pos));
    vs.push_back(make_pair(make_pair(2000000001, 1), pos));
  }
  sort(vs.begin(), vs.end(), cmp2);
  pair<int, int> cur = make_pair(0, 1);
  for (int i = 1; i < n; i++) setv(i, cur);
  int ans = 0, last = calc();
  for (int i = 0, nxt = 0; i < (int)vs.size(); i = nxt) {
    for (; nxt < (int)vs.size() && eq(vs[i].first, vs[nxt].first); nxt++)
      ;
    for (int j = i; j < nxt; j++) setv(vs[j].second, vs[j].first);
    int prob = calc();
    ans = (ans + (long long)(last - prob + mod) * vs[i].first.first % mod *
                     qpow(vs[i].first.second, mod - 2)) %
          mod;
    cur = vs[i].first;
    last = prob;
  }
  print_int(ans), puts("");
  return 0;
}