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 sum = 0, f = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
  return sum * f;
}
int n;
struct op {
  int x, v, p;
  op(int x_ = 0, int v_ = 0, int p_ = 0) : x(x_), v(v_), p(p_) {}
} st[100010];
const int mod = 998244353;
int ksm(int a, int b) {
  int sum = 1;
  while (b) {
    if (b & 1) sum = 1ll * sum * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return sum;
}
struct Pair {
  double val;
  int Val;
  int i, l, r;
  Pair(double a = 0, int b = 0, int c = 0, int d = 0, int e = 0)
      : val(a), Val(b), i(c), l(d), r(e) {}
  bool operator<(Pair s) const { return val < s.val; }
} s[100010 << 1];
int cnt;
struct juzhen {
  int x[2][2];
  juzhen() { memset(x, 0, sizeof(x)); }
  juzhen operator*(juzhen s) const {
    juzhen t;
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        for (int k = 0; k < 2; k++)
          t.x[i][j] = (t.x[i][j] + 1ll * x[i][k] * s.x[k][j] % mod) % mod;
    return t;
  }
} Sg[100010];
struct seg_tree {
  juzhen Gai[100010 << 2];
  void up(int now) { Gai[now] = Gai[now << 1] * Gai[now << 1 | 1]; }
  void build(int now, int l, int r) {
    if (l == r) {
      Gai[now] = Sg[l];
      return;
    }
    int mid = l + r >> 1;
    build(now << 1, l, mid);
    build(now << 1 | 1, mid + 1, r);
    up(now);
  }
  void modify(int now, int l, int r, int t, juzhen s) {
    if (l == r) {
      return void(Gai[now] = s);
    }
    int mid = l + r >> 1;
    if (t <= mid)
      modify(now << 1, l, mid, t, s);
    else
      modify(now << 1 | 1, mid + 1, r, t, s);
    up(now);
  }
} S;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    int x = read(), v = read(), p = read();
    p = 1ll * p * ksm(100, mod - 2) % mod;
    st[i] = op(x, v, p);
    if (i >= 2) {
      Sg[i].x[0][0] = Sg[i].x[1][0] = p;
      Sg[i].x[0][1] = Sg[i].x[1][1] = (mod + 1 - p) % mod;
    }
  }
  Sg[1].x[0][0] = st[1].p, Sg[1].x[0][1] = (mod + 1 - st[1].p) % mod;
  S.build(1, 1, n);
  for (int i = 2; i <= n; i++) {
    int shang = (st[i].x - st[i - 1].x);
    int xia = (st[i - 1].v + st[i].v);
    s[++cnt] = Pair((double)shang / xia, 1ll * shang * ksm(xia, mod - 2) % mod,
                    i - 1, 1, 0);
    int mmax = max(st[i - 1].v, st[i].v);
    int mmin = min(st[i - 1].v, st[i].v);
    mmax -= mmin;
    if (mmax) {
      int ty;
      if (st[i - 1].v > st[i].v)
        ty = 1;
      else
        ty = 0;
      s[++cnt] = Pair((double)shang / mmax,
                      1ll * shang * ksm(mmax, mod - 2) % mod, i - 1, ty, ty);
    }
  }
  sort(s + 1, s + 1 + cnt);
  int ans = 0;
  for (int i = 1; i <= cnt; i++) {
    int id = s[i].i;
    juzhen R;
    R.x[s[i].l ^ 1][s[i].r ^ 1] =
        s[i].r ? st[id + 1].p : (mod + 1 - st[id + 1].p) % mod;
    S.modify(1, 1, n, id + 1, R);
    juzhen GGG = S.Gai[1];
    int sum = (GGG.x[0][0] + GGG.x[0][1]) % mod;
    ans = (ans + 1ll * s[i].Val * sum % mod) % mod;
    Sg[id + 1].x[s[i].l ^ 1][s[i].r ^ 1] = 0;
    S.modify(1, 1, n, id + 1, Sg[id + 1]);
  }
  cout << ans;
  return 0;
}