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, x[100005], v[100005];
long long p[2][100005];
vector<vector<long long> > mat[100005], tree[400005];
void mul(vector<vector<long long> > &a, vector<vector<long long> > &b,
         vector<vector<long long> > &c) {
  if (c.empty())
    c = vector<vector<long long> >(a.size(), vector<long long>(b[0].size(), 0));
  for (int i = 0; i < a.size(); i++) {
    for (int x = 0; x < b[0].size(); x++) {
      c[i][x] = 0;
      for (int j = 0; j < b.size(); j++)
        c[i][x] = (c[i][x] + a[i][j] * b[j][x]) % 998244353;
    }
  }
}
long long pow_log(long long x, int y) {
  if (!y) return 1;
  long long ret = pow_log(x, y / 2);
  ret = (ret * ret) % 998244353;
  if (y % 2) ret = (ret * x) % 998244353;
  return ret;
}
struct fraction {
  long long a, b;
  fraction(long long aa, long long bb) {
    a = aa;
    b = bb;
  }
  bool operator<(const fraction &c) const { return a * c.b < b * c.a; }
};
void build(int node, int st, int en) {
  if (st == en)
    tree[node] = mat[st];
  else {
    int mid = (st + en) / 2;
    build(2 * node, st, mid);
    build(2 * node + 1, mid + 1, en);
    mul(tree[2 * node], tree[2 * node + 1], tree[node]);
  }
}
void update(int node, int st, int en, int idx) {
  if (st == en)
    tree[node] = mat[idx];
  else {
    int mid = (st + en) / 2;
    if (st <= idx && idx <= mid)
      update(2 * node, st, mid, idx);
    else
      update(2 * node + 1, mid + 1, en, idx);
    mul(tree[2 * node], tree[2 * node + 1], tree[node]);
  }
}
vector<pair<pair<fraction, int>, pair<int, int> > > e;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%I64d", &x[i], &v[i], &p[0][i]);
    p[0][i] = (p[0][i] * pow_log(100, 998244353 - 2)) % 998244353;
    p[1][i] = (1 - p[0][i] + 998244353) % 998244353;
  }
  for (int i = 0; i < n; i++) {
    mat[i] =
        vector<vector<long long> >({{p[0][i], p[0][i]}, {p[1][i], p[1][i]}});
    if (i == n - 1) break;
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        if (v[i] > v[i + 1])
          e.push_back(
              {{fraction(x[i + 1] - x[i], v[i] - v[i + 1]), i}, {j, k}});
        v[i + 1] *= -1;
      }
      v[i] *= -1;
    }
  }
  build(1, 0, n - 1);
  sort(e.begin(), e.end());
  long long ans = 0;
  for (auto j : e) {
    int idx = j.first.second;
    long long t1 = 0, t2 = 0, t3 = 0, t4 = 0;
    swap(mat[idx][!j.second.first][0], t1);
    swap(mat[idx][!j.second.first][1], t2);
    swap(mat[idx + 1][!j.second.second][0], t3);
    swap(mat[idx + 1][!j.second.second][1], t4);
    update(1, 0, n - 1, idx);
    if (idx != n - 1) update(1, 0, n - 1, idx + 1);
    long long prob =
        (tree[1][0][0] + tree[1][0][1] + tree[1][1][0] + tree[1][1][1]) *
        (998244353 + 1) / 2 % 998244353;
    ans = (ans + prob * j.first.first.a % 998244353 *
                     pow_log(j.first.first.b, 998244353 - 2)) %
          998244353;
    swap(mat[idx][!j.second.first][0], t1);
    swap(mat[idx][!j.second.first][1], t2);
    swap(mat[idx + 1][!j.second.second][0], t3);
    swap(mat[idx + 1][!j.second.second][1], t4);
    mat[idx][j.second.first][j.second.second] = 0;
    update(1, 0, n - 1, idx);
    if (idx != n - 1) update(1, 0, n - 1, idx + 1);
  }
  printf("%I64d", ans);
}