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 long long maxl = 100005, mod = 998244353;
long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -w;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = (s << 1) + (s << 3) + (ch ^ '0');
    ch = getchar();
  }
  return s * w;
}
long long n, ducati, tmp, pos = 0, ans = 0;
struct node {
  long long x, sp, p, pp;
} a[maxl];
struct node2 {
  long long x, t1, y, t2, tim;
  double tim2;
} b[2 * maxl];
bool cmp(node2 xx, node2 yy) { return xx.tim2 > yy.tim2; }
struct Matrix {
  long long mat[2][2];
} tree[3][4 * maxl], val[3][maxl];
long long quick_power(long long x, long long y) {
  long long res = 1;
  for (; y; y = y >> 1, x = (x * x) % mod)
    if (y & 1) res = (res * x) % mod;
  return res;
}
long long ny(long long k) { return quick_power(k, mod - 2); }
Matrix operator*(const Matrix &x, const Matrix &y) {
  Matrix z;
  for (register long long i = 0; i < 2; ++i) {
    for (register long long j = 0; j < 2; ++j) {
      z.mat[i][j] = 0;
      for (register long long k = 0; k < 2; ++k)
        z.mat[i][j] = (z.mat[i][j] + x.mat[i][k] * y.mat[k][j]) % mod;
    }
  }
  return z;
}
void add(long long A, long long B, long long C, long long D, long long E,
         double F) {
  pos++;
  b[pos].x = A, b[pos].t1 = B, b[pos].y = C, b[pos].t2 = D;
  b[pos].tim = E, b[pos].tim2 = F;
}
void pushup1(long long rt) {
  tree[1][rt] = tree[1][2 * rt] * tree[1][2 * rt + 1];
}
void pushup2(long long rt) {
  tree[2][rt] = tree[2][2 * rt + 1] * tree[2][2 * rt];
}
void build_tree1(long long l, long long r, long long rt) {
  if (l == r) {
    tree[1][rt] = val[1][l];
    return;
  }
  long long mid = (l + r) >> 1;
  build_tree1(l, mid, 2 * rt);
  build_tree1(mid + 1, r, 2 * rt + 1);
  pushup1(rt);
}
void build_tree2(long long l, long long r, long long rt) {
  if (l == r) {
    tree[2][rt] = val[2][l];
    return;
  }
  long long mid = (l + r) >> 1;
  build_tree2(l, mid, 2 * rt);
  build_tree2(mid + 1, r, 2 * rt + 1);
  pushup2(rt);
}
void change1(long long nl, long long l, long long r, long long rt) {
  if (l == r) {
    tree[1][rt] = val[1][l];
    return;
  }
  long long mid = (l + r) >> 1;
  if (nl <= mid)
    change1(nl, l, mid, 2 * rt);
  else
    change1(nl, mid + 1, r, 2 * rt + 1);
  pushup1(rt);
}
void change2(long long nl, long long l, long long r, long long rt) {
  if (l == r) {
    tree[2][rt] = val[2][l];
    return;
  }
  long long mid = (l + r) >> 1;
  if (nl <= mid)
    change2(nl, l, mid, 2 * rt);
  else
    change2(nl, mid + 1, r, 2 * rt + 1);
  pushup2(rt);
}
Matrix query1(long long nl, long long nr, long long l, long long r,
              long long rt) {
  if (nl <= l && r <= nr) return tree[1][rt];
  long long mid = (l + r) >> 1;
  if (nl <= mid && nr <= mid)
    return query1(nl, nr, l, mid, 2 * rt);
  else if (nl > mid && nr > mid)
    return query1(nl, nr, mid + 1, r, 2 * rt + 1);
  else if (nl <= mid && nr > mid)
    return query1(nl, nr, l, mid, 2 * rt) *
           query1(nl, nr, mid + 1, r, 2 * rt + 1);
}
Matrix query2(long long nl, long long nr, long long l, long long r,
              long long rt) {
  if (nl <= l && r <= nr) return tree[2][rt];
  long long mid = (l + r) >> 1;
  if (nl <= mid && nr <= mid)
    return query2(nl, nr, l, mid, 2 * rt);
  else if (nl > mid && nr > mid)
    return query2(nl, nr, mid + 1, r, 2 * rt + 1);
  else if (nl <= mid && nr > mid)
    return query2(nl, nr, mid + 1, r, 2 * rt + 1) *
           query2(nl, nr, l, mid, 2 * rt);
}
signed main() {
  n = read();
  ducati = ny(100);
  for (long long i = 1; i <= n; i++) {
    a[i].x = read(), a[i].sp = read(), tmp = read();
    a[i].p = ((100 - tmp) * ducati) % mod, a[i].pp = (tmp * ducati) % mod;
  }
  for (long long i = 2; i <= n; i++) {
    val[1][i].mat[0][1] = a[i].pp;
    val[2][i - 1].mat[1][0] = a[i - 1].p;
    long long tim = ((a[i].x - a[i - 1].x) * ny(a[i].sp + a[i - 1].sp)) % mod;
    double tim2 = (1.00 * a[i].x - a[i - 1].x) / (1.00 * a[i].sp + a[i - 1].sp);
    add(i - 1, 1, i, 0, tim, tim2);
    if (a[i].sp > a[i - 1].sp) {
      long long tim = ((a[i].x - a[i - 1].x) * ny(a[i].sp - a[i - 1].sp)) % mod;
      double tim2 =
          (1.00 * a[i].x - a[i - 1].x) / (1.00 * a[i].sp - a[i - 1].sp);
      add(i - 1, 0, i, 0, tim, tim2);
    } else {
      val[1][i].mat[0][0] = a[i].p;
      val[2][i - 1].mat[0][0] = a[i - 1].p;
    }
    if (a[i].sp < a[i - 1].sp) {
      long long tim = ((a[i].x - a[i - 1].x) * ny(a[i - 1].sp - a[i].sp)) % mod;
      double tim2 =
          (1.00 * a[i].x - a[i - 1].x) / (1.00 * a[i - 1].sp - a[i].sp);
      add(i - 1, 1, i, 1, tim, tim2);
    } else {
      val[1][i].mat[1][1] = a[i].pp;
      val[2][i - 1].mat[1][1] = a[i - 1].pp;
    }
  }
  sort(b + 1, b + pos + 1, cmp);
  build_tree1(1, n, 1), build_tree2(1, n, 1);
  for (long long i = 1; i <= pos; i++) {
    long long rt = b[i].x, ans1, ans2, now;
    Matrix pre, suf;
    if (rt > 1) {
      pre = query1(2, rt, 1, n, 1);
      if (b[i].t1 == 0)
        ans1 = (a[1].p * pre.mat[0][0] + a[1].pp * pre.mat[1][0]) % mod;
      else
        ans1 = (a[1].p * pre.mat[0][1] + a[1].pp * pre.mat[1][1]) % mod;
    } else {
      if (b[i].t1 == 0)
        ans1 = a[1].p;
      else
        ans1 = a[1].pp;
    }
    if (rt + 1 < n) {
      suf = query2(rt + 1, n - 1, 1, n, 1);
      if (b[i].t2 == 0)
        ans2 = (a[n].p * suf.mat[0][0] + a[n].pp * suf.mat[1][0]) % mod;
      else
        ans2 = (a[n].p * suf.mat[0][1] + a[n].pp * suf.mat[1][1]) % mod;
    } else {
      if (b[i].t2 == 0)
        ans2 = a[n].p;
      else
        ans2 = a[n].pp;
    }
    now = (ans1 * ans2) % mod;
    now = (now * b[i].tim) % mod;
    ans = (ans + now) % mod;
    if (b[i].t1 == 0 && b[i].t2 == 0) {
      val[1][rt + 1].mat[0][0] = a[rt + 1].p;
      val[2][rt].mat[0][0] = a[rt].p;
    } else if (b[i].t1 == 1 && b[i].t2 == 0) {
      val[1][rt + 1].mat[1][0] = a[rt + 1].p;
      val[2][rt].mat[0][1] = a[rt].pp;
    } else {
      val[1][rt + 1].mat[1][1] = a[rt + 1].pp;
      val[2][rt].mat[1][1] = a[rt].pp;
    }
    change1(rt + 1, 1, n, 1);
    change2(rt, 1, n, 1);
  }
  cout << ans << endl;
  return 0;
}