Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i acc =
        if i = n then acc else loop (i + 1) (acc + int_of_char s.[i] - 48)
    in
    print_endline @@ if loop 0 0 mod 9 = 0 then "Yes" else "No"
)