#include <bits/stdc++.h>
const int N = 1e5 + 5, P = 998244353;
int n, po[N], sp[N], pr[N];
inline int ksm(int x, int y = P - 2) {
  int z = 1;
  for (; y; x = 1ll * x * x % P, y >>= 1)
    if (y & 1) z = 1ll * z * x % P;
  return z;
}
struct TI {
  int p, o, d, v;
  TI(int P = 0, int O = 0, int D = 0, int V = 0) { p = P, o = O, d = D, v = V; }
} ti[N * 2];
int tt;
bool cmp(TI x, TI y) { return 1ll * x.d * y.v < 1ll * y.d * x.v; }
int sg[N * 4][4], ans;
bool ok[N][4], cp[4];
void bld(int w = 1, int l = 1, int r = n) {
  if (l == r) {
    sg[w][0] = (1 + P - pr[l]) % P, sg[w][3] = pr[l];
    return;
  }
  int mi = l + r >> 1;
  bld(w * 2, l, mi), bld(w * 2 + 1, mi + 1, r);
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; ++j)
      sg[w][i] = (1ll * sg[w * 2][(i & 1) | (j & 1) << 1] *
                      sg[w * 2 + 1][j >> 1 | (i & 2)] +
                  sg[w][i]) %
                 P;
}
void chg(int x, int w = 1, int l = 1, int r = n) {
  if (l == r) return;
  int mi = l + r >> 1;
  if (x <= mi)
    chg(x, w * 2, l, mi);
  else
    chg(x, w * 2 + 1, mi + 1, r);
  for (int i = 0; i < 4; ++i) {
    sg[w][i] = 0;
    for (int j = 0; j < 4; ++j)
      if (ok[mi][j])
        sg[w][i] = (1ll * sg[w * 2][(i & 1) | (j & 1) << 1] *
                        sg[w * 2 + 1][j >> 1 | (i & 2)] +
                    sg[w][i]) %
                   P;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d%d", &po[i], &sp[i], &pr[i]), pr[i] = 828542813ll * pr[i] % P;
  for (int i = 1; i < n; ++i) {
    ti[++tt] = TI(i, 1, po[i + 1] - po[i], sp[i + 1] + sp[i]);
    if (sp[i] > sp[i + 1])
      ti[++tt] = TI(i, 3, po[i + 1] - po[i], sp[i] - sp[i + 1]);
    if (sp[i + 1] > sp[i])
      ti[++tt] = TI(i, 0, po[i + 1] - po[i], sp[i + 1] - sp[i]);
  }
  std::sort(ti + 1, ti + tt + 1, cmp);
  bld();
  for (int i = 1; i < n; ++i)
    for (int j = 0; j < 4; ++j) ok[i][j] = 1;
  for (int i = 1, p; i <= tt; ++i) {
    p = ti[i].p;
    memcpy(cp, ok[p], 4);
    memset(ok[p], 0, 4), ok[p][ti[i].o] = 1;
    chg(p);
    for (int j = 0; j < 4; ++j)
      ans = (1ll * ti[i].d * ksm(ti[i].v) % P * sg[1][j] + ans) % P;
    memcpy(ok[p], cp, 4), ok[p][ti[i].o] = 0;
    chg(p);
  }
  printf("%d\n", ans);
  return 0;
}
