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;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
int n, m, i, j, pos[100005], v[100005], pro[100005], ans;
int pw(int x, int y) {
  int z = 1;
  while (y) {
    if (y & 1) z = 1ll * z * x % 998244353;
    x = 1ll * x * x % 998244353;
    y /= 2;
  }
  return z;
}
struct mat {
  int a[2][2];
} a[100005], s[400005];
struct evt {
  int pos, t, tz, tm, pro, x, y;
} b[300005];
bool cmp(evt x, evt y) { return 1ll * x.tz * y.tm < 1ll * x.tm * y.tz; }
mat mul(mat x, mat y) {
  mat z;
  memset(z.a, 0, sizeof(z.a));
  int i, j, k;
  for ((i) = (0); (i) <= (1); (i)++)
    for ((j) = (0); (j) <= (1); (j)++)
      for ((k) = (0); (k) <= (1); (k)++) {
        z.a[i][k] = (z.a[i][k] + 1ll * x.a[i][j] * y.a[j][k]) % 998244353;
      }
  return z;
}
void pushup(int x) { s[x] = mul(s[x + x], s[x + x + 1]); }
void build(int x, int l, int r) {
  if (l == r) {
    s[x] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(x + x, l, mid);
  build(x + x + 1, mid + 1, r);
  pushup(x);
}
void update(int x, int l, int r, int t) {
  if (l == r) {
    s[x] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  if (t <= mid) update(x + x, l, mid, t);
  if (t > mid) update(x + x + 1, mid + 1, r, t);
  pushup(x);
}
int main() {
  read(n);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    read(pos[i]);
    read(v[i]);
    read(pro[i]);
    pro[i] = 1ll * pro[i] * pw(100, 998244353 - 2) % 998244353;
  }
  for (((i)) = (1); ((i)) <= ((n - 1)); ((i))++) {
    evt tmp;
    tmp.pos = i;
    tmp.tz = pos[i + 1] - pos[i];
    tmp.tm = v[i] + v[i + 1];
    tmp.pro = 1ll * pro[i] * (1 - pro[i + 1] + 998244353) % 998244353;
    tmp.x = 1;
    tmp.y = 0;
    tmp.t = 1ll * tmp.tz * pw(tmp.tm, 998244353 - 2) % 998244353;
    b[++m] = tmp;
    if (v[i] > v[i + 1]) {
      tmp.pos = i;
      tmp.tz = pos[i + 1] - pos[i];
      tmp.tm = v[i] - v[i + 1];
      tmp.pro = 1ll * pro[i] * pro[i + 1] % 998244353;
      tmp.x = 1;
      tmp.y = 1;
      tmp.t = 1ll * tmp.tz * pw(tmp.tm, 998244353 - 2) % 998244353;
      b[++m] = tmp;
    }
    if (v[i] < v[i + 1]) {
      tmp.pos = i;
      tmp.tz = pos[i + 1] - pos[i];
      tmp.tm = v[i + 1] - v[i];
      tmp.pro = 1ll * (1 - pro[i] + 998244353) * (1 - pro[i + 1] + 998244353) %
                998244353;
      tmp.x = 0;
      tmp.y = 0;
      tmp.t = 1ll * tmp.tz * pw(tmp.tm, 998244353 - 2) % 998244353;
      b[++m] = tmp;
    }
  }
  sort(b + 1, b + m + 1, cmp);
  for (((i)) = (1); ((i)) <= ((n - 1)); ((i))++) {
    a[i].a[0][0] = (1 - pro[i + 1] + 998244353) % 998244353;
    a[i].a[0][1] = pro[i + 1];
    a[i].a[1][0] = (1 - pro[i + 1] + 998244353) % 998244353;
    a[i].a[1][1] = pro[i + 1];
  }
  build(1, 1, n - 1);
  for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
    mat tmp = a[b[i].pos];
    memset((a[b[i].pos].a), (0), (sizeof((a[b[i].pos].a))));
    a[b[i].pos].a[b[i].x][b[i].y] = tmp.a[b[i].x][b[i].y];
    update(1, 1, n - 1, b[i].pos);
    int res = (1ll * (1 - pro[1] + 998244353) * (s[1].a[0][0] + s[1].a[0][1]) %
                   998244353 +
               1ll * pro[1] * (s[1].a[1][0] + s[1].a[1][1]) % 998244353) %
              998244353;
    ans = (ans + 1ll * res * b[i].t) % 998244353;
    tmp.a[b[i].x][b[i].y] = 0;
    a[b[i].pos] = tmp;
    update(1, 1, n - 1, b[i].pos);
  }
  cout << ans << endl;
  return 0;
}