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 mod = 998244353;
int sum(int first, int second) {
  if (first + second < 0) return first + second + mod;
  if (first + second >= mod) return first + second - mod;
  return first + second;
}
int mult(int first, int second) { return ((long long)first * second) % mod; }
struct Proton {
  int first;
  int v;
  int p_right;
  int p_left;
};
int pw(int first, int second) {
  if (second == 0) return 1;
  if (second == 1) return first % mod;
  if (second % 2) return mult(first, pw(first, second - 1));
  int t = pw(first, second / 2);
  return mult(t, t);
}
struct Event {
  long long dx;
  long long dt;
  int index;
  int type;
};
bool cmp(Event &a, Event &b) {
  long long A = a.dx * b.dt, B = a.dt * b.dx;
  return (A < B);
}
struct Vertex {
  int f;
  int r;
  int L;
  int R;
};
vector<Vertex> snm;
int get(int v) {
  if (snm[v].f != v) snm[v].f = get(snm[v].f);
  return snm[v].f;
}
void unite(int u, int v) {
  if (snm[u].r > snm[v].r) swap(u, v);
  snm[u].f = v;
  if (snm[u].r == snm[v].r) snm[v].r++;
  snm[v].L = min(snm[v].L, snm[u].L);
  snm[v].R = max(snm[v].R, snm[u].R);
}
struct RMQ {
  int mult_left;
  int mult_right;
  int mult_spec;
};
vector<RMQ> rmq;
void change(RMQ &res, RMQ &a, RMQ &b) {
  res.mult_left = mult(a.mult_left, b.mult_left);
  res.mult_right = mult(a.mult_right, b.mult_right);
  int A = sum(mult(a.mult_left, b.mult_spec), mult(a.mult_spec, b.mult_right));
  A = sum(A, -mult(a.mult_left, b.mult_right));
  res.mult_spec = A;
}
void build(int i, int l, int r, vector<Proton> &v) {
  if (r - l == 1) {
    rmq[i] = {v[l].p_left, v[l].p_right, 1};
    return;
  }
  int mid = (l + r) / 2;
  build(2 * i + 1, l, mid, v);
  build(2 * i + 2, mid, r, v);
  change(rmq[i], rmq[2 * i + 1], rmq[2 * i + 2]);
}
bool Y = false;
RMQ subl;
int n;
void get(int i, int l, int r, int l1, int r1) {
  if (l1 >= r1) return;
  if (l == l1 && r == r1) {
    if (!Y) {
      Y = true;
      subl = rmq[i];
      return;
    }
    RMQ cp = subl;
    change(subl, cp, rmq[i]);
    return;
  }
  int mid = (l + r) / 2;
  get(2 * i + 1, l, mid, l1, min(r1, mid));
  get(2 * i + 2, mid, r, max(l1, mid), r1);
}
int get_res(multiset<int> &left, multiset<int> &right, int index) {
  int G = get(index);
  int l = snm[G].L, r = snm[G].R;
  int must_l = 0, must_r = 0;
  if (left.size()) {
    auto it = left.upper_bound(r);
    if (it != left.begin()) {
      it--;
      int first = (*it);
      if (first >= l && first <= r) {
        must_l = first - l + 1;
      }
    }
  }
  if (right.size()) {
    auto it = right.upper_bound(l - 1);
    if (it != right.end()) {
      int first = (*it);
      if (first >= l && first <= r) {
        must_r = r - first + 1;
      }
    }
  }
  if (must_l + must_r > r - l + 1) return 0;
  int Q = 1;
  if (must_l != 0) {
    Y = false;
    get(0, 0, n, l, l + must_l);
    Q = mult(Q, subl.mult_left);
  }
  if (must_r != 0) {
    Y = false;
    get(0, 0, n, r - must_r + 1, r + 1);
    Q = mult(Q, subl.mult_right);
  }
  if (must_l + must_r != r - l + 1) {
    Y = false;
    get(0, 0, n, l + must_l, r - must_r + 1);
    Q = mult(Q, subl.mult_spec);
  }
  return Q;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  vector<Proton> v;
  int T = pw(100, mod - 2);
  for (int i = 0; i < n; ++i) {
    Proton first;
    cin >> first.first >> first.v;
    int p;
    cin >> p;
    first.p_right = mult(p, T), first.p_left = mult(100 - p, T);
    v.push_back(first);
  }
  rmq.assign(4 * n, {});
  build(0, 0, n, v);
  vector<Event> ev;
  for (int i = 0; i < n - 1; ++i) {
    long long sum = v[i].v + v[i + 1].v;
    long long delta = abs(v[i].first - v[i + 1].first);
    ev.push_back({delta, sum, i, 1});
    sum = max(v[i].v, v[i + 1].v) - min(v[i].v, v[i + 1].v);
    if (sum != 0) {
      ev.push_back({delta, sum, i, 2});
    }
  }
  sort(ev.begin(), ev.end(), cmp);
  for (int i = 0; i < n; ++i) {
    snm.push_back({i, 1, i, i});
  }
  int ans = 0;
  int current = 1;
  multiset<int> left, right;
  for (int i = 0; i < ev.size(); ++i) {
    int type = ev[i].type;
    int index = ev[i].index;
    if (type == 1) {
      int A = get_res(left, right, index);
      int B = get_res(left, right, index + 1);
      current = mult(current, pw(A, mod - 2));
      current = mult(current, pw(B, mod - 2));
      int tut = current;
      right.insert(index), left.insert(index + 1);
      A = get_res(left, right, index);
      B = get_res(left, right, index + 1);
      tut = mult(tut, mult(A, B));
      ans = sum(ans, mult(tut, mult(ev[i].dx, pw(ev[i].dt, mod - 2))));
      unite(get(index), get(index + 1));
      right.erase(right.find(index));
      left.erase(left.find(index + 1));
      current = mult(current, get_res(left, right, index));
    } else {
      int A = get_res(left, right, index);
      current = mult(current, pw(A, mod - 2));
      int tut = current;
      if (v[index].v > v[index + 1].v) {
        right.insert(index);
        right.insert(index + 1);
        A = get_res(left, right, index);
        tut = mult(tut, A);
        ans = sum(ans, mult(tut, mult(ev[i].dx, pw(ev[i].dt, mod - 2))));
        right.erase(right.find(index));
        right.erase(right.find(index + 1));
        left.insert(index);
        current = mult(current, get_res(left, right, index));
      } else {
        left.insert(index);
        left.insert(index + 1);
        A = get_res(left, right, index);
        tut = mult(tut, A);
        ans = sum(ans, mult(tut, mult(ev[i].dx, pw(ev[i].dt, mod - 2))));
        left.erase(left.find(index));
        left.erase(left.find(index + 1));
        right.insert(index + 1);
        current = mult(current, get_res(left, right, index));
      }
    }
  }
  cout << ans;
}