import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    string L = sread();
    auto dp = new long[][](L.length + 1, 2); // 確定桁数, a+b<L確定
    dp[0][0] = 1;
    dp[0][1] = 0;
    foreach (i; 0 .. L.length)
    {
        if (L[i] == '1')
        {
            dp[i + 1][0] = dp[i][0] * 2 % MOD;
            dp[i + 1][1] = (dp[i][0] + dp[i][1] * 3) % MOD;
        }
        else
        {
            dp[i + 1][0] = dp[i][0];
            dp[i + 1][1] = dp[i][1] * 3 % MOD;
        }
    }
    writeln(dp[L.length].sum() % MOD);
}
