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 m = 998244353 in
    let ( +@) a b = (a + b) mod m in
    let ( *@) a (_, b) = (a * b) mod m in

    let rec loop c (x, d) = function
        | [] -> [ x, c +@ 1 ]
        | ((a, b) as h) :: tl ->
            if a < x + d then loop (c *@ h) (x, d) tl else (x, c +@ 1) :: h :: tl
    in
    Array.fold_right (loop 1) xd []
    |> List.fold_left ( *@) 1
    |> print_int
)