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>
const int N = 1e5 + 5, P = 998244353;
int n, po[N], sp[N], pr[N];
inline int ksm(int x, int y = P - 2) {
  int z = 1;
  for (; y; x = 1ll * x * x % P, y >>= 1)
    if (y & 1) z = 1ll * z * x % P;
  return z;
}
struct TI {
  int p, o, d, v;
  TI(int P = 0, int O = 0, int D = 0, int V = 0) { p = P, o = O, d = D, v = V; }
} ti[N * 2];
int tt;
bool cmp(TI x, TI y) { return 1ll * x.d * y.v < 1ll * y.d * x.v; }
int sg[N * 4][4], ans;
bool ok[N][4], cp[4];
void bld(int w = 1, int l = 1, int r = n) {
  if (l == r) {
    sg[w][0] = (1 + P - pr[l]) % P, sg[w][3] = pr[l];
    return;
  }
  int mi = l + r >> 1;
  bld(w * 2, l, mi), bld(w * 2 + 1, mi + 1, r);
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; ++j)
      sg[w][i] = (1ll * sg[w * 2][(i & 1) | (j & 1) << 1] *
                      sg[w * 2 + 1][j >> 1 | (i & 2)] +
                  sg[w][i]) %
                 P;
}
void chg(int x, int w = 1, int l = 1, int r = n) {
  if (l == r) return;
  int mi = l + r >> 1;
  if (x <= mi)
    chg(x, w * 2, l, mi);
  else
    chg(x, w * 2 + 1, mi + 1, r);
  for (int i = 0; i < 4; ++i) {
    sg[w][i] = 0;
    for (int j = 0; j < 4; ++j)
      if (ok[mi][j])
        sg[w][i] = (1ll * sg[w * 2][(i & 1) | (j & 1) << 1] *
                        sg[w * 2 + 1][j >> 1 | (i & 2)] +
                    sg[w][i]) %
                   P;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d%d", &po[i], &sp[i], &pr[i]), pr[i] = 828542813ll * pr[i] % P;
  for (int i = 1; i < n; ++i) {
    ti[++tt] = TI(i, 1, po[i + 1] - po[i], sp[i + 1] + sp[i]);
    if (sp[i] > sp[i + 1])
      ti[++tt] = TI(i, 3, po[i + 1] - po[i], sp[i] - sp[i + 1]);
    if (sp[i + 1] > sp[i])
      ti[++tt] = TI(i, 0, po[i + 1] - po[i], sp[i + 1] - sp[i]);
  }
  std::sort(ti + 1, ti + tt + 1, cmp);
  bld();
  for (int i = 1; i < n; ++i)
    for (int j = 0; j < 4; ++j) ok[i][j] = 1;
  for (int i = 1, p; i <= tt; ++i) {
    p = ti[i].p;
    memcpy(cp, ok[p], 4);
    memset(ok[p], 0, 4), ok[p][ti[i].o] = 1;
    chg(p);
    for (int j = 0; j < 4; ++j)
      ans = (1ll * ti[i].d * ksm(ti[i].v) % P * sg[1][j] + ans) % P;
    memcpy(ok[p], cp, 4), ok[p][ti[i].o] = 0;
    chg(p);
  }
  printf("%d\n", ans);
  return 0;
}