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;
const long long int MOD = 998244353;
long long int pw(long long int a, long long int n) {
  if (n == 0) return 1;
  long long int q = pw(a, n / 2);
  if (n % 2 == 0) return q * q % MOD;
  return q * q % MOD * a % MOD;
}
struct Proton {
  long long int x, v, p;
} proton[100005];
struct Collision {
  long long int dist, v;
  int pos, dir1, dir2;
};
void debug(long long int x) {
  for (int b = 1; b <= 10000; b++) {
    long long int a = x * b % MOD;
    if (a <= 10000) {
      cout << a << "/" << b << " ";
      return;
    }
  }
}
struct Matrix {
  long long int coef[2][2];
  Matrix() { memset(coef, 0, sizeof(coef)); }
  long long int sumCoef() {
    long long int res = 0;
    for (int i = 0; i <= 1; i++) {
      for (int j = 0; j <= 1; j++) {
        res = (res + coef[i][j]) % MOD;
      }
    }
    return res;
  }
} st[400005];
long long int inv[100005][2];
void merge(int id, int mid) {
  st[id] = Matrix();
  for (int i = 0; i <= 1; i++) {
    for (int j = 0; j <= 1; j++) {
      for (int k = 0; k <= 1; k++) {
        st[id].coef[i][j] += st[id * 2].coef[i][k] * st[id * 2 + 1].coef[k][j] %
                             MOD * inv[mid + 1][k] % MOD;
        st[id].coef[i][j] %= MOD;
      }
    }
  }
}
void build(int id, int l, int r) {
  if (l == r) {
    long long int u = proton[l].p;
    long long int v = proton[l + 1].p;
    st[id].coef[0][0] = (1 - u + MOD) * (1 - v + MOD) % MOD;
    st[id].coef[0][1] = (1 - u + MOD) * v % MOD;
    st[id].coef[1][0] = u * (1 - v + MOD) % MOD;
    st[id].coef[1][1] = u * v % MOD;
    return;
  }
  int mid = (l + r) / 2;
  build(id * 2, l, mid);
  build(id * 2 + 1, mid + 1, r);
  merge(id, mid);
}
void update(int id, int l, int r, int u, int i, int j) {
  if (l == r) {
    st[id].coef[i][j] = 0;
    return;
  }
  int mid = (l + r) / 2;
  if (u <= mid)
    update(id * 2, l, mid, u, i, j);
  else
    update(id * 2 + 1, mid + 1, r, u, i, j);
  merge(id, mid);
}
long long int query() {
  long long int res = 0;
  for (int i = 0; i <= 1; i++) {
    for (int j = 0; j <= 1; j++) {
      res = (res + st[1].coef[i][j]) % MOD;
    }
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  long long int rev100 = pw(100, MOD - 2);
  for (int i = 1; i <= n; i++) {
    cin >> proton[i].x >> proton[i].v >> proton[i].p;
    proton[i].p = proton[i].p * rev100 % MOD;
    inv[i][1] = pw(proton[i].p, MOD - 2);
    inv[i][0] = pw(1 + MOD - proton[i].p, MOD - 2);
  }
  vector<Collision> collision;
  for (int i = 1; i <= n - 1; i++) {
    Collision c1 = {0, 0, i, 0, 0};
    Collision c2 = c1;
    c1.dist = c2.dist = proton[i + 1].x - proton[i].x;
    c1.v = proton[i].v + proton[i + 1].v;
    c1.dir1 = 1, c1.dir2 = 0;
    collision.push_back(c1);
    c2.v = abs(proton[i + 1].v - proton[i].v);
    if (proton[i].v > proton[i + 1].v) {
      c2.dir1 = 1;
      c2.dir2 = 1;
    }
    if (proton[i].v < proton[i + 1].v) {
      c2.dir1 = c2.dir2 = 0;
    }
    if (c2.v) {
      collision.push_back(c2);
    }
  }
  sort(collision.begin(), collision.end(),
       [](Collision a, Collision b) { return a.dist * b.v < b.dist * a.v; });
  build(1, 1, n - 1);
  long long int last = 1;
  long long int res = 0;
  for (auto c : collision) {
    long long int time = c.dist * pw(c.v, MOD - 2) % MOD;
    update(1, 1, n - 1, c.pos, c.dir1, c.dir2);
    long long int newLast = query();
    long long int prob = (last - newLast + MOD) % MOD;
    last = newLast;
    prob %= MOD;
    res = (res + prob * time % MOD) % MOD;
  }
  cout << res << endl;
  return 0;
}