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>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a;
    swap(a, m);
    u -= t * v;
    swap(u, v);
  }
  assert(m == 1);
  return u;
}
template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;
  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }
  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod())
      v = static_cast<Type>(x);
    else
      v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }
  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const {
    return static_cast<U>(value);
  }
  constexpr static Type mod() { return T::value; }
  Modular& operator+=(const Modular& other) {
    if ((value += other.value) >= mod()) value -= mod();
    return *this;
  }
  Modular& operator-=(const Modular& other) {
    if ((value -= other.value) < 0) value += mod();
    return *this;
  }
  template <typename U>
  Modular& operator+=(const U& other) {
    return *this += Modular(other);
  }
  template <typename U>
  Modular& operator-=(const U& other) {
    return *this -= Modular(other);
  }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) {
    Modular result(*this);
    *this += 1;
    return result;
  }
  Modular operator--(int) {
    Modular result(*this);
    *this -= 1;
    return result;
  }
  Modular operator-() const { return Modular(-value); }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value,
                     Modular>::type&
  operator*=(const Modular& rhs) {
    value = normalize(static_cast<int64_t>(value) *
                      static_cast<int64_t>(rhs.value));
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, long long>::value,
                     Modular>::type&
  operator*=(const Modular& rhs) {
    long long q = static_cast<long long>(static_cast<long double>(value) *
                                         rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value,
                     Modular>::type&
  operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }
  Modular& operator/=(const Modular& other) {
    return *this *= Modular(inverse(other.value, mod()));
  }
  friend const Type& abs(const Modular& x) { return x.value; }
  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);
  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);
  template <typename V, typename U>
  friend V& operator>>(V& stream, Modular<U>& number);

 private:
  Type value;
};
template <typename T>
bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) {
  return lhs.value == rhs.value;
}
template <typename T, typename U>
bool operator==(const Modular<T>& lhs, U rhs) {
  return lhs == Modular<T>(rhs);
}
template <typename T, typename U>
bool operator==(U lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) == rhs;
}
template <typename T>
bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) {
  return !(lhs == rhs);
}
template <typename T, typename U>
bool operator!=(const Modular<T>& lhs, U rhs) {
  return !(lhs == rhs);
}
template <typename T, typename U>
bool operator!=(U lhs, const Modular<T>& rhs) {
  return !(lhs == rhs);
}
template <typename T>
bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) {
  return lhs.value < rhs.value;
}
template <typename T>
Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) += rhs;
}
template <typename T, typename U>
Modular<T> operator+(const Modular<T>& lhs, U rhs) {
  return Modular<T>(lhs) += rhs;
}
template <typename T, typename U>
Modular<T> operator+(U lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) += rhs;
}
template <typename T>
Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) -= rhs;
}
template <typename T, typename U>
Modular<T> operator-(const Modular<T>& lhs, U rhs) {
  return Modular<T>(lhs) -= rhs;
}
template <typename T, typename U>
Modular<T> operator-(U lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) -= rhs;
}
template <typename T>
Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) *= rhs;
}
template <typename T, typename U>
Modular<T> operator*(const Modular<T>& lhs, U rhs) {
  return Modular<T>(lhs) *= rhs;
}
template <typename T, typename U>
Modular<T> operator*(U lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) *= rhs;
}
template <typename T>
Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) /= rhs;
}
template <typename T, typename U>
Modular<T> operator/(const Modular<T>& lhs, U rhs) {
  return Modular<T>(lhs) /= rhs;
}
template <typename T, typename U>
Modular<T> operator/(U lhs, const Modular<T>& rhs) {
  return Modular<T>(lhs) /= rhs;
}
template <typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}
template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}
template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}
template <typename U, typename T>
U& operator<<(U& stream, const Modular<T>& number) {
  return stream << number();
}
template <typename U, typename T>
U& operator>>(U& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, long long>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}
constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
using LL = long long;
const int MAXN = 100010;
LL x[MAXN], v[MAXN], p[MAXN];
class SegTree {
 public:
  SegTree(int _n) : n(_n) {
    x = vector<vector<vector<Mint>>>(_n * 4,
                                     vector<vector<Mint>>(2, vector<Mint>(2)));
    ban = vector<vector<bool>>(_n * 4, vector<bool>(4));
  }
  void Build(int t, int l, int r) {
    if (l == r) {
      x[t][0][0] = Mint(100 - p[l]) / 100;
      x[t][1][1] = Mint(p[l]) / 100;
      return;
    }
    int mid = (l + r) >> 1;
    Build(t + t, l, mid);
    Build(t + t + 1, mid + 1, r);
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int a = 0; a < 2; ++a) {
          for (int b = 0; b < 2; ++b) {
            x[t][i][j] += x[t + t][i][a] * x[t + t + 1][b][j];
          }
        }
      }
    }
  }
  void Insert(int t, int l, int r, int p, int q, int dir) {
    int mid = (l + r) >> 1;
    if (q <= mid) Insert(t + t, l, mid, p, q, dir);
    if (mid + 1 <= p) Insert(t + t + 1, mid + 1, r, p, q, dir);
    if (p == mid) ban[t][dir] = true;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        x[t][i][j] = 0;
        for (int a = 0; a < 2; ++a) {
          for (int b = 0; b < 2; ++b) {
            if (ban[t][a + a + b]) continue;
            x[t][i][j] += x[t + t][i][a] * x[t + t + 1][b][j];
          }
        }
      }
    }
  }
  Mint Query() {
    Mint ans = 0;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        ans += x[1][i][j];
      }
    }
    return ans;
  }
  int n;
  vector<vector<vector<Mint>>> x;
  vector<vector<bool>> ban;
};
LL Gcd(LL a, LL b) {
  while (b != 0) {
    LL t = a % b;
    a = b;
    b = t;
  }
  return a;
}
struct Frac {
  Frac(LL _a, LL _b) : a(_a), b(_b) {
    LL c = Gcd(a, b);
    a /= c;
    b /= c;
  }
  bool operator<(const Frac& t) const { return a * t.b < t.a * b; }
  LL a, b;
};
struct Event {
  Frac t;
  int a, b, dir;
  bool operator<(const Event& rhs) const { return t < rhs.t; }
};
Mint GetT(Frac tb, Frac ts) {
  LL a = tb.a * ts.b - ts.a * tb.b;
  LL b = tb.b * ts.b;
  return Mint(a) / Mint(b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> v[i] >> p[i];
  }
  SegTree tree(n);
  tree.Build(1, 1, n);
  vector<Event> e;
  for (int i = 1; i + 1 <= n; ++i) {
    if (p[i] > 0 && p[i + 1] < 100) {
      e.push_back({Frac{x[i + 1] - x[i], v[i] + v[i + 1]}, i, i + 1, 2});
    }
    if (v[i] == v[i + 1]) continue;
    if (v[i] > v[i + 1] && p[i] > 0 && p[i + 1] > 0) {
      e.push_back({Frac{x[i + 1] - x[i], v[i] - v[i + 1]}, i, i + 1, 3});
    }
    if (v[i] < v[i + 1] && p[i] < 100 && p[i + 1] < 100) {
      e.push_back({Frac{x[i + 1] - x[i], v[i + 1] - v[i]}, i, i + 1, 0});
    }
  }
  sort(e.begin(), e.end());
  Mint ans = 0;
  Frac pt{0, 1};
  for (auto [t, a, b, dir] : e) {
    Mint tt = GetT(t, pt);
    ans += tree.Query() * tt;
    tree.Insert(1, 1, n, a, b, dir);
    pt = t;
  }
  Mint tt = GetT(pt, {0, 1});
  ans -= tree.Query() * tt;
  cout << ans << endl;
  return 0;
}