let m = 1000000007
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

let () =
  let l = read_line () in
  let dp = Array.make_matrix (String.length l + 1) 2 0 in
  dp.(0).(0) <- 1;
  for i = 0 to String.length l - 1 do
    match l.[i] with
    | '0' ->
        dp.(i + 1).(0) <- dp.(i).(0);
        dp.(i + 1).(1) <- 3 *^ dp.(i).(1)
    | '1' ->
        dp.(i + 1).(0) <- 2 *^ dp.(i).(0);
        dp.(i + 1).(1) <- 3 *^ dp.(i).(1) +^ dp.(i).(0)
  done;
  Printf.printf "%d\n" @@ Array.fold_left ( +^ ) 0 dp.(String.length l)
