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;
long long read() {
  long long ret = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
  return ret;
}
const int MAXN = 200005, MOD = 998244353;
long long pow(long long a, long long b, long long p = MOD) {
  long long ret = 1;
  for (; b; a = a * a % p, b >>= 1)
    if (b & 1) ret = ret * a % p;
  return ret;
}
long long inv(long long x, long long p = MOD) { return pow(x, p - 2, p); }
int N;
long long x[MAXN], v[MAXN], p[MAXN];
struct data {
  long long s, v;
  int id, typ;
  data(long long s = 0, long long v = 0, int id = 0, int typ = 0)
      : s(s), v(v), id(id), typ(typ) {}
  friend bool operator<(data d1, data d2) { return d1.s * d2.v < d2.s * d1.v; }
  friend bool operator!=(data d1, data d2) {
    return d1.s * d2.v != d2.s * d1.v;
  }
} D[MAXN];
int Dlen;
int a[MAXN][2][2];
struct sgt {
  long long mat[2][2];
  friend sgt merge(int L, int R, const sgt& l, const sgt& r) {
    int i, j, k, t, mid = (L + R) >> 1;
    sgt ret;
    ret.mat[0][0] = ret.mat[0][1] = ret.mat[1][0] = ret.mat[1][1] = 0;
    for (i = 0; i < 2; ++i)
      for (j = 0; j < 2; ++j) {
        for (k = 0; k < 2; ++k)
          for (t = 0; t < 2; ++t)
            if (!a[mid][k][t]) {
              ret.mat[i][j] = (ret.mat[i][j] + l.mat[i][k] * r.mat[t][j]) % MOD;
            }
      }
    return ret;
  }
} T[MAXN << 2];
void build(int o, int l, int r) {
  if (l == r)
    T[o].mat[0][0] = p[l], T[o].mat[1][0] = T[o].mat[0][1] = 0,
    T[o].mat[1][1] = 1 - p[l];
  else {
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1 | 1, mid + 1, r),
        T[o] = merge(l, r, T[o << 1], T[o << 1 | 1]);
  }
}
void insert(int o, int l, int r, int pos, int x, int y) {
  if (l == r)
    a[l][x][y] = 1;
  else {
    int mid = (l + r) >> 1;
    if (pos <= mid)
      insert(o << 1, l, mid, pos, x, y);
    else
      insert(o << 1 | 1, mid + 1, r, pos, x, y);
    T[o] = merge(l, r, T[o << 1], T[o << 1 | 1]);
  }
}
sgt query(int o, int l, int r, int L, int R) {
  if (l == L && r == R)
    return T[o];
  else {
    int mid = (l + r) >> 1;
    if (R <= mid)
      return query(o << 1, l, mid, L, R);
    else if (L > mid)
      return query(o << 1 | 1, mid + 1, r, L, R);
    else
      return merge(l, r, query(o << 1, l, mid, L, mid),
                   query(o << 1 | 1, mid + 1, r, mid + 1, R));
  }
}
long long ans, prob[MAXN], val[MAXN];
int len;
int main() {
  scanf("%d", &N);
  int i;
  if (N == 1) {
    puts("0");
    return 0;
  }
  for (i = 1; i <= N; ++i)
    scanf("%lld%lld%lld", &x[i], &v[i], &p[i]), p[i] = p[i] * inv(100) % MOD;
  for (i = 1; i < N; ++i) {
    D[++Dlen] = data(x[i + 1] - x[i], v[i + 1] + v[i], i, 1);
    if (v[i] > v[i + 1])
      D[++Dlen] = data(x[i + 1] - x[i], v[i] - v[i + 1], i, 2);
    else if (v[i] < v[i + 1])
      D[++Dlen] = data(x[i + 1] - x[i], v[i + 1] - v[i], i, 3);
  }
  sort(D + 1, D + Dlen + 1);
  build(1, 1, N);
  for (i = 1; i <= Dlen; ++i) {
    if (D[i].typ == 1)
      insert(1, 1, N, D[i].id, 0, 1);
    else if (D[i].typ == 2)
      insert(1, 1, N, D[i].id, 0, 0);
    else
      insert(1, 1, N, D[i].id, 1, 1);
    if (i == Dlen || D[i] != D[i + 1]) {
      sgt ret = query(1, 1, N, 1, N);
      val[++len] = D[i].s * inv(D[i].v) % MOD,
      prob[len] =
          (ret.mat[0][0] + ret.mat[0][1] + ret.mat[1][0] + ret.mat[1][1]) % MOD;
    }
  }
  prob[0] = 1;
  for (i = 1; i <= len; ++i)
    ans = (ans + (prob[i - 1] - prob[i]) * val[i]) % MOD;
  printf("%lld\n", (ans + MOD) % MOD);
  return 0;
}