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;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) os << ", ";
    os << v[i];
  }
  os << "}";
  return os;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
struct Data {
  int ways[2][2];
  Data() { memset(ways, 0, sizeof ways); }
};
const int mod = 998244353;
inline int add(int x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline int sub(int x, int y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline int mul(int x, int y) { return (x * 1ll * y) % mod; }
inline int powr(int a, long long b) {
  int x = 1 % mod;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a) { return powr(a, mod - 2); }
const int N = 200005;
Data T[N << 2];
int p[N][2];
int cond[N];
Data merge(const Data& P, const Data& Q, int mid) {
  int t = cond[mid];
  int right_left_banned = t >> 0 & 1;
  int right_right_banned = t >> 1 & 1;
  int left_left_banned = t >> 2 & 1;
  Data ret;
  for (int j = 0; j < 2; j++) {
    for (int k = 0; k < 2; k++) {
      if (right_left_banned && j && !k) continue;
      if (right_right_banned && j && k) continue;
      if (left_left_banned && !j && !k) continue;
      for (int i = 0; i < 2; i++) {
        for (int l = 0; l < 2; l++) {
          ret.ways[i][l] = add(ret.ways[i][l], mul(P.ways[i][j], Q.ways[k][l]));
        }
      }
    }
  }
  return ret;
}
void make(int s, int e, int ind = 1) {
  if (s == e) {
    for (int d = 0; d < 2; d++) T[ind].ways[d][d] = p[s][d];
    return;
  }
  int mid = (s + e) >> 1;
  make(s, mid, ind << 1);
  make(mid + 1, e, ind << 1 | 1);
  T[ind] = merge(T[ind << 1], T[ind << 1 | 1], mid);
}
void update(int i, int s, int e, int ind = 1) {
  if (s == e) return;
  int mid = (s + e) >> 1;
  if (i <= mid)
    update(i, s, mid, ind << 1);
  else
    update(i, mid + 1, e, ind << 1 | 1);
  T[ind] = merge(T[ind << 1], T[ind << 1 | 1], mid);
}
int getAns() {
  int ret = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) ret = add(ret, T[1].ways[i][j]);
  return ret;
}
int x[N], v[N];
vector<pair<int, int> > vec;
int main() {
  int n;
  scanf("%d", &(n));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &(x[i]));
    scanf("%d", &(v[i]));
    scanf("%d", &(p[i][1]));
    p[i][1] = mul(p[i][1], inv(100));
    p[i][0] = sub(1, p[i][1]);
  }
  for (int i = 1; i < n; i++) {
    vec.push_back({i, 0});
    if (v[i] > v[i + 1])
      vec.push_back({i, 1});
    else if (v[i] < v[i + 1])
      vec.push_back({i, 2});
  }
  sort(((vec).begin()), ((vec).end()),
       [&](const pair<int, int>& X, const pair<int, int>& Y) {
         int i = X.first, j = Y.first;
         int t1 = X.second, t2 = Y.second;
         int d1 = x[i + 1] - x[i];
         int d2 = x[j + 1] - x[j];
         int vel_1 = t1 == 0 ? v[i] + v[i + 1] : abs(v[i] - v[i + 1]);
         int vel_2 = t2 == 0 ? v[j] + v[j + 1] : abs(v[j] - v[j + 1]);
         return (d1 * (long long)vel_2) < (d2 * (long long)vel_1);
       });
  make(1, n);
  int currProb = getAns();
  int ans = 0;
  for (auto it : vec) {
    int i = it.first, type = it.second;
    int D = x[i + 1] - x[i];
    int V = type == 0 ? v[i] + v[i + 1] : abs(v[i] - v[i + 1]);
    cond[i] |= (1 << type);
    update(i, 1, n);
    int newProb = getAns();
    ans = add(ans, mul(sub(currProb, newProb), mul(D, inv(V))));
    currProb = newProb;
  }
  printf("%d\n", ans);
}