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>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;
const int seed = 233;
const double PI = acos(-1.0);
const double eps = 1e-7;
const int inf = 0x3f3f3f3f;
const int max_n = 100005;
long long ceil(long long x, long long y) {
  if (x == 0) return 0;
  if (y < 0) x = -x, y = -y;
  bool sign = x > 0;
  x = abs(x);
  return sign ? (x + y - 1) / y : -x / y;
}
long long floor(long long x, long long y) {
  if (x == 0) return 0;
  if (y < 0) x = -x, y = -y;
  bool sign = x > 0;
  x = abs(x);
  return sign ? x / y : -(x + y - 1) / y;
}
char str[max_n];
namespace {
inline int Add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int Sub(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
inline int Mul(int x, int y) { return 1ll * x * y % mod; }
inline int Pow(int x, int y = mod - 2) {
  int res = 1;
  while (y) {
    if (y & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    y >>= 1;
  }
  return res;
}
}  // namespace
struct Frac {
  int x, y;
  Frac() {}
  Frac(int x, int y) : x(x), y(y) {}
  bool operator<(Frac f) const { return 1ll * x * f.y < 1ll * f.x * y; }
};
struct Node {
  Frac tim;
  int pos, dl, dr;
  Node(Frac tim, int pos, int dl, int dr)
      : tim(tim), pos(pos), dl(dl), dr(dr) {}
  bool operator<(Node e) const { return tim < e.tim; }
};
int n;
int x[max_n], v[max_n], p[max_n];
vector<Node> event;
int pro[max_n * 3];
struct Seg {
  struct Mat {
    int a[2][2];
    Mat operator*(Mat b) {
      Mat c;
      for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
          c.a[i][j] = 0;
          for (int k = 0; k < 2; k++)
            c.a[i][j] = Add(c.a[i][j], Mul(a[i][k], b.a[k][j]));
        }
      }
      return c;
    }
  };
  Mat d[1 << 19];
  void build(int l, int r, int rt) {
    if (l == r) {
      d[rt].a[0][1] = d[rt].a[1][1] = p[l];
      d[rt].a[0][0] = d[rt].a[1][0] = Sub(1, p[l]);
      return;
    }
    int mid = l + r >> 1;
    build(l, mid, rt << 1), build(mid + 1, r, rt << 1 | 1);
    pushup(rt);
  }
  void pushup(int rt) { d[rt] = d[rt << 1] * d[rt << 1 | 1]; }
  void update(int x, int dl, int dr, int l, int r, int rt) {
    if (l == r) {
      d[rt].a[dl][dr] = 0;
      return;
    }
    int mid = l + r >> 1;
    if (x <= mid)
      update(x, dl, dr, l, mid, rt << 1);
    else
      update(x, dl, dr, mid + 1, r, rt << 1 | 1);
    pushup(rt);
  }
  int query() { return Add(d[1].a[0][0], d[1].a[0][1]); }
  void test() {
    Mat a, b;
    a.a[0][0] = a.a[1][0] = 0;
    a.a[0][1] = a.a[1][1] = 1;
    b.a[0][0] = 0;
    b.a[0][1] = b.a[1][0] = b.a[1][1] = 0;
    Mat c = a * b;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) cout << c.a[i][j] << ' ';
      cout << endl;
    }
  }
  void show(int x) {
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) cout << d[x].a[i][j] << ' ';
      cout << endl;
    }
  }
} Tree;
int inv100 = Pow(100, mod - 2);
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", x + i, v + i, p + i), p[i] = Mul(p[i], inv100);
  for (int i = 2; i <= n; i++) {
    event.emplace_back(Frac{x[i] - x[i - 1], v[i] + v[i - 1]}, i, 1, 0);
    if (v[i] > v[i - 1])
      event.emplace_back(Frac{x[i] - x[i - 1], v[i] - v[i - 1]}, i, 0, 0);
    if (v[i] < v[i - 1])
      event.emplace_back(Frac{x[i] - x[i - 1], v[i - 1] - v[i]}, i, 1, 1);
  }
  Tree.build(1, n, 1);
  sort(event.begin(), event.end());
  int tot = event.size();
  for (int i = 0; i < tot; i++) {
    pro[i] = Tree.query();
    int pos = event[i].pos, dl = event[i].dl, dr = event[i].dr;
    Tree.update(pos, dl, dr, 1, n, 1);
  }
  pro[tot] = Tree.query();
  int ans = 0;
  for (int i = 0; i < tot; i++) {
    int tp = Sub(pro[i], pro[i + 1]);
    Frac tim = event[i].tim;
    int tt = Mul(tim.x, Pow(tim.y, mod - 2));
    ans = Add(ans, Mul(tp, tt));
  }
  printf("%d\n", ans);
  return 0;
}