import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

alias Finite!1_000_000_007 finite;
void solve(){
	string l = readln.chomp;
	
	finite[] p3 = [finite(1)];
	foreach(i; 0 .. l.length + 1) p3 ~= p3[$ - 1] * 3;
	log("p3:", p3);
	
	finite[] p2 = [finite(1)];
	foreach(i; 0 .. l.length + 1) p2 ~= p2[$ - 1] * 2;
	log("p2:", p2);
	
	int k = 0;
	finite ans = finite(0);
	foreach(i; 0 .. l.length){
		if(l[i] == '1'){
			ans += p2[k] * p3[l.length - 1 - i];
			k += 1;
		}
		if(i == l.length - 1){
			ans += p2[k];
		}
		log("i:", i, "k:", k, "ans:", ans);
	}
	
	ans.writeln;
}
/*






*/




// ---------- FINITE ----------//
class Finite(ulong mod = 1_000_000_007){ ulong value;
	private static ulong[] _inv = [0, 1], _frac = [1, 1], _invfrac = [1, 1];
	this(ulong v){ value = v % mod; }
	bool opCast(T: bool)(){ return value != 0; }
	Finite!mod opUnary(string s){ ulong v;
		if(s == "+") v = value;
		else if(s == "-") v = mod - value;
		else if(s == "++") v = value + 1;
		else if(s == "--") v = value + mod - 1;
		else assert(0, "Operator unary " ~ s ~ " not implemented");
		return new Finite!mod(v);
	}
	Finite!mod opBinary(string s)(Finite!mod b){
		return opBinary!s(b.value);
	}
	Finite!mod opBinary(string s)(ulong u){ ulong v;
		if(s == "+") v = value + u;
		else if(s == "-") v = value + mod - u;
		else if(s == "*") v = value * u;
		else if(s == "/") v = value * inv(u);
		else assert(0, "Operator " ~ s ~ " not implemented");
		return new Finite!mod(v);
	}
	Finite!mod opBinaryRight(string s)(ulong u){ ulong v;
		if(s == "+") v = u + value;
		else if(s == "-") v = u + mod - value;
		else if(s == "*") v = u * value;
		else if(s == "/") v = u * invvalue;
		else assert(0, "Operator " ~ s ~ " not implemented");
		return new Finite!mod(v);
	}
	Finite!mod opAssign(ulong v){ value = v; return this; }
	Finite!mod opOpAssign(string s)(Finite!mod b){
		return opOpAssign!s(b.value);
	}
	Finite!mod opOpAssign(string s)(ulong v){
		if(s == "+") value = (value + v) % mod;
		else if(s == "-") value = (value + mod - v) % mod;
		else if(s == "*") value = (value * v) % mod;
		else if(s == "/") value = (value * inv(v)) % mod;
		else assert(0, "Operator " ~ s ~ "= not implemented");
		return this;
	}
	override bool opEquals(Object o){
		Finite!mod b = cast(Finite!mod) o;
		return(value == b.value);
	}
	override string toString(){ return value.to!string; }
	ulong inv(ulong v){
		assert(v > 0);
		assert(v < mod);
		while(v >= _inv.length){
			_inv ~= _inv[mod % $] * (mod - mod / _inv.length) % mod;
		}
		return _inv[v];
	}
	ulong invvalue(){
		return inv(value);
	}
	static Finite!mod opCall(ulong v){
		return new Finite!mod(v);
	}

}
// ---------- FINITE ----------//


Measured memory_bytes: 14104