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 N = 400400;
const int mod = 998244353;
int n, cnt;
long long x[N], p[N], v[N], ans;
inline long long qpow(long long x, long long y, long long ans = 1) {
  for (; y; y >>= 1, x = x * x % mod)
    if (y & 1) ans = ans * x % mod;
  return ans;
}
struct Matrix {
  long long a[2][2];
  friend Matrix operator*(Matrix a, Matrix b) {
    Matrix c;
    c.a[0][0] = (a.a[0][0] * b.a[0][0] + a.a[0][1] * b.a[1][0]) % mod;
    c.a[1][0] = (a.a[1][0] * b.a[0][0] + a.a[1][1] * b.a[1][0]) % mod;
    c.a[0][1] = (a.a[0][0] * b.a[0][1] + a.a[0][1] * b.a[1][1]) % mod;
    c.a[1][1] = (a.a[1][0] * b.a[0][1] + a.a[1][1] * b.a[1][1]) % mod;
    return c;
  }
} a[N], c[N];
struct Bang {
  int x, y, ox, oy;
  long long len, v;
  friend bool operator<(Bang a, Bang b) { return a.len * b.v < b.len * a.v; }
} b[N];
void modify(int x, int l, int r, int p) {
  if (l == r) return a[x] = c[l], void();
  int mid = l + r >> 1;
  if (p <= mid) modify(x << 1, l, mid, p);
  if (p > mid) modify(x << 1 | 1, mid + 1, r, p);
  a[x] = a[x << 1] * a[x << 1 | 1];
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x[i] >> v[i] >> p[i];
  for (int i = 1; i < n; ++i) {
    b[++cnt].x = i, b[cnt].y = i + 1;
    b[cnt].ox = 1;
    b[cnt].oy = 0;
    b[cnt].len = x[i + 1] - x[i];
    b[cnt].v = v[i] + v[i + 1];
    if (v[i] > v[i + 1])
      b[++cnt].x = i, b[cnt].y = i + 1, b[cnt].ox = 1, b[cnt].oy = 1,
      b[cnt].len = x[i + 1] - x[i], b[cnt].v = v[i] - v[i + 1];
    else if (v[i] < v[i + 1])
      b[++cnt].x = i, b[cnt].y = i + 1, b[cnt].ox = 0, b[cnt].oy = 0,
      b[cnt].len = x[i + 1] - x[i], b[cnt].v = v[i + 1] - v[i];
  }
  c[1].a[0][0] = 100 - p[1];
  c[1].a[0][1] = p[1];
  modify(1, 1, n, 1);
  for (int i = 2; i <= n; ++i) {
    c[i].a[1][1] = p[i];
    c[i].a[0][1] = p[i];
    c[i].a[0][0] = 100 - p[i];
    c[i].a[1][0] = 100 - p[i];
    modify(1, 1, n, i);
  }
  sort(b + 1, b + cnt + 1);
  for (int i = 1; i <= cnt; ++i) {
    long long tmp = qpow(b[i].v, mod - 2) * b[i].len % mod;
    Matrix ooo = c[b[i].y];
    c[b[i].y].a[!b[i].ox][b[i].oy] = 0;
    c[b[i].y].a[!b[i].ox][!b[i].oy] = 0;
    c[b[i].y].a[b[i].ox][!b[i].oy] = 0;
    modify(1, 1, n, b[i].y);
    (ans += tmp * (a[1].a[0][0] + a[1].a[0][1])) %= mod;
    c[b[i].y] = ooo;
    c[b[i].y].a[b[i].ox][b[i].oy] = 0;
    modify(1, 1, n, b[i].y);
  }
  printf("%lld\n", (ans * qpow(100, n * (mod - 2ll)) % mod + mod) % mod);
  return 0;
}