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 N = 1e5 + 7;
const int MOD = 998244353;
int add(int a, int b) {
  int res = a + b;
  if (res >= MOD) {
    return res - MOD;
  } else {
    return res;
  }
}
int sub(int a, int b) {
  if (a - b < 0) {
    return a - b + MOD;
  } else {
    return a - b;
  }
}
int mul(int a, int b) { return ((long long)a * b) % MOD; }
int binpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
int divv(int a, int b) { return mul(a, binpow(b, MOD - 2)); }
struct Proton {
  int x;
  int p;
  int v;
  Proton(int x_, int p_, int v_) {
    x = x_;
    p = p_;
    v = v_;
  }
  Proton() {}
};
struct Frac {
  int p;
  int q;
  Frac(int p_, int q_) {
    p = p_;
    q = q_;
  }
  bool operator<(const Frac &other) const {
    return (long long)p * other.q < (long long)other.p * q;
  }
  Frac() {}
};
struct Event {
  Frac time;
  int pos;
  int ban_mask;
  Event(Frac time_, int pos_, int ban_mask_) {
    time = time_;
    pos = pos_;
    ban_mask = ban_mask_;
  }
  bool operator<(const Event &other) const { return time < other.time; }
};
int is_ban[N][4];
int gm(int f, int s) { return f + 2 * s; }
struct Node {
  int l, r;
  vector<int> prob;
  friend Node conq(const Node &a, const Node &b) {
    if (a.l == -1 && a.r == -1) {
      return b;
    }
    if (b.l == -1 && b.r == -1) {
      return a;
    }
    vector<int> np(4);
    for (int f = 0; f < 4; f++) {
      for (int s = 0; s < 4; s++) {
        int nm = gm(f & 1, (s >> 1) & 1);
        int bm = gm((f >> 1) & 1, s & 1);
        if (!is_ban[b.l][bm]) {
          np[nm] = add(np[nm], mul(a.prob[f], b.prob[s]));
        }
      }
    }
    return Node(a.l, b.r, np);
  }
  Node() {
    l = -1;
    r = -1;
    prob.resize(4);
  }
  Node(int l_, int r_, vector<int> prob_) {
    l = l_;
    r = r_;
    prob = prob_;
  }
  Node(int p, int pos) {
    l = pos;
    r = pos;
    prob.resize(4);
    prob[gm(0, 0)] = p;
    prob[gm(1, 1)] = sub(1, p);
  }
};
namespace SegementTree {
int n;
Node t[4 * N];
void pull(int v) { t[v] = conq(t[2 * v + 1], t[2 * v + 2]); }
void query(int v, int l, int r, int pos) {
  if (l + 1 == r) {
    return;
  } else {
    int m = (r + l) >> 1;
    if (pos < m) {
      query(2 * v + 1, l, m, pos);
    } else {
      query(2 * v + 2, m, r, pos);
    }
    pull(v);
  }
}
void build(int v, int l, int r, vector<Proton> &p) {
  if (l + 1 == r) {
    t[v] = Node(p[l].p, l);
  } else {
    int m = (r + l) >> 1;
    build(2 * v + 1, l, m, p);
    build(2 * v + 2, m, r, p);
    pull(v);
  }
}
void add_ban(int pos, int ban_mask) {
  is_ban[pos][ban_mask] = 1;
  query(0, 0, n, pos);
}
void init(vector<Proton> &p) {
  n = (int)p.size();
  build(0, 0, n, p);
}
int get() {
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    ans = add(ans, t[0].prob[i]);
  }
  return ans;
}
}  // namespace SegementTree
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<Proton> a(n);
  for (auto &t : a) {
    cin >> t.x >> t.v >> t.p;
    t.p = 100 - t.p;
    t.p = divv(t.p, 100);
  }
  vector<Event> events;
  for (int i = 0; i + 1 < n; i++) {
    int dx = a[i + 1].x - a[i].x;
    int dv = abs(a[i].v - a[i + 1].v);
    events.emplace_back(Frac(dx, a[i].v + a[i + 1].v), i + 1, gm(1, 0));
    int rm = -1;
    if (a[i].v < a[i + 1].v) {
      rm = gm(0, 0);
    } else if (a[i].v > a[i + 1].v) {
      rm = gm(1, 1);
    }
    if (rm != -1) {
      events.emplace_back(Frac(dx, dv), i + 1, rm);
    }
  }
  sort(events.begin(), events.end());
  vector<int> probs((int)events.size() + 1);
  probs[0] = 1;
  SegementTree::init(a);
  for (int i = 0; i < (int)events.size(); i++) {
    SegementTree::add_ban(events[i].pos, events[i].ban_mask);
    probs[i + 1] = SegementTree::get();
  }
  int ans = 0;
  for (int i = 0; i < (int)events.size(); i++) {
    int pr = sub(probs[i], probs[i + 1]);
    int rt = divv(events[i].time.p, events[i].time.q);
    ans = add(ans, mul(rt, pr));
  }
  cout << ans << endl;
}