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;
inline int add(int a, int b) {
  if ((a += b) >= mod) a -= mod;
  return a;
}
inline int dec(int a, int b) {
  if ((a -= b) < 0) a += mod;
  return a;
}
inline int mult(int a, int b) {
  long long t = 1ll * a * b;
  if (t >= mod) t %= mod;
  return t;
}
inline int power(int a, int b) {
  int out = 1;
  while (b) {
    if (b & 1) out = mult(out, a);
    a = mult(a, a);
    b >>= 1;
  }
  return out;
}
int n, x[100010], v[100010], p[100010];
const int I100 = power(100, mod - 2);
class coll {
 public:
  double t;
  int typ, pos, S;
  bool operator<(const coll &c) const { return t < c.t; }
};
vector<coll> c;
namespace matrix {
template <int N, int M>
class matr {
 public:
  int dat[N][M];
  void init() { memset(dat, 0, sizeof(dat)); }
  void iden() {
    init();
    for (int i = 0; i < min(N, M); i++) dat[i][i] = 1;
  }
  matr<M, N> trans() {
    matr<M, N> out;
    for (int i = 0; i < M; i++)
      for (int j = 0; j < N; j++) out[i][j] = dat[j][i];
  }
  const int *operator[](const int &x) const { return dat[x]; }
  int *operator[](const int &x) { return dat[x]; }
  matr<N, M> operator+(const matr<N, M> a) {
    matr<N, M> out;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) out[i][j] = add(dat[i][j], a[i][j]);
    return out;
  }
  matr<N, M> operator*(const int &x) {
    matr<N, M> out = *this;
    for (int i = 0; i < N; i++)
      for (int j = 0; j < M; j++) out[i][j] = mult(out[i][j], x);
    return out;
  }
  template <int X>
  friend matr<N, M> operator*(const matr<N, X> a, const matr<X, M> b) {
    matr<N, M> out;
    out.init();
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < X; j++) {
        if (a[i][j]) {
          for (int k = 0; k < M; k++)
            out[i][k] = add(out[i][k], mult(a[i][j], b[j][k]));
        }
      }
    }
    return out;
  }
};
};  // namespace matrix
using namespace matrix;
matr<2, 2> t[400010], M[100010];
inline void pushup(int p) { t[p] = t[(p << 1)] * t[((p << 1) | 1)]; }
inline void build(int p, int l, int r) {
  if (l == r) {
    t[p][0][0] = t[p][1][0] = ::p[l + 1];
    t[p][0][1] = t[p][1][1] = dec(1, ::p[l + 1]);
    M[l] = t[p];
    return;
  }
  int mid = (l + r) >> 1;
  build((p << 1), l, mid);
  build(((p << 1) | 1), mid + 1, r);
  pushup(p);
}
inline void modify(int p, int l, int r, int pos) {
  if (l == r) {
    t[p] = M[l];
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    modify((p << 1), l, mid, pos);
  else
    modify(((p << 1) | 1), mid + 1, r, pos);
  pushup(p);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &x[i], &v[i], &p[i]), p[i] = mult(p[i], I100);
  for (int i = 1; i < n; i++) {
    int dis = x[i + 1] - x[i];
    c.push_back((coll){1.0 * dis / (v[i] + v[i + 1]), 0, i,
                       mult(dis % mod, power(v[i] + v[i + 1], mod - 2))});
    if (v[i] > v[i + 1])
      c.push_back((coll){1.0 * dis / (v[i] - v[i + 1]), 1, i,
                         mult(dis % mod, power(v[i] - v[i + 1], mod - 2))});
    else if (v[i] < v[i + 1])
      c.push_back((coll){1.0 * dis / (v[i + 1] - v[i]), 2, i,
                         mult(dis % mod, power(v[i + 1] - v[i], mod - 2))});
  }
  build(1, 0, n - 1);
  sort(c.begin(), c.end());
  int ans = 0;
  for (auto &x : c) {
    int pos = x.pos;
    int p1 = 0, p2 = 0, v2;
    switch (x.typ) {
      case 0:
        p1 = 0, p2 = 1;
        break;
      case 1:
        p1 = 0, p2 = 0;
        break;
      case 2:
        p1 = 1, p2 = 1;
        break;
    }
    if (p2 == 0)
      v2 = p[pos + 1];
    else
      v2 = dec(1, p[pos + 1]);
    matr<2, 2> tmp = M[pos];
    M[pos].init();
    M[pos][p1][p2] = v2;
    modify(1, 0, n - 1, pos);
    ans = add(ans, mult(x.S, add(t[1][1][0], t[1][1][1])));
    M[pos] = tmp;
    M[pos][p1][p2] = 0;
    modify(1, 0, n - 1, pos);
  }
  printf("%d\n", ans);
  return 0;
}