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>
const int moder = 998244353;
using ll = long long;
struct Event {
  int id, x, y;
};
struct frac {
  ll x, y;
  explicit frac(ll x = 0, ll y = 0) : x(x), y(y) {}
  bool operator<(const frac &f) const { return x * f.y < y * f.x; }
  bool operator==(const frac &f) const { return x * f.y == y * f.x; }
};
struct matrix {
  static const int N = 2;
  int a[N][N];
  matrix() : a() {}
  int *operator[](const int &n) { return a[n]; }
  matrix operator*(const matrix &m) const {
    matrix ret;
    for (int k = 0; k < 2; ++k) {
      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          ret[i][j] = (ret[i][j] + 1ll * a[i][k] * m.a[k][j]) % moder;
        }
      }
    }
    return ret;
  }
};
const int N = 300010;
const int MAX = 1 << 17;
matrix seg[MAX << 1];
int powermod(int a, int exp) {
  int ret = 1;
  for (; exp > 0; exp >>= 1) {
    if (exp & 1) {
      ret = 1ll * ret * a % moder;
    }
    a = 1ll * a * a % moder;
  }
  return ret;
}
void add(int pos, matrix mat) {
  seg[pos += MAX] = mat;
  for (pos >>= 1; pos; pos >>= 1) {
    seg[pos] = seg[pos << 1 | 1] * seg[pos << 1];
  }
}
matrix query(int l, int r) {
  matrix retl, retr;
  for (int i = 0; i < 2; ++i) {
    retl[i][i] = retr[i][i] = 1;
  }
  for (l += MAX, r += MAX + 1; l < r; l >>= 1, r >>= 1) {
    if (l & 1) retl = seg[l++] * retl;
    if (r & 1) retr = retr * seg[--r];
  }
  return retr * retl;
}
ll x[N], v[N];
int prob[N];
std::vector<Event> event[N];
frac c[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld%d", &x[i], &v[i], &prob[i]);
    prob[i] = 1ll * prob[i] * powermod(100, moder - 2) % moder;
  }
  if (n == 1) {
    puts("0");
    return 0;
  }
  int cnt = 0;
  for (int i = 0; i < n - 1; ++i) {
    c[cnt++] = frac(x[i + 1] - x[i], v[i] + v[i + 1]);
    if (v[i] != v[i + 1]) {
      c[cnt++] = frac(x[i + 1] - x[i], std::abs(v[i] - v[i + 1]));
    }
  }
  std::sort(c, c + cnt);
  cnt = std::unique(c, c + cnt) - c;
  for (int i = 0; i < n - 1; ++i) {
    int pos =
        std::lower_bound(c, c + cnt, frac(x[i + 1] - x[i], v[i] + v[i + 1])) -
        c;
    event[pos].push_back({i, 1, 0});
    seg[i + MAX][1][0] = prob[i + 1];
    if (v[i] < v[i + 1]) {
      int pos =
          std::lower_bound(c, c + cnt,
                           frac(x[i + 1] - x[i], std::abs(v[i] - v[i + 1]))) -
          c;
      event[pos].push_back({i, 0, 0});
      seg[i + MAX][1][1] = prob[i + 1];
    } else if (v[i] > v[i + 1]) {
      int pos =
          std::lower_bound(c, c + cnt,
                           frac(x[i + 1] - x[i], std::abs(v[i] - v[i + 1]))) -
          c;
      event[pos].push_back({i, 1, 1});
      seg[i + MAX][0][0] = 1 - prob[i + 1];
      seg[i + MAX][0][0] += seg[i + MAX][0][0] < 0 ? moder : 0;
    } else {
      seg[i + MAX][0][0] = 1 - prob[i + 1];
      seg[i + MAX][0][0] += seg[i + MAX][0][0] < 0 ? moder : 0;
      seg[i + MAX][1][1] = prob[i + 1];
    }
  }
  for (int i = MAX - 1; i > 0; --i) {
    seg[i] = seg[i << 1 | 1] * seg[i << 1];
  }
  matrix mat = query(0, n - 2);
  int xx = 1 - prob[0], yy = prob[0];
  int cur = (1ll * mat[0][0] * xx + 1ll * mat[0][1] * yy +
             1ll * mat[1][0] * xx + 1ll * mat[1][1] * yy) %
            moder;
  int ans = 0, pre = cur;
  for (int i = cnt - 1; i >= 0; --i) {
    for (auto u : event[i]) {
      matrix mat = seg[u.id + MAX];
      int xx = 1 - prob[u.id + 1];
      xx += xx < 0 ? moder : 0;
      mat[u.y][u.x] = u.y == 0 ? xx : prob[u.id + 1];
      add(u.id, mat);
    }
    matrix mat = query(0, n - 2);
    int xx = 1 - prob[0], yy = prob[0];
    int cur = (1ll * mat[0][0] * xx + 1ll * mat[0][1] * yy +
               1ll * mat[1][0] * xx + 1ll * mat[1][1] * yy) %
              moder;
    int value = c[i].x * powermod(c[i].y, moder - 2) % moder;
    ans = (ans + 1ll * value * (cur - pre)) % moder;
    pre = cur;
  }
  ans += ans < 0 ? moder : 0;
  printf("%d\n", ans);
  return 0;
}