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>
struct Element {
  int p, mask;
  long long uv, dv;
  Element(int p = 0, int mask = 0, long long uv = 0, long long dv = 0)
      : p(p), mask(mask), uv(uv), dv(dv) {}
  bool operator<(const Element& other) const {
    return uv * other.dv < other.uv * dv;
  }
};
struct SegmentT {
  int l, r;
  long long value[4];
};
const long long mod = 998244353;
long long x[100005], v[100005], p[100005];
long long prob[100005][2];
Element meet[400005];
long long need[100005][4];
SegmentT t[800005];
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res;
}
long long inv(long long u) { return power(u, mod - 2); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
SegmentT merge(SegmentT& a, SegmentT& b) {
  SegmentT res;
  res.l = a.l, res.r = b.r;
  for (int i = 0; i < 4; i++) res.value[i] = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      int middle = (i % 2) * 2 + j / 2;
      int next = i / 2 * 2 + j % 2;
      res.value[next] =
          res.value[next] + a.value[i] * b.value[j] * need[a.r][middle] % mod;
      if (res.value[next] >= mod) res.value[next] -= mod;
    }
  }
  return res;
}
void build(int p, int l, int r) {
  t[p].l = l, t[p].r = r;
  if (l == r) {
    t[p].value[1] = t[p].value[2] = 0;
    t[p].value[0] = prob[l][0];
    t[p].value[3] = prob[l][1];
  } else {
    int m = (l + r) / 2;
    build(2 * p, l, m);
    build(2 * p + 1, m + 1, r);
    t[p] = merge(t[2 * p], t[2 * p + 1]);
  }
}
void change(int p, int x) {
  if (t[p].l == t[p].r)
    return;
  else {
    int m = (t[p].l + t[p].r) / 2;
    if (x <= m) change(2 * p, x);
    if (x + 1 > m) change(2 * p + 1, x);
    t[p] = merge(t[2 * p], t[2 * p + 1]);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  long long inv100 = inv(100ll);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &x[i], &v[i], &p[i]);
    prob[i][0] = (100ll - p[i]) * inv100 % mod;
    prob[i][1] = p[i] * inv100 % mod;
    for (int j = 0; j < 4; j++) need[i][j] = 1;
  }
  build(1, 1, n);
  int size = 0;
  for (int i = 1; i <= n - 1; i++) {
    int j = i + 1;
    long long dis = x[j] - x[i];
    for (int mask = 0; mask < 4; mask++) {
      long long vi = v[i], vj = v[j];
      if (mask & 2) vi *= -1;
      if (mask & 1) vj *= -1;
      long long diffv = vj - vi;
      if (diffv > 0) {
        long long g = gcd(dis, diffv);
        meet[++size] = Element(i, mask, dis / g, diffv / g);
      }
    }
  }
  std::sort(meet + 1, meet + 1 + size);
  long long ans = 0, curProb = 1;
  int p = 1;
  while (p <= size) {
    int np = p;
    while (np + 1 <= size && meet[np + 1].uv == meet[p].uv &&
           meet[np + 1].dv == meet[p].dv)
      np++;
    long long lastProb = curProb;
    for (int i = p; i <= np; i++) {
      need[meet[i].p][meet[i].mask] = 0;
      change(1, meet[i].p);
    }
    curProb = 0;
    for (int i = 0; i < 4; i++) {
      curProb += t[1].value[i];
      if (curProb >= mod) curProb -= mod;
    }
    long long midProb = lastProb - curProb;
    if (midProb < 0) midProb += mod;
    long long time = meet[p].uv * inv(meet[p].dv) % mod;
    ans += midProb * time % mod;
    if (ans >= mod) ans -= mod;
    p = np + 1;
  }
  printf("%lld\n", ans);
  return 0;
}