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 <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
  i >> p.first >> p.second;
  return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
  for (auto& v : t) {
    i >> v;
  }
  return i;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& o, const pair<T, U>& p) {
  o << p.first << ' ' << p.second;
  return o;
}
template <typename T>
std::ostream& operator<<(std::ostream& o, const vector<T>& t) {
  if (t.empty()) o << '\n';
  for (size_t i = 0; i < t.size(); ++i) {
    o << t[i] << " \n"[i == t.size() - 1];
  }
  return o;
}
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
unsigned int logceil(long long first) {
  return first ? 8 * sizeof(long long) - __builtin_clzll(first) : 0;
}
namespace std {
template <typename T, typename U>
struct hash<pair<T, U>> {
  hash<T> t;
  hash<U> u;
  size_t operator()(const pair<T, U>& p) const {
    return t(p.first) ^ (u(p.second) << 7);
  }
};
}  // namespace std
template <typename T, typename F>
T bsh(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      l = m + 1;
      r = m;
    } else {
      h = m - 1;
    }
  }
  return r;
}
template <typename F>
double bshd(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      l = m;
    } else {
      h = m;
    }
  }
  return (l + h) / 2;
}
template <typename T, typename F>
T bsl(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      h = m - 1;
      r = m;
    } else {
      l = m + 1;
    }
  }
  return r;
}
template <typename F>
double bsld(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      h = m;
    } else {
      l = m;
    }
  }
  return (l + h) / 2;
}
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
template <typename T>
class vector2 : public vector<vector<T>> {
 public:
  vector2() {}
  vector2(size_t a, size_t b, T t = T())
      : vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T>
class vector3 : public vector<vector2<T>> {
 public:
  vector3() {}
  vector3(size_t a, size_t b, size_t c, T t = T())
      : vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T>
class vector4 : public vector<vector3<T>> {
 public:
  vector4() {}
  vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
      : vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T>
class vector5 : public vector<vector4<T>> {
 public:
  vector5() {}
  vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
      : vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
template <unsigned int N>
class Field {
  inline unsigned int pow(unsigned int a, unsigned int p) {
    unsigned int r = 1, e = a;
    while (p) {
      if (p & 1) {
        r = ((unsigned long long)r * e) % N;
      }
      e = ((unsigned long long)e * e) % N;
      p >>= 1;
    }
    return r;
  }
  inline unsigned int inv(unsigned int a) { return pow(a, N - 2); }

 public:
  inline Field(int first = 0) : v(first) {}
  inline Field<N> pow(int p) { return (*this) ^ p; }
  inline Field<N> operator^(int p) { return {(int)pow(v, (unsigned int)p)}; }
  inline Field<N>& operator+=(const Field<N>& o) {
    if (v + o.v >= N)
      v += o.v - N;
    else
      v += o.v;
    return *this;
  }
  inline Field<N>& operator-=(const Field<N>& o) {
    if (v < o.v)
      v -= o.v - N;
    else
      v -= o.v;
    return *this;
  }
  inline Field<N>& operator*=(const Field<N>& o) {
    v = (unsigned long long)v * o.v % N;
    return *this;
  }
  inline Field<N>& operator/=(const Field<N>& o) { return *this *= inv(o.v); }
  inline Field<N> operator+(const Field<N>& o) const {
    Field<N> r{*this};
    return r += o;
  }
  inline Field<N> operator-(const Field<N>& o) const {
    Field<N> r{*this};
    return r -= o;
  }
  inline Field<N> operator*(const Field<N>& o) const {
    Field<N> r{*this};
    return r *= o;
  }
  inline Field<N> operator/(const Field<N>& o) const {
    Field<N> r{*this};
    return r /= o;
  }
  inline Field<N> operator-() {
    if (v)
      return {(int)(N - v)};
    else
      return {0};
  };
  inline Field<N>& operator++() {
    ++v;
    if (v == N) v = 0;
    return *this;
  }
  inline Field<N> operator++(int) {
    Field<N> r{*this};
    ++*this;
    return r;
  }
  inline Field<N>& operator--() {
    --v;
    if (v == -1) v = N - 1;
    return *this;
  }
  inline Field<N> operator--(int) {
    Field<N> r{*this};
    --*this;
    return r;
  }
  inline bool operator==(const Field<N>& o) const { return o.v == v; }
  inline bool operator!=(const Field<N>& o) const { return o.v != v; }
  inline explicit operator unsigned int() const { return v; }
  inline static vector<Field<N>> fact(int t) {
    vector<Field<N>> F(t + 1, 1);
    for (int i = 2; i <= t; ++i) {
      F[i] = F[i - 1] * i;
    }
    return F;
  }
  inline static vector<Field<N>> invfact(int t) {
    vector<Field<N>> F(t + 1, 1);
    Field<N> X{1};
    for (int i = 2; i <= t; ++i) {
      X = X * i;
    }
    F[t] = 1 / X;
    for (int i = t - 1; i >= 2; --i) {
      F[i] = F[i + 1] * (i + 1);
    }
    return F;
  }

 private:
  unsigned int v;
};
template <unsigned int N>
istream& operator>>(std::istream& is, Field<N>& f) {
  unsigned int v;
  is >> v;
  f = v;
  return is;
}
template <unsigned int N>
ostream& operator<<(std::ostream& os, const Field<N>& f) {
  return os << (unsigned int)f;
}
template <unsigned int N>
Field<N> operator+(int i, const Field<N>& f) {
  return Field<N>(i) + f;
}
template <unsigned int N>
Field<N> operator-(int i, const Field<N>& f) {
  return Field<N>(i) - f;
}
template <unsigned int N>
Field<N> operator*(int i, const Field<N>& f) {
  return Field<N>(i) * f;
}
template <unsigned int N>
Field<N> operator/(int i, const Field<N>& f) {
  return Field<N>(i) / f;
}
struct Ring {
  template <typename T>
  static T div(T p, T q, T N) {
    T t = 0, nt = 1, r = N, nr = q;
    while (nr != 0) {
      T q = r / nr;
      t -= q * nt;
      r -= q * nr;
      swap(t, nt);
      swap(r, nr);
    }
    t = (t < 0) ? t + N : t;
    r = (r < 0) ? r + N : r;
    if (gcd(p, N) % r != 0) {
      return 0;
    }
    return (t * p / r) % N;
  }
};
class Fraction {
  friend ostream& operator<<(ostream& os, const Fraction& f);

 public:
  Fraction(long long u = 0, long long v = 1) : u(u), v(v) { norm(); }
  bool operator==(const Fraction& o) const { return u == o.u && v == o.v; }
  bool operator!=(const Fraction& o) const { return u != o.u || v != o.v; }
  bool operator<(const Fraction& o) const { return u * o.v < o.u * v; }
  bool operator<=(const Fraction& o) const { return u * o.v <= o.u * v; }
  bool operator>(const Fraction& o) const { return u * o.v > o.u * v; }
  bool operator>=(const Fraction& o) const { return u * o.v >= o.u * v; }
  Fraction operator-(const Fraction& o) { return Fraction(-u, v); }
  Fraction& operator+=(const Fraction& o) {
    u = u * o.v + v * o.u;
    v *= o.v;
    return norm();
  }
  Fraction& operator-=(const Fraction& o) {
    u = u * o.v - v * o.u;
    v *= o.v;
    return norm();
  }
  Fraction& operator/=(const Fraction& o) {
    u = u * o.v;
    v = o.u * v;
    return norm();
  }
  Fraction& operator*=(const Fraction& o) {
    u *= o.u;
    v *= o.v;
    return norm();
  }
  Fraction operator+(const Fraction& o) const {
    Fraction f(*this);
    return f += o;
  }
  Fraction operator-(const Fraction& o) const {
    Fraction f(*this);
    return f -= o;
  }
  Fraction operator*(const Fraction& o) const {
    Fraction f(*this);
    return f *= o;
  }
  Fraction operator/(const Fraction& o) const {
    Fraction f(*this);
    return f /= o;
  }
  Fraction& norm() {
    long long g = gcd(abs(u), abs(v));
    u /= g;
    v /= g;
    if (v < 0) {
      u = -u;
      v = -v;
    }
    return *this;
  }
  long long u, v;
};
ostream& operator<<(ostream& os, const Fraction& f) {
  os << f.u << '/' << f.v;
  return os;
}
constexpr long long INF = 1e12;
class DLCC {
 public:
  void solve(istream& cin, ostream& cout) {
    int N;
    cin >> N;
    vector<int> X(N), V(N), P(N);
    for (int i = 0; i < N; ++i) {
      cin >> X[i] >> V[i] >> P[i];
    }
    vector<tuple<Fraction, int, int>> Events;
    for (int i = 0; i < N - 1; ++i) {
      Events.push_back({{X[i + 1] - X[i], V[i] + V[i + 1]}, i, 1});
      if (V[i + 1] != V[i]) {
        Events.push_back({{X[i + 1] - X[i], abs(V[i + 1] - V[i])},
                          i,
                          2 + (V[i + 1] < V[i])});
      }
    }
    sort(Events.begin(), Events.end());
    vector<bool> MustBeLeft(N, false), MustBeRight(N, false);
    vector<bool> Meet(N, false);
    struct Node {
      Field<998244353> a, b, c, d;
      int l, r;
      Node() {}
      Field<998244353>& get(int i, int j) {
        if (i == 0) {
          return j ? b : a;
        } else {
          return j ? d : c;
        }
      }
    };
    auto empty = [&](int i) {
      Node n;
      n.l = n.r = i;
      n.d = 1;
      return n;
    };
    auto build = [&](int i) {
      Node n;
      n.l = n.r = i;
      n.a = MustBeRight[i] ? 0 : 100 - P[i];
      n.d = MustBeLeft[i] ? 0 : P[i];
      n.b = n.c = 0;
      return n;
    };
    auto combine = [&](Node& a, Node& b) {
      Node n;
      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          for (int k = 0; k < 2; ++k) {
            for (int l = 0; l < 2; ++l) {
              if (a.r < N && Meet[a.r] && j == 1 && k == 0) continue;
              n.get(i, l) += a.get(i, j) * b.get(k, l);
            }
          }
        }
      }
      n.l = a.l;
      n.r = b.r;
      return n;
    };
    int M = 1 << logceil(N);
    vector<Node> TT(2 * M);
    for (int i = 0; i < N; ++i) TT[M + i] = build(i);
    for (int i = N; i < M; ++i) TT[M + i] = empty(i);
    for (int i = M - 1; i > 0; --i) TT[i] = combine(TT[2 * i], TT[2 * i + 1]);
    auto rebuild = [&](int i) {
      TT[M + i] = build(i);
      i = (i + M) / 2;
      while (i) {
        TT[i] = combine(TT[2 * i], TT[2 * i + 1]);
        i /= 2;
      }
    };
    Field<998244353> ans = 0;
    for (auto ev : Events) {
      Fraction F = get<0>(ev);
      int j = get<1>(ev);
      int t = get<2>(ev);
      Field<998244353> prob = 1;
      bool goingRight = false;
      int meetingSince = 0;
      bool origLeftJ = MustBeLeft[j];
      bool origRightJ = MustBeRight[j];
      bool origLeftJ1 = MustBeLeft[j + 1];
      bool origRightJ1 = MustBeRight[j + 1];
      bool nowRightJ = t != 2;
      bool nowLeftJ1 = t != 3;
      bool fail = false;
      if (nowRightJ && origLeftJ) fail = true;
      if (!nowRightJ && origRightJ) fail = true;
      if (nowLeftJ1 && origRightJ1) fail = true;
      if (!nowLeftJ1 && origLeftJ1) fail = true;
      if (t == 1) {
        MustBeRight[j] = true;
        MustBeLeft[j + 1] = true;
      } else if (t == 2) {
        MustBeLeft[j] = true;
        MustBeLeft[j + 1] = true;
      } else {
        MustBeRight[j] = true;
        MustBeRight[j + 1] = true;
      }
      rebuild(j);
      rebuild(j + 1);
      if (!fail) {
        Field<998244353> smart = TT[1].a + TT[1].b + TT[1].c + TT[1].d;
        ans += smart * (F.u % 998244353) / F.v;
      }
      MustBeLeft[j] = origLeftJ;
      MustBeRight[j] = origRightJ;
      MustBeLeft[j + 1] = origLeftJ1;
      MustBeRight[j + 1] = origRightJ1;
      if (t == 1) {
        Meet[j] = true;
      } else if (t == 2) {
        MustBeRight[j + 1] = true;
        if (MustBeLeft[j + 1]) break;
      } else {
        MustBeLeft[j] = true;
        if (MustBeRight[j]) break;
      }
      rebuild(j);
      rebuild(j + 1);
    }
    for (int i = 0; i < N; ++i) {
      ans /= 100;
    }
    cout << ans << '\n';
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  DLCC solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}