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;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 100005;
const int MAXT = 270005;
const int mod = 998244353;
lint ipow(int x, int p) {
  lint ret = 1, piv = x;
  for (int i = p; i; i >>= 1) {
    if (i & 1) ret = ret * piv % mod;
    piv = piv * piv % mod;
  }
  return ret;
}
struct matrix {
  int adj[2][2];
  matrix() {
    adj[0][0] = 1;
    adj[0][1] = 0;
    adj[1][0] = 0;
    adj[1][1] = 1;
  }
  matrix operator*(const matrix &m) const {
    matrix ret;
    memset(ret.adj, 0, sizeof(ret.adj));
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        for (int k = 0; k < 2; k++) {
          ret.adj[j][k] += 1ll * adj[j][i] * m.adj[i][k] % mod;
          if (ret.adj[j][k] >= mod) ret.adj[j][k] -= mod;
        }
      }
    }
    return ret;
  }
} mtrx[MAXN];
struct seg {
  matrix tree[MAXT];
  int lim;
  void init(int n) {
    for (lim = 1; lim <= n; lim <<= 1)
      ;
    for (int i = 0; i < n; i++) tree[i + lim] = mtrx[i];
    for (int i = lim - 1; i; i--) tree[i] = tree[2 * i] * tree[2 * i + 1];
  }
  void upd(int x) {
    tree[x + lim] = mtrx[x];
    x += lim;
    for (int i = x / 2; i >= 1; i >>= 1) {
      tree[i] = tree[2 * i] * tree[2 * i + 1];
    }
  }
  lint query() {
    lint ret = 0;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        ret += tree[1].adj[i][j];
      }
    }
    return ret % mod;
  }
} seg;
struct ev {
  pi p;
  int x1, m1, x2, m2;
  bool operator<(const ev &e) const {
    return 1ll * p.first * e.p.second < 1ll * e.p.first * p.second;
  }
};
int n, x[MAXN], v[MAXN], p[MAXN];
vector<ev> event;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &x[i], &v[i], &p[i]);
  }
  lint INV100 = ipow(100, mod - 2);
  mtrx[0].adj[0][0] = (100 - p[0]) * INV100 % mod;
  mtrx[0].adj[0][1] = 0;
  mtrx[0].adj[1][0] = 0;
  mtrx[0].adj[1][1] = p[0] * INV100 % mod;
  for (int i = 1; i < n; i++) {
    pi frac1 = pi(x[i] - x[i - 1], v[i] + v[i - 1]);
    event.push_back({frac1, i - 1, 1, i, 0});
    if (v[i - 1] < v[i]) {
      frac1 = pi(x[i] - x[i - 1], v[i] - v[i - 1]);
      event.push_back({frac1, i - 1, 0, i, 0});
    }
    if (v[i - 1] > v[i]) {
      frac1 = pi(x[i] - x[i - 1], v[i - 1] - v[i]);
      event.push_back({frac1, i - 1, 1, i, 1});
    }
    mtrx[i].adj[0][0] = (100 - p[i]) * INV100 % mod;
    mtrx[i].adj[0][1] = p[i] * INV100 % mod;
    mtrx[i].adj[1][0] = (100 - p[i]) * INV100 % mod;
    mtrx[i].adj[1][1] = p[i] * INV100 % mod;
  }
  sort((event).begin(), (event).end());
  seg.init(n);
  lint ret = 0;
  for (int i = 0; i < ((int)(event).size()); i++) {
    lint cur_ans =
        1ll * event[i].p.first * ipow(event[i].p.second, mod - 2) % mod;
    lint cur_prob = seg.query();
    mtrx[event[i].x2].adj[event[i].m1][event[i].m2] = 0;
    seg.upd(event[i].x2);
    lint nxt_prob = seg.query();
    ret += cur_ans * (cur_prob - nxt_prob + mod) % mod;
    ret %= mod;
  }
  cout << ret << endl;
}