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;
int X[101010], V[101010], P[101010];
const signed long long mo = 998244353;
struct mat {
  signed long long p[2][2];
};
mat val[1 << 19];
mat mul(mat& L, mat& R) {
  mat V;
  int x, y;
  for (x = 0; x < (2); x++)
    for (y = 0; y < (2); y++)
      V.p[x][y] = (L.p[x][0] * R.p[0][y] + L.p[x][1] * R.p[1][y]) % mo;
  return V;
}
signed long long modpow(signed long long a, signed long long n = mo - 2) {
  signed long long r = 1;
  a %= mo;
  while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a % mo, n >>= 1;
  return r;
}
bool cmp(vector<int>& L, vector<int>& R) {
  return 1LL * L[0] * R[1] < 1LL * R[0] * L[1];
}
vector<vector<int>> cand;
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) {
    cin >> X[i] >> V[i] >> P[i];
    val[i + (1 << 18)].p[0][0] = val[i + (1 << 18)].p[0][1] =
        (100 - P[i]) * modpow(100) % mo;
    val[i + (1 << 18)].p[1][0] = val[i + (1 << 18)].p[1][1] =
        P[i] * modpow(100) % mo;
  }
  for (i = N; i < 1 << 18; i++)
    val[i + (1 << 18)].p[1][0] = val[i + (1 << 18)].p[1][1] = 1;
  for (i = (1 << 18) - 1; i >= 1; i--) val[i] = mul(val[2 * i], val[2 * i + 1]);
  for (i = 0; i < (N - 1); i++) {
    if (V[i] < V[i + 1])
      cand.push_back({(X[i + 1] - X[i]), V[i + 1] - V[i], i, 0, 0});
    if (V[i] > V[i + 1])
      cand.push_back({(X[i + 1] - X[i]), V[i] - V[i + 1], i, 1, 1});
    cand.push_back({(X[i + 1] - X[i]), (V[i] + V[i + 1]), i, 1, 0});
  }
  sort((cand.begin()), (cand.end()), cmp);
  signed long long ret = 0;
  signed long long pre = 0;
  for (auto& c : cand) {
    signed long long P = (val[1].p[0][1] + val[1].p[1][1]) % mo;
    i = (c[2] + (1 << 18));
    val[i].p[c[3]][c[4]] = 0;
    while (i > 1) {
      i /= 2;
      val[i] = mul(val[2 * i], val[2 * i + 1]);
    }
    signed long long Q = (val[1].p[0][1] + val[1].p[1][1]) % mo;
    P = (P - Q + mo) % mo;
    signed long long tim = c[0] * modpow(c[1]) % mo;
    (ret += P * (tim - pre + mo)) %= mo;
  }
  cout << ret << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}