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 P = 998244353;
int ad(int k1, int k2) { return k1 += k2 - P, k1 += k1 >> 31 & P; }
int su(int k1, int k2) { return k1 -= k2, k1 += k1 >> 31 & P; }
int mu(int k1, int k2) { return 1LL * k1 * k2 % P; }
int po(int k1, int k2) {
  int k3 = 1;
  for (; k2; k2 >>= 1, k1 = mu(k1, k1))
    if (k2 & 1) k3 = mu(k3, k1);
  return k3;
}
const int N = 100005, I100 = po(100, P - 2);
int n, x[N], v[N], p[N];
struct mat {
  int x[2][2];
  void clear() { memset(x, 0, sizeof(x)); }
} t[N * 4], ma[N];
struct ff {
  int fz, fm, id, *num;
  bool operator<(const ff& k) const {
    return 1LL * fz * k.fm < 1LL * k.fz * fm;
  }
} A[N * 2];
int len;
mat mu(const mat& k1, const mat& k2) {
  mat k3;
  k3.clear();
  for (int i = (0); i <= (1); ++i)
    for (int j = (0); j <= (1); ++j)
      for (int k = (0); k <= (1); ++k)
        k3.x[i][k] = ad(k3.x[i][k], mu(k1.x[i][j], k2.x[j][k]));
  return k3;
}
void upd(int k1) { t[k1] = mu(t[k1 * 2], t[k1 * 2 + 1]); }
void bud(int k1, int k2, int k3) {
  if (k2 == k3) {
    t[k1] = ma[k2];
    return;
  }
  int mid = (k2 + k3) >> 1;
  bud(k1 * 2, k2, mid), bud(k1 * 2 + 1, mid + 1, k3);
  upd(k1);
}
void mdf(int k1, int k2, int k3, int k4) {
  if (k2 == k3) {
    t[k1] = ma[k2];
    return;
  }
  int mid = (k2 + k3) >> 1;
  if (k4 <= mid)
    mdf(k1 * 2, k2, mid, k4);
  else
    mdf(k1 * 2 + 1, mid + 1, k3, k4);
  upd(k1);
}
int inv[2000005];
int main() {
  inv[0] = inv[1] = 1;
  for (int i = (2); i <= (2000004); ++i) inv[i] = mu(P - P / i, inv[P % i]);
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i)
    scanf("%d%d%d", &x[i], &v[i], &p[i]), p[i] = mu(p[i], I100);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = (1); i <= (n - 1); ++i) {
    for (int j = (0); j <= (1); ++j)
      for (int k = (0); k <= (1); ++k) {
        ma[i].x[j][k] = k ? p[i + 1] : su(1, p[i + 1]);
      }
    A[++len] = (ff){x[i + 1] - x[i], v[i] + v[i + 1], i, &ma[i].x[1][0]};
    if (v[i] < v[i + 1]) {
      A[++len] = (ff){x[i + 1] - x[i], v[i + 1] - v[i], i, &ma[i].x[0][0]};
    }
    if (v[i] > v[i + 1]) {
      A[++len] = (ff){x[i + 1] - x[i], v[i] - v[i + 1], i, &ma[i].x[1][1]};
    }
  }
  bud(1, 1, n - 1);
  sort(A + 1, A + 1 + len);
  auto calc = [&] {
    return ad(mu(p[1], ad(t[1].x[1][0], t[1].x[1][1])),
              mu(su(1, p[1]), ad(t[1].x[0][0], t[1].x[0][1])));
  };
  int ans = 0;
  int lst = calc();
  for (int i = (1); i <= (len); ++i) {
    *A[i].num = 0;
    mdf(1, 1, n - 1, A[i].id);
    int cur = calc();
    ans = ad(ans, mu(su(lst, cur), mu(A[i].fz, inv[A[i].fm])));
    lst = cur;
  }
  printf("%d\n", ans);
  return 0;
}