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, p1[100005], p2[100005], p3[100005];
struct hh {
  int x, v, p, p1, p2;
  bool operator<(hh a) const { return 1ll * x * a.v < 1ll * a.x * v; }
} sk[100005 * 3];
int pw(int x, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = 1ll * ans * x % 998244353;
    x = 1ll * x * x % 998244353;
    p >>= 1;
  }
  return ans;
}
int tr[100005 << 2][2][2];
void xc(int a[2][2], int b[2][2]) {
  int c[2][2];
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) c[i][j] = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k)
        c[i][k] = (c[i][k] + 1ll * a[i][j] * b[j][k]) % 998244353;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) a[i][j] = c[i][j];
}
void build(int p, int l, int r) {
  if (l == r) {
    for (int i = 0; i < 2; ++i) {
      tr[p][i][0] = 1 - p3[l + 1];
      tr[p][i][1] = p3[l + 1];
    }
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) tr[p][i][j] = tr[p << 1][i][j];
  xc(tr[p], tr[p << 1 | 1]);
}
int a[2];
void Xc(int a[2], int b[2][2]) {
  int c[2];
  for (int i = 0; i < 2; ++i) c[i] = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      c[j] = (c[j] + 1ll * a[i] * b[i][j]) % 998244353;
  for (int i = 0; i < 2; ++i) a[i] = c[i];
}
void query(int p, int l, int r, int L, int R) {
  if (l == L && r == R) {
    Xc(a, tr[p]);
    return;
  }
  int mid = (l + r) >> 1;
  if (R <= mid)
    query(p << 1, l, mid, L, R);
  else if (L > mid)
    query(p << 1 | 1, mid + 1, r, L, R);
  else
    query(p << 1, l, mid, L, mid), query(p << 1 | 1, mid + 1, r, mid + 1, R);
}
void update(int p, int l, int r, int x, int w1, int w2) {
  if (l == r) {
    tr[p][w1][w2] = 0;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(p << 1, l, mid, x, w1, w2);
  else if (x > mid)
    update(p << 1 | 1, mid + 1, r, x, w1, w2);
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) tr[p][i][j] = tr[p << 1][i][j];
  xc(tr[p], tr[p << 1 | 1]);
}
int main() {
  scanf("%d", &n);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    scanf("%d%d%d", &p1[i], &p2[i], &p3[i]),
        p3[i] = 1ll * p3[i] * pw(100, 998244353 - 2) % 998244353;
  int tot = 0;
  for (int i = 1; i < n; ++i) {
    sk[++tot] = (hh){p1[i + 1] - p1[i], p2[i] + p2[i + 1], i, 1, 0};
    if (p2[i + 1] > p2[i])
      sk[++tot] = (hh){p1[i + 1] - p1[i], p2[i + 1] - p2[i], i, 0, 0};
    else if (p2[i] > p2[i + 1])
      sk[++tot] = (hh){p1[i + 1] - p1[i], p2[i] - p2[i + 1], i, 1, 1};
  }
  sort(sk + 1, sk + tot + 1);
  build(1, 1, n - 1);
  int sum = 0;
  for (int i = 1; i <= tot; ++i) {
    int x = sk[i].p;
    a[0] = 1 - p3[1];
    a[1] = p3[1];
    if (x > 1) query(1, 1, n - 1, 1, x - 1);
    a[sk[i].p1 ^ 1] = 0;
    query(1, 1, n - 1, x, x);
    a[sk[i].p2 ^ 1] = 0;
    if (x + 1 < n) query(1, 1, n - 1, x + 1, n - 1);
    sum = (sum + 1ll * (a[0] + a[1]) % 998244353 * sk[i].x % 998244353 *
                     pw(sk[i].v, 998244353 - 2)) %
          998244353;
    update(1, 1, n - 1, x, sk[i].p1, sk[i].p2);
  }
  printf("%d", (sum + 998244353) % 998244353);
}