using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC129.E();
        }



        class ABC129
        {
            public static void A()
            {
                var X = Read.IntN().OrderBy(x => x).ToArray();
                Console.WriteLine(X.Take(2).Sum());
            }
            public static void B()
            {
                var N = Read.Int();
                var W = Read.LongN();
                var WSum = Util.ASum(W);
                long min = 1000000;
                for(int i = 0; i < N - 1; ++i)
                {
                    min = Math.Min(min, Math.Abs(WSum[i + 1] * 2 - WSum[N]));
                }
                Console.WriteLine(min);
            }
            public static void C()
            {
                var N = Read.Int();
                var M = Read.Int();
                var A = new HashSet<int>();
                for(int m = 0; m < M; ++m)
                {
                    A.Add(Read.Int());
                }
                var C = new int[N + 1];
                C[0] = 1;
                C[1] = A.Contains(1) ? 0 : 1;
                for(int i = 2; i <= N; ++i)
                {
                    C[i] = A.Contains(i) ? 0 : (C[i - 1] + C[i - 2]) % 1000000007;
                }
                Console.WriteLine(C[N]);
            }
            public static void D()
            {
                var H = Read.Int();
                var W = Read.Int();
                var S = new bool[H, W];
                for (int h = 0; h < H; ++h)
                {
                    var s = Read.Str();
                    for (int w = 0; w < W; ++w)
                    {
                        S[h, w] = s[w] == '.';
                    }
                }
                var count = new int[H, W];
                for (int h = 0; h < H; ++h)
                {
                    int L = 0, R = 0;
                    for (int w = 0; w < W; ++w)
                    {
                        count[h, w] += S[h, w] ? L : 0;
                        L = S[h, w] ? L + 1 : 0;
                    }
                    for (int w = W - 1; w >= 0; --w)
                    {
                        count[h, w] += S[h, w] ? R : 0;
                        R = S[h, w] ? R + 1 : 0;
                    }
                }
                for (int w = 0; w < W; ++w)
                {
                    int U = 0, D = 0;
                    for (int h = 0; h < H; ++h)
                    {
                        count[h, w] += S[h, w] ? U : 0;
                        U = S[h, w] ? U + 1 : 0;
                    }
                    for (int h = H - 1; h >= 0; --h)
                    {
                        count[h, w] += S[h, w] ? D : 0;
                        D = S[h, w] ? D + 1 : 0;
                    }
                }
                int max = 1;
                for (int h = 0; h < H; ++h)
                {
                    for (int w = 0; w < W; ++w)
                    {
                        max = Math.Max(max, count[h, w] + 1);
                    }
                }
                Console.WriteLine(max);
            }
            public static void E()
            {
                var L = Read.Str();
                var P = 1000000007;
                long dp1 = 1, dp0 = 1;
                for(int i = L.Length - 1; i >= 0; --i)
                {
                    dp1 = (L[i] == '1' ? (dp0 + dp1 * 2) : dp1) % P;
                    dp0 = (dp0 * 3) % P;
                }
                Console.WriteLine(dp1);
            }
        }




        class Util
        {
            public static long[] ASum(long[] array)
            {
                var res = new long[array.Length + 1];
                for (int i = 0; i < array.Length; ++i)
                {
                    res[i + 1] = res[i] + array[i];
                }
                return res;
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}


Measured memory_bytes: 13364