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 maxN = 101000;
pair<long long, long long> collision[maxN][2][2];
long long x[maxN];
long long p[maxN];
long long v[maxN];
const long long mod = 998244353;
long long powmod(long long a, long long x) {
  if (x == 0) {
    return 1;
  }
  if (x % 2 == 1) {
    return (a * powmod(a, x - 1)) % mod;
  }
  long long val = powmod(a, x / 2);
  return (val * val) % mod;
}
long long modinv(long long x) { return powmod(x, mod - 2); }
long long adj(long long val) { return (val % mod + mod) % mod; }
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) {
    return a + b;
  }
  if (a > b) {
    return gcd(a % b, b);
  }
  return gcd(a, b % a);
}
struct Node {
  int l, r;
  long long probs[2][2];
  bool needupdate = false;
  Node() {
    l = r = -1;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        probs[i][j] = 0;
      }
    }
    needupdate = false;
  }
  Node(int l, int r) : l(l), r(r) { needupdate = false; }
};
pair<long long, long long> forbidden;
int MODE = 0;
Node t[4 * maxN];
Node merge(const Node& a, const Node& b, int id) {
  Node result = t[id];
  result.l = a.l, result.r = b.r;
  int idx = a.r;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      long long ret = (MODE == 0) ? 0 : result.probs[i][j];
      for (int d1 = 0; d1 < 2; ++d1) {
        for (int d2 = 0; d2 < 2; ++d2) {
          if (a.probs[i][d1] == 0 || b.probs[d2][j] == 0) {
            continue;
          }
          if (MODE == 0) {
            if (collision[idx][d1][d2] != forbidden &&
                collision[idx][d1][d2] != make_pair(-1LL, -1LL)) {
              ret += adj(a.probs[i][d1] * b.probs[d2][j]);
              if (ret >= mod) {
                ret -= mod;
              }
            } else {
              collision[idx][d1][d2] = make_pair(-1, -1);
            }
          } else {
            if (collision[idx][d1][d2] == forbidden) {
              ret -= adj(a.probs[i][d1] * b.probs[d2][j]);
              if (ret >= mod) {
                ret -= mod;
              }
              collision[idx][d1][d2] = make_pair(-1, -1);
            }
          }
        }
      }
      result.probs[i][j] = ret;
    }
  }
  return result;
}
void init(int v, int ps) {
  t[v].l = t[v].r = ps;
  t[v].probs[0][1] = t[v].probs[1][0] = 0;
  t[v].probs[0][0] = adj((100 - p[ps]) * modinv(100));
  t[v].probs[1][1] = adj(p[ps] * modinv(100));
}
void build_tree(int v, int l, int r) {
  if (l == r) {
    init(v, l);
    return;
  }
  int mid = (l + r) / 2;
  build_tree(2 * v, l, mid);
  build_tree(2 * v + 1, mid + 1, r);
  t[v] = merge(t[2 * v], t[2 * v + 1], v);
}
Node get(int v, int cl, int cr, int l, int r) {
  if (l == cl && r == cr) {
    return t[v];
  }
  int mid = (l + r) / 2;
  if (r <= mid) {
    return get(2 * v, cl, mid, l, r);
  } else if (l > mid) {
    return get(2 * v + 1, mid + 1, cr, l, r);
  }
  return merge(get(2 * v, cl, mid, l, mid),
               get(2 * v + 1, mid + 1, cr, mid + 1, r), v);
}
void update(int v, int cl, int cr, int x) {
  t[v].needupdate = true;
  if (cl == cr) {
    return;
  }
  int mid = (cl + cr) / 2;
  if (x <= mid) {
    update(2 * v, cl, mid, x);
  } else {
    update(2 * v + 1, mid + 1, cr, x);
  }
}
void truupdate(int v, int cl, int cr) {
  if (!t[v].needupdate) {
    return;
  }
  t[v].needupdate = false;
  if (cl == cr) {
    return;
  }
  int mid = (cl + cr) / 2;
  truupdate(2 * v, cl, mid);
  truupdate(2 * v + 1, mid + 1, cr);
  t[v] = merge(t[2 * v], t[2 * v + 1], v);
}
pair<long long, long long> adjust(pair<long long, long long> x) {
  auto d = gcd(x.first, x.second);
  return make_pair(x.first / d, x.second / d);
}
pair<long long, long long> get_coll(int idx, int d1, int d2) {
  if (d1 == 0 && d2 == 1) {
    return make_pair(0, 1);
  }
  if (d1 == 1 && d2 == 0) {
    return adjust(make_pair(x[idx + 1] - x[idx], v[idx] + v[idx + 1]));
  }
  if (d1 == 1 && d2 == 1) {
    if (v[idx] > v[idx + 1]) {
      return adjust(make_pair(x[idx + 1] - x[idx], v[idx] - v[idx + 1]));
    } else {
      return adjust(make_pair(0, 1));
    }
  }
  if (d1 == 0 && d2 == 0) {
    if (v[idx] < v[idx + 1]) {
      return adjust(make_pair(x[idx + 1] - x[idx], v[idx + 1] - v[idx]));
    } else {
      return adjust(make_pair(0, 1));
    }
  }
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first * b.second < a.second * b.first;
}
void solve() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return;
  }
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> v[i] >> p[i];
  }
  map<pair<long long, long long>, set<int> > pts;
  for (int i = 0; i + 1 < n; ++i) {
    for (int k = 0; k < 2; ++k) {
      for (int t = 0; t < 2; ++t) {
        collision[i][k][t] = get_coll(i, k, t);
        pts[collision[i][k][t]].insert(i);
      }
    }
  }
  vector<pair<long long, long long> > d;
  for (auto x : pts) {
    d.push_back(x.first);
  }
  sort(d.begin(), d.end(), cmp);
  long long sumprev = 0;
  long long ans = 0;
  MODE = 0;
  build_tree(1, 0, n - 1);
  vector<long long> probs;
  probs.push_back(1);
  for (int i = 1; i < d.size(); ++i) {
    set<int> cur = pts[d[i]];
    forbidden = d[i];
    for (auto idx : cur) {
      update(1, 0, n - 1, idx);
    }
    truupdate(1, 0, n - 1);
    Node res = get(1, 0, n - 1, 0, n - 1);
    long long sum = 0;
    for (int d1 = 0; d1 < 2; ++d1) {
      for (int d2 = 0; d2 < 2; ++d2) {
        sum += res.probs[d1][d2];
        sum = adj(sum);
      }
    }
    if (i > 0) {
      ans += adj(d[i].first * modinv(d[i].second)) * adj(probs.back() - sum);
      ans = adj(ans);
    }
    probs.push_back(sum);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  t = 1;
  for (int tt = 0; tt < t; ++tt) {
    solve();
  }
  return 0;
}