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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) {
    if (ch == '-') f = -1;
  }
  for (; isdigit(ch); ch = getchar()) {
    x = x * 10 + ch - 48;
  }
  return x * f;
}
const int mxN = 1e5;
const int P = 998244353;
struct Element {
  long long x, v, p;
} a[mxN + 3];
struct Event {
  int u, x, y;
  long long t1, t2;
  bool operator<(const Event &arg) const { return t1 * arg.t2 < t2 * arg.t1; }
} ev[mxN * 2 + 3];
int f[mxN + 3][2][2];
int n, m;
long long quickpow(long long x, long long y) {
  long long cur = x, ret = 1ll;
  for (int i = 0; y; i++) {
    if (y & (1ll << i)) {
      y -= (1ll << i);
      ret = ret * cur % P;
    }
    cur = cur * cur % P;
  }
  return ret;
}
long long mulinv(long long x) { return quickpow(x, P - 2); }
struct SgTNode {
  long long x[2][2];
} sgt[mxN * 4 + 3];
void pushup(int u, int mid) {
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) sgt[u].x[i][j] = 0ll;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (!f[mid][i][j]) {
        for (int ii = 0; ii < 2; ii++)
          for (int jj = 0; jj < 2; jj++) {
            sgt[u].x[ii][jj] += sgt[u << 1].x[ii][i] * sgt[u << 1 | 1].x[j][jj];
          }
      }
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      sgt[u].x[i][j] %= P;
    }
}
void build(int u, int le, int ri) {
  if (le == ri) {
    sgt[u].x[0][0] = P + 1 - a[le].p, sgt[u].x[1][1] = a[le].p;
    return;
  }
  int mid = (le + ri) >> 1;
  build(u << 1, le, mid);
  build(u << 1 | 1, mid + 1, ri);
  pushup(u, mid);
}
void update(int u, int le, int ri, int pos) {
  if (le == ri) {
    return;
  }
  int mid = (le + ri) >> 1;
  if (pos <= mid) {
    update(u << 1, le, mid, pos);
  } else {
    update(u << 1 | 1, mid + 1, ri, pos);
  }
  pushup(u, mid);
}
long long query() {
  return (sgt[1].x[0][0] + sgt[1].x[0][1] + sgt[1].x[1][0] + sgt[1].x[1][1]) %
         P;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d%I64d", &a[i].x, &a[i].v, &a[i].p);
    a[i].p = a[i].p * mulinv(100) % P;
  }
  for (int i = 1; i < n; i++) {
    ev[++m].u = i, ev[m].x = 1, ev[m].y = 0, ev[m].t1 = a[i + 1].x - a[i].x,
    ev[m].t2 = a[i].v + a[i + 1].v;
    if (a[i].v < a[i + 1].v) {
      ev[++m].u = i, ev[m].x = 0, ev[m].y = 0, ev[m].t1 = a[i + 1].x - a[i].x,
      ev[m].t2 = a[i + 1].v - a[i].v;
    } else if (a[i].v > a[i + 1].v) {
      ev[++m].u = i, ev[m].x = 1, ev[m].y = 1, ev[m].t1 = a[i + 1].x - a[i].x,
      ev[m].t2 = a[i].v - a[i + 1].v;
    }
  }
  sort(ev + 1, ev + m + 1);
  long long ans = 0ll, prob = 1ll;
  build(1, 1, n);
  for (int i = 1; i <= m; i++) {
    f[ev[i].u][ev[i].x][ev[i].y] = 1;
    update(1, 1, n, ev[i].u);
    long long tmp = query(), tim = ev[i].t1 * mulinv(ev[i].t2) % P;
    ans = (ans + (prob - tmp + P) * tim) % P;
    prob = tmp;
  }
  printf("%I64d\n", ans);
  return 0;
}