type node = N of int * node list ;;
Scanf.scanf "%d" (fun n ->
    let xd = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x d -> x, d)) in
    Array.sort compare xd;

    let rec loop i acc =
        if i < 0 then acc else (
            let x, d = xd.(i) in
            let rec loop_i c = function
                | [] -> c, []
                | (N (a, b) as hd) :: tl ->
                        if a < x + d then loop_i (hd :: c) tl else c, (hd :: tl)
            in
            let c, next = loop_i [] acc in
            loop (i - 1) (N (x, c) :: next)
        )
    in
    let result = loop (n - 1) [] in
    let m = 998244353 in
    let ( +@) a b = (a + b) mod m in
    let ( *@) a b = ((a mod m) * (b mod m)) mod m in
    let rec calc l = List.fold_left (fun acc (N(_, l)) -> acc *@ (1 +@ calc l)) 1 l in
    calc result |> Printf.printf "%d\n"
)