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 int Nmax = 1e5 + 5;
const int Mod = 998244353;
int X[Nmax], V[Nmax], P[Nmax];
int n, ans[3 * Nmax];
bool bad[Nmax][2][2];
static int inm(int a, int b) { return (long long)a * b % Mod; }
static void add_to(int &x, int y) {
  x += y;
  if (x >= Mod) x -= Mod;
}
static int power(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = inm(ans, a);
    a = inm(a, a);
    b >>= 1;
  }
  return ans;
}
struct frac {
  int x, y;
  int get_val() { return inm(x, power(y, Mod - 2)); }
};
struct Elem {
  frac fr;
  int id, tip;
};
vector<Elem> all;
class SegTree {
  void refresh(int node, int st, int dr) {
    int i, j, k, t;
    for (i = 0; i < 2; ++i)
      for (j = 0; j < 2; ++j) {
        a[node][i][j] = 0;
        for (k = 0; k < 2; ++k)
          for (t = 0; t < 2; ++t)
            if (!bad[((st + dr) >> 1)][k][t])
              add_to(a[node][i][j],
                     inm(a[(node << 1)][i][k], a[((node << 1) | 1)][t][j]));
      }
  }

 public:
  int a[Nmax << 2][2][2];
  void upd(int node, int st, int dr, int pos) {
    if (pos + 1 <= ((st + dr) >> 1))
      upd((node << 1), st, ((st + dr) >> 1), pos);
    else if (pos >= ((st + dr) >> 1) + 1)
      upd(((node << 1) | 1), ((st + dr) >> 1) + 1, dr, pos);
    refresh(node, st, dr);
  }
  void build(int node, int st, int dr) {
    if (st == dr) {
      a[node][0][0] = (1 - P[st] + Mod) % Mod;
      a[node][1][1] = P[st];
      a[node][0][1] = a[node][1][0] = 0;
      return;
    }
    build((node << 1), st, ((st + dr) >> 1));
    build(((node << 1) | 1), ((st + dr) >> 1) + 1, dr);
    refresh(node, st, dr);
  }
} aint;
static int get_answer() {
  return ((long long)aint.a[1][0][0] + aint.a[1][0][1] + aint.a[1][1][0] +
          aint.a[1][1][1]) %
         Mod;
}
static void block(int id, int t1, int t2) {
  assert(1 <= id && id < n);
  bad[id][t1][t2] = 1;
  aint.upd(1, 1, n, id);
}
static bool cmp(Elem a, Elem b) {
  return (long long)a.fr.x * b.fr.y < (long long)a.fr.y * b.fr.x;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int inv100 = power(100, Mod - 2);
  cin >> n;
  int i;
  for (i = 1; i <= n; ++i) {
    cin >> X[i] >> V[i] >> P[i];
    P[i] = inm(P[i], inv100);
  }
  for (i = 1; i < n; ++i) {
    frac tmp;
    if (V[i] > V[i + 1]) {
      tmp = {X[i + 1] - X[i], V[i] - V[i + 1]};
      all.push_back({tmp, i, 3});
    }
    if (V[i] < V[i + 1]) {
      tmp = {X[i + 1] - X[i], V[i + 1] - V[i]};
      all.push_back({tmp, i, 0});
    }
    tmp = {X[i + 1] - X[i], V[i] + V[i + 1]};
    all.push_back({tmp, i, 2});
  }
  sort(all.begin(), all.end(), cmp);
  aint.build(1, 1, n);
  for (i = 0; i < all.size(); ++i) {
    ans[i] = get_answer();
    auto el = all[i];
    block(el.id, el.tip / 2, el.tip % 2);
  }
  ans[all.size()] = get_answer();
  int answer = 0;
  for (i = 0; i < all.size(); ++i) {
    int ET = all[i].fr.get_val();
    add_to(answer, inm(ans[i] - ans[i + 1] + Mod, ET));
  }
  cout << answer << '\n';
  return 0;
}