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;
template <class T>
inline void cmin(T &a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T &a, T b) {
  ((a < b) && (a = b));
}
char IO;
template <class T = int>
T rd() {
  T s = 0;
  int f = 0;
  while (!isdigit(IO = getchar())) f |= IO == '-';
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 1e5 + 10, INF = 1e9 + 10, P = 998244353;
int n;
int x[N], v[N], p[N];
long long qpow(long long x, long long k = P - 2) {
  long long res = 1;
  for (; k; k >>= 1, x = x * x % P)
    if (k & 1) res = res * x % P;
  return res;
}
const int inv = qpow(100);
int bit, s[N << 2][2][2];
void Up(int p) {
  memset(s[p], 0, 16);
  for (int i = 0, iend = 1; i <= iend; ++i)
    for (int j = 0, jend = 1; j <= jend; ++j)
      for (int k = 0, kend = 1; k <= kend; ++k)
        s[p][i][k] =
            (s[p][i][k] + 1ll * s[p << 1][i][j] * s[p << 1 | 1][j][k]) % P;
}
int pos[N];
void Build(int p = 1, int l = 1, int r = n) {
  if (l == r) {
    pos[l] = p;
    for (int a = 0, aend = 1; a <= aend; ++a) {
      s[p][a][0] = 1ll * (100 - ::p[l]) * inv % P;
      s[p][a][1] = 1ll * ::p[l] * inv % P;
    }
    return;
  }
  int mid = (l + r) >> 1;
  Build(p << 1, l, mid), Build(p << 1 | 1, mid + 1, r);
  Up(p);
}
struct Node {
  int x, y;
  int i, a, b;
  int operator<(const Node __) const { return 1ll * x * __.y < 1ll * y * __.x; }
} A[N * 2];
int C;
int t[2][2];
int main() {
  n = rd();
  for (int i = 1, iend = n; i <= iend; ++i)
    x[i] = rd(), v[i] = rd(), p[i] = rd();
  for (int i = 2, iend = n; i <= iend; ++i) {
    A[++C] = (Node){x[i] - x[i - 1], v[i] + v[i - 1], i, 1, 0};
    if (v[i - 1] < v[i])
      A[++C] = (Node){x[i] - x[i - 1], v[i] - v[i - 1], i, 0, 0};
    if (v[i - 1] > v[i])
      A[++C] = (Node){x[i] - x[i - 1], v[i - 1] - v[i], i, 1, 1};
  }
  sort(A + 1, A + C + 1);
  int ans = 0;
  Build();
  for (int i = 1, iend = C; i <= iend; ++i) {
    int val = A[i].x * qpow(A[i].y) % P;
    int p = pos[A[i].i];
    for (int a = 0, aend = 1; a <= aend; ++a)
      for (int b = 0, bend = 1; b <= bend; ++b)
        if (a != A[i].a || b != A[i].b) swap(s[p][a][b], t[a][b]);
    while (p > 1) Up(p >>= 1);
    ans = (ans + 1ll * (s[1][0][0] + s[1][0][1]) * val) % P;
    p = pos[A[i].i];
    for (int a = 0, aend = 1; a <= aend; ++a)
      for (int b = 0, bend = 1; b <= bend; ++b)
        if (a != A[i].a || b != A[i].b)
          swap(s[p][a][b], t[a][b]);
        else
          s[p][a][b] = 0;
    while (p > 1) Up(p >>= 1);
  }
  printf("%d\n", ans);
}