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;
int n, leve, INV100, mod = 998244353;
struct Poi {
  int x, v, p;
} a[100011];
struct Eve {
  int id, a, b, timemod;
  double time;
  bool operator<(const Eve &b) const { return time < b.time; }
} eve[100011 * 3];
int powmod(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return ans;
}
double calc(int i, int x, int y) {
  int v1, v2;
  if (x)
    v1 = a[i - 1].v;
  else
    v1 = -a[i - 1].v;
  if (y)
    v2 = a[i].v;
  else
    v2 = -a[i].v;
  return 1.0 * (a[i].x - a[i - 1].x) / (v1 - v2);
}
int calcmod(int i, int x, int y) {
  int v1, v2;
  if (x)
    v1 = a[i - 1].v;
  else
    v1 = -a[i - 1].v;
  if (y)
    v2 = a[i].v;
  else
    v2 = -a[i].v;
  return ((0ll + a[i].x - a[i - 1].x + mod) % mod) * 1ll *
         powmod((0ll + v1 - v2 + mod + mod) % mod, mod - 2) % mod;
}
struct smtnode {
  int ls, rs, v[2][2];
};
struct SMT {
  smtnode a[100011 << 1];
  int n, sz;
  void clear(int N) {
    n = N;
    sz = 0;
  }
  void up(int x) {
    int p = a[x].ls, q = a[x].rs;
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++) {
        a[x].v[i][j] = 0;
        for (int k = 0; k < 2; k++)
          a[x].v[i][j] =
              (a[x].v[i][j] + 1ll * a[p].v[i][k] * a[q].v[k][j]) % mod;
      }
  }
  void build(int &x, int L, int R, Poi *b) {
    x = ++sz;
    if (L == R) {
      a[x].ls = a[x].rs = 0;
      a[x].v[0][1] = a[x].v[1][1] = b[L].p;
      a[x].v[0][0] = a[x].v[1][0] = mod + 1 - b[L].p;
      return;
    }
    int mid = (L + R) >> 1;
    build(a[x].ls, L, mid, b);
    build(a[x].rs, mid + 1, R, b);
    up(x);
  }
  void build(Poi *b) {
    int x;
    build(x, 1, n, b);
  }
  int query() { return (0ll + a[1].v[0][0] + a[1].v[0][1]) % mod; }
  void Modify(int x, int L, int R, int p, int q, int r) {
    if (L == R) {
      a[x].v[q][r] = 0;
      return;
    }
    int mid = (L + R) >> 1;
    if (p <= mid)
      Modify(a[x].ls, L, mid, p, q, r);
    else
      Modify(a[x].rs, mid + 1, R, p, q, r);
    up(x);
  }
  void modify(int p, int q, int r) { Modify(1, 1, n, p, q, r); }
} t;
int main() {
  scanf("%d", &n);
  INV100 = powmod(100, mod - 2);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &a[i].x, &a[i].v, &a[i].p),
        a[i].p = a[i].p * 1ll * INV100 % mod;
  leve = 0;
  for (int i = 2; i <= n; i++) {
    eve[++leve] = {i, 1, 0, calcmod(i, 1, 0), calc(i, 1, 0)};
    if (a[i - 1].v > a[i].v)
      eve[++leve] = {i, 1, 1, calcmod(i, 1, 1), calc(i, 1, 1)};
    if (a[i - 1].v < a[i].v)
      eve[++leve] = {i, 0, 0, calcmod(i, 0, 0), calc(i, 0, 0)};
  }
  sort(eve + 1, eve + 1 + leve);
  t.clear(n);
  t.build(a);
  int ans = 0;
  for (int i = 1, tmp, lastval = 1; i <= leve; i++) {
    t.modify(eve[i].id, eve[i].a, eve[i].b);
    tmp = t.query();
    ans = (ans + (lastval - tmp + mod) * 1ll * (eve[i].timemod)) % mod;
    lastval = tmp;
  }
  printf("%d\n", ans);
  return 0;
}