let l = read_line ();;
let n = String.length l;;

(* dp[n][3][2] *)

let md = 1000000007
let ( +++ ) x y = let z = x + y in if z < md then z else z - md;;

let eq = 0;;
let lt = 1;;
let gt = 2;;

let dp = Array.make ((n+1)*3*2) 0;;
let index (i, j, k) = i*3*2 + j*2 + k;;
let get k = dp.(index k);;
let add k v = dp.(index k) <- dp.(index k) +++ v;;
add (n, eq, 0) 1;;

for i = n-1 downto 0 do 
  for j = 0 to 2 do
    for k = 0 to 1 do
      for x = 0 to 1 do
        for y = 0 to 1 do
          let c = (x + y + k) / 2 in
          let s = (x + y + k) mod 2 in
          let nj = match compare s (Char.code l.[i] - Char.code '0') with
            | -1 -> lt
            | 1 -> gt
            | _ -> j in
          if s = (x + y) mod 2 then
            add (i, nj, c) (get (i+1, j, k))
        done
      done
    done
  done
done;;

let ans = get (0, lt, 0) +++ get (0, eq, 0);;
Printf.printf "%d\n" ans;;
