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 x = 0;
  bool f = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f = (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return f ? -x : x;
}
const int maxn = 1e5 + 7;
const int mod = 998244353;
inline int qpow(int d, int z, int a = 1) {
  for (; z; z >>= 1, d = 1ll * d * d % mod)
    if (z & 1) a = 1ll * a * d % mod;
  return a;
}
const int inv100 = qpow(100, mod - 2);
int n, ans;
int x[maxn], v[maxn], p[2][maxn];
inline int getspd(int i, int x, int y) {
  if (x == 0 && y == 1) return -1;
  if (x == 0 && y == 0) return v[i + 1] - v[i];
  if (x == 1 && y == 0) return v[i + 1] + v[i];
  if (x == 1 && y == 1) return v[i] - v[i + 1];
}
struct mar {
  int a[2][2];
  mar() { memset(a, 0, sizeof(a)); }
  mar(int w, int x, int y, int z) {
    a[0][0] = w;
    a[0][1] = x;
    a[1][0] = y;
    a[1][1] = z;
  }
  inline mar friend operator*(mar a, mar b) {
    mar ret;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        ret.a[i][j] =
            (1ll * a.a[i][0] * b.a[0][j] + 1ll * a.a[i][1] * b.a[1][j]) % mod;
    return ret;
  }
} M[maxn], sum[maxn * 4];
struct state {
  int p, i, j, S, V, T;
  inline bool friend operator<(state a, state b) {
    return 1ll * a.S * b.V < 1ll * a.V * b.S;
  }
} st[maxn * 4];
int id;
void build(int k, int L, int R) {
  if (L == R) return sum[k] = M[R], void();
  int mid = (L + R) >> 1;
  build(k << 1, L, mid);
  build(k << 1 | 1, mid + 1, R);
  sum[k] = sum[k << 1] * sum[k << 1 | 1];
}
void mdf(int k, int L, int R, int p) {
  if (L == R) return sum[k] = M[R], void();
  int mid = (L + R) >> 1;
  if (p <= mid)
    mdf(k << 1, L, mid, p);
  else
    mdf(k << 1 | 1, mid + 1, R, p);
  sum[k] = sum[k << 1] * sum[k << 1 | 1];
}
int main() {
  n = read();
  if (n == 1) return puts("0"), 0;
  for (int i = 1; i <= n; ++i)
    x[i] = read(), v[i] = read(), p[1][i] = 1ll * inv100 * read() % mod,
    p[0][i] = mod + 1 - p[1][i];
  for (int i = 1; i < n; ++i)
    for (int l = 0; l < 2; ++l)
      for (int r = 0; r < 2; ++r)
        if (getspd(i, l, r) > 0) {
          st[++id].p = i;
          st[id].i = l;
          st[id].j = r;
          st[id].S = x[i + 1] - x[i];
          st[id].V = getspd(i, l, r);
          st[id].T = 1ll * st[id].S * qpow(st[id].V, mod - 2) % mod;
        }
  for (int i = 1; i < n; ++i)
    M[i] = mar(p[0][i + 1], p[1][i + 1], p[0][i + 1], p[1][i + 1]);
  sort(st + 1, st + 1 + id);
  build(1, 1, n - 1);
  for (int i = 1; i <= id; ++i) {
    int ps = st[i].p;
    mar m1 = M[ps], m2 = mar(0, 0, 0, 0);
    m2.a[st[i].i][st[i].j] = p[st[i].j][ps + 1];
    M[ps] = m2;
    mdf(1, 1, n - 1, ps);
    mar m3 = mar(p[0][1], p[1][1], 0, 0);
    m3 = m3 * sum[1];
    ans = (ans + 1ll * st[i].T * (m3.a[0][0] + m3.a[0][1])) % mod;
    m1.a[st[i].i][st[i].j] = 0;
    M[ps] = m1;
    mdf(1, 1, n - 1, ps);
  }
  printf("%d\n", ans);
  return 0;
}