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;
struct node {
  int x, st, spd, o1, o2;
} b[200102 << 2];
struct jz {
  int s[2][2];
  friend jz operator*(jz a, jz b) {
    jz ret;
    ret.s[0][0] = ret.s[0][1] = ret.s[1][0] = ret.s[1][1] = 0;
    for (register int i = 0; i < 2; i++)
      for (register int j = 0; j < 2; j++)
        for (register int k = 0; k < 2; k++)
          ret.s[i][j] = (ret.s[i][j] + 1ll * a.s[i][k] * b.s[k][j] % p) % p;
    return ret;
  }
} dw, f[200102], zr;
struct quji {
  int l, r, mid;
  jz he;
} c[200102 << 2];
int n, a[200102], v[200102], ps[200102][2], tot;
inline int getspd(int x, int o1, int o2) {
  if (o1 == 0 && o2 == 0)
    return v[x + 1] - v[x];
  else if (o1 == 0 && o2 == 1)
    return -1;
  else if (o1 == 1 && o2 == 0)
    return v[x + 1] + v[x];
  else
    return v[x] - v[x + 1];
}
inline int ksm(int d, int k) {
  int ret = 1;
  while (k) {
    if (k & 1) ret = 1ll * ret * d % p;
    d = 1ll * d * d % p;
    k >>= 1;
  }
  return ret;
}
bool cmp(node n1, node n2) {
  if (1ll * n1.st * n2.spd == 1ll * n2.st * n1.spd)
    return n1.x < n2.x;
  else
    return 1ll * n1.st * n2.spd > 1ll * n2.st * n1.spd;
}
void bt(int ind, int l, int r) {
  c[ind].l = l;
  c[ind].r = r;
  c[ind].mid = (l + r) >> 1;
  if (l == r) return;
  bt(ind << 1, l, c[ind].mid);
  bt(ind << 1 | 1, c[ind].mid + 1, r);
}
void chng(int ind, int x, jz y) {
  if (c[ind].l == c[ind].r) {
    c[ind].he = y;
    return;
  }
  if (x <= c[ind].mid)
    chng(ind << 1, x, y);
  else
    chng(ind << 1 | 1, x, y);
  c[ind].he = c[ind << 1].he * c[ind << 1 | 1].he;
}
jz ask(int ind, int l, int r) {
  if (l > r) return dw;
  if (l <= c[ind].l && c[ind].r <= r) return c[ind].he;
  jz ret = dw;
  if (l <= c[ind].mid) ret = ret * ask(ind << 1, l, r);
  if (r > c[ind].mid) ret = ret * ask(ind << 1 | 1, l, r);
  return ret;
}
void pt(jz te) {
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) printf("%d ", te.s[i][j]);
    puts("");
  }
}
int main() {
  dw.s[0][0] = dw.s[1][1] = 1;
  scanf("%d", &n);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    int tp;
    scanf("%d%d%d", &a[i], &v[i], &tp);
    tp = 1ll * tp * ksm(100, p - 2) % p;
    ps[i][1] = tp;
    ps[i][0] = (1 - tp + p) % p;
  }
  bt(1, 1, n);
  f[1].s[0][0] = ps[1][0];
  f[1].s[0][1] = ps[1][1];
  chng(1, 1, f[1]);
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 2; j++)
      for (int k = 0; k < 2; k++) {
        node nd;
        nd.spd = getspd(i, j, k);
        if (nd.spd <= 0) {
          (f[i + 1].s[j][k] += ps[i + 1][k]) %= p;
          chng(1, i + 1, f[i + 1]);
          continue;
        }
        nd.st = a[i + 1] - a[i];
        nd.x = i;
        nd.o1 = j, nd.o2 = k;
        b[++tot] = nd;
      }
  }
  sort(b + 1, b + 1 + tot, cmp);
  int ans = 0;
  for (int i = 1; i <= tot; i++) {
    node nd = b[i];
    jz mt = ask(1, 1, nd.x - 1), tj = zr;
    tj.s[nd.o1][nd.o2] = ps[nd.x + 1][nd.o2];
    jz tf = f[nd.x];
    tf.s[0][nd.o1 ^ 1] = tf.s[1][nd.o1 ^ 1] = 0;
    mt = mt * tf;
    mt = mt * tj;
    mt = mt * ask(1, nd.x + 2, n);
    int ti = 1ll * nd.st * ksm(nd.spd, p - 2) % p;
    ans = (ans + 1ll * ti * (mt.s[0][0] + mt.s[0][1]) % p) % p;
    (f[nd.x + 1].s[nd.o1][nd.o2] += ps[nd.x + 1][nd.o2]) %= p;
    chng(1, nd.x + 1, f[nd.x + 1]);
  }
  printf("%d\n", ans);
}