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
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353, N = 1E5 + 5, MX = 2E6 + 5;
int n, x[N], v[N], pos[N];
long long ans = 0, inv[MX], p[N][2], ip[N][2];
struct fraction {
  long long x, y;
  fraction(long long _x = 0, long long _y = 1) : x(_x), y(_y) {}
  bool operator<(const fraction &oth) const {
    return 1LL * x * oth.y < 1LL * y * oth.x;
  }
};
vector<tuple<fraction, int, int>> ve;
struct node {
  long long val[4];
  int l, r;
  node(int _l = 0, int _r = 0) : l(_l), r(_r) { fill(val, val + 4, 0); }
  node operator+(const node &oth) const {
    node ans(l, oth.r);
    for (int msk = 0; msk < 4; msk++) {
      for (int i = 0; i < 2; i++) {
        (ans.val[(msk & 2) | i] += val[msk] * oth.val[((msk & 1) << 1) | i] %
                                   MOD * ip[oth.l][msk & 1]) %= MOD;
      }
    }
    return ans;
  }
};
struct segment_tree {
  node tr[4 * N];
  void build(int l, int r, int i) {
    if (l == r) {
      tr[i] = node(l, l);
      pos[l] = i;
      for (int msk = 0; msk < 4; msk++) {
        tr[i].val[msk] = p[l][msk >> 1] * p[l + 1][msk & 1] % MOD;
      }
    } else {
      build(l, (l + r) / 2, i * 2);
      build((l + r) / 2 + 1, r, i * 2 + 1);
      tr[i] = tr[i * 2] + tr[i * 2 + 1];
    }
  }
  void update(int l, int r, int i, int u, node val) {
    if (l == r) {
      tr[i] = val;
    } else {
      if (u <= (l + r) / 2) {
        update(l, (l + r) / 2, i * 2, u, val);
      } else {
        update((l + r) / 2 + 1, r, i * 2 + 1, u, val);
      }
      tr[i] = tr[i * 2] + tr[i * 2 + 1];
    }
  }
} seg;
void init() {
  inv[1] = 1;
  for (int i = 2; i < MX; i++) {
    inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  init();
  cin >> n;
  if (n == 1) {
    return cout << 0, 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> v[i] >> p[i][1];
    p[i][0] = 100 - p[i][1];
    for (int j = 0; j < 2; j++) {
      ip[i][j] = 100 * inv[p[i][j]] % MOD;
      (p[i][j] *= inv[100]) %= MOD;
    }
  }
  for (int i = 1; i < n; i++) {
    ve.push_back({fraction(x[i + 1] - x[i], v[i] + v[i + 1]), i, 2});
    if (v[i] > v[i + 1]) {
      ve.push_back({fraction(x[i + 1] - x[i], v[i] - v[i + 1]), i, 3});
    } else if (v[i] < v[i + 1]) {
      ve.push_back({fraction(x[i + 1] - x[i], v[i + 1] - v[i]), i, 0});
    }
  }
  sort(ve.begin(), ve.end());
  seg.build(1, n - 1, 1);
  for (auto [fr, in, v] : ve) {
    node cur = seg.tr[pos[in]];
    node tmp = cur;
    for (int i = 0; i < 4; i++) {
      if (i != v) {
        tmp.val[i] = 0;
      }
    }
    seg.update(1, n - 1, 1, in, tmp);
    node &rt = seg.tr[1];
    long long sum = (rt.val[0] + rt.val[1] + rt.val[2] + rt.val[3]) % MOD;
    (ans += sum * fr.x % MOD * inv[fr.y]) %= MOD;
    cur.val[v] = 0;
    seg.update(1, n - 1, 1, in, cur);
  }
  cout << ans;
}
