Scanf.scanf "%s" (fun s -> let len = String.length s in let rec loop i acc = if i = len then acc else loop (i + 1) ((acc * 10 + int_of_char s.[i] - 48) mod 1000000007) in loop 0 0 |> Printf.printf "%d\n" )