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;
struct P {
  int id, x1, x2, x, v;
};
struct Matrix {
  int op[3][3];
  void toE() { op[1][1] = op[2][2] = 1, op[1][2] = op[2][1] = 0; }
  void operator*=(const Matrix& s) {
    int tmp[3][3];
    tmp[1][1] = tmp[1][2] = tmp[2][1] = tmp[2][2] = 0;
    for (int i = 1; i <= 2; i++) {
      for (int j = 1; j <= 2; j++) {
        for (int k = 1; k <= 2; k++)
          tmp[i][j] = (tmp[i][j] + 1ll * op[i][k] * s.op[k][j]) % 998244353;
      }
    }
    op[1][1] = tmp[1][1], op[1][2] = tmp[1][2], op[2][1] = tmp[2][1],
    op[2][2] = tmp[2][2];
  }
} nd[100000 + 5 << 2], t1, t2, t3, t4;
vector<P> vec;
int n, x[100000 + 5], v[100000 + 5], p[100000 + 5], ans;
inline int inv(int x) {
  int ans = 1, sta = x, y = 998244353 - 2;
  while (y) {
    if (y & 1) ans = 1ll * ans * sta % 998244353;
    sta = 1ll * sta * sta % 998244353, y >>= 1;
  }
  return ans;
}
void getTime(int a, int b, int id, int& xx, int& vv) {
  int t = 0;
  if (id == 0) {
    if (v[a] > v[b])
      xx = (x[b] - x[a]), vv = v[a] - v[b];
    else
      xx = 0x7fffffff;
  } else if (id == 3) {
    if (v[b] > v[a])
      xx = x[b] - x[a], vv = v[b] - v[a];
    else
      xx = 0x7fffffff;
  } else if (id == 1) {
    xx = x[b] - x[a], vv = v[a] + v[b];
  } else
    xx = 0x7fffffff;
}
void build(int l = 1, int r = n, int k = 1) {
  if (l == r) {
    nd[k].op[1][1] = nd[k].op[2][1] = 1ll * (100 - p[l]) * inv(100) % 998244353;
    nd[k].op[1][2] = nd[k].op[2][2] = 1ll * p[l] * inv(100) % 998244353;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, k << 1), build(mid + 1, r, k << 1 | 1);
  nd[k].toE(), nd[k] *= nd[k << 1], nd[k] *= nd[k << 1 | 1];
}
void change(int at, const Matrix& s, int l = 1, int r = n, int k = 1) {
  if (l == r) {
    nd[k] = s;
    return;
  }
  int mid = (l + r) >> 1;
  if (at <= mid)
    change(at, s, l, mid, k << 1);
  else
    change(at, s, mid + 1, r, k << 1 | 1);
  nd[k].toE(), nd[k] *= nd[k << 1], nd[k] *= nd[k << 1 | 1];
}
const Matrix& getMatrix(int at, int l = 1, int r = n, int k = 1) {
  if (l == r) return nd[k];
  int mid = (l + r) >> 1;
  if (at <= mid) return getMatrix(at, l, mid, k << 1);
  return getMatrix(at, mid + 1, r, k << 1 | 1);
}
inline int get() { return (nd[1].op[1][1] + nd[1].op[1][2]) % 998244353; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d%d", x + i, v + i, p + i);
  for (int i = 2; i <= n; i++) {
    P ps;
    ps.x1 = i - 1, ps.x2 = i;
    for (int j = 0, pp; j < 4; j++) {
      getTime(i - 1, i, j, ps.x, ps.v);
      if (ps.x != 0x7fffffff) ps.id = j, vec.push_back(ps);
    }
  }
  sort(vec.begin(), vec.end(),
       [](P a, P b) { return 1ll * a.x * b.v < 1ll * b.x * a.v; });
  build();
  for (P s : vec) {
    t3 = t1 = getMatrix(s.x1), t4 = t2 = getMatrix(s.x2);
    if (s.id & 1)
      t2.op[1][2] = t2.op[2][2] = 0;
    else
      t2.op[1][1] = t2.op[2][1] = 0;
    if (s.id & 2)
      t1.op[1][2] = t1.op[2][2] = 0;
    else
      t1.op[1][1] = t1.op[2][1] = 0;
    change(s.x1, t1), change(s.x2, t2);
    ans = (ans + 1ll * s.x * inv(s.v) % 998244353 * get()) % 998244353;
    if (s.id == 0)
      t4.op[2][2] = 0;
    else if (s.id == 1)
      t4.op[2][1] = 0;
    else if (s.id == 3)
      t4.op[1][1] = 0;
    change(s.x1, t3), change(s.x2, t4);
  }
  printf("%d", (ans + 998244353) % 998244353);
  return 0;
}