As a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2^{n} members and coincidentally Natalia Fan Club also has 2^{n} members. Each member of MDC is assigned a unique id i from 0 to 2^{n} - 1. The same holds for each member of NFC.

One of the parts of this tradition is one by one dance, where each member of MDC dances with a member of NFC. A dance pair is a pair of numbers (a, b) such that member a from MDC dances with member b from NFC.

The complexity of a pairs' assignment is the number of pairs of dancing pairs (a, b) and (c, d) such that a < c and b > d.

You are given a binary number of length n named x. We know that member i from MDC dances with member $i \oplus x$ from NFC. Your task is to calculate the complexity of this assignment modulo 1000000007 (10^9 + 7).

Expression $x \oplus y$ denotes applying «XOR» to numbers x and y. This operation exists in all modern programming languages, for example, in C++ and Java it denotes as «^», in Pascal — «xor».


-----Input-----

The first line of input contains a binary number x of lenght n, (1 ≤ n ≤ 100).

This number may contain leading zeros.


-----Output-----

Print the complexity of the given dance assignent modulo 1000000007 (10^9 + 7).


-----Examples-----
Input
11

Output
6

Input
01

Output
2

Input
1

Output
1

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Combinatorics

Mathematics


Solutions:
div = 1000000007
s = input()
n = len(s)
ans = 0
mi = [1]
for i in range(100):
	mi.append(mi[-1] * 2 % div)
for i in range(n):
	if s[n - 1 - i] == '1':
		ret = mi[i] * mi[i] % div * mi[n - 1 - i] % div
		ans = (ans + ret) % div
print(ans)


mod = 10 ** 9 + 7
for _ in range(1):
	s = input()
	c = 1
	ans = 0
	for i in range(len(s) - 1, -1, -1):
		ans = (ans + c * int(s[i])) % mod
		c = c * 2 % mod
	d = pow(2, len(s), mod)
	ans = ans * d % mod
	ans = ans * pow(2, mod - 2, mod) % mod
	print(ans)


pri = pow(10, 9) + 7
s = input()
m = len(s)
val = int(s, 2)
print(pow(2, m - 1, pri) * val % pri)


MOD = 1000000007
ans = 0
x = input().strip()
n = len(x)
for (i, v) in enumerate(x):
	if v == '1':
		ans += pow(2, i, MOD) * pow(2, (n - i - 1) * 2, MOD) % MOD
		ans %= MOD
print(ans)


s = input()
new_s = ''
n = len(s)
for i in range(n - 1, -1, -1):
	new_s += s[i]
s = new_s
kek = 0
for i in range(n):
	kek += (1 << i) * (s[i] == '1')
for i in range(n - 1):
	kek *= 2
print(kek % (10 ** 9 + 7))


mod = int(1000000000.0 + 7)
s = input()
s = s[::-1]
ans = 0
for i in range(len(s)):
	ans *= 2
	if s[i] == '1':
		ans += pow(2, 2 * i, mod)
	ans %= mod
print(ans)


t = input()
(n, d) = (len(t), 1000000007)

def f(k):
	return 0 if k == n else 2 * f(k + 1) + (pow(2, 2 * (n - k - 1), d) if t[k] == '1' else 0)
print(f(0) % d)


import sys
for l in sys.stdin:
	s = l.strip()
	break
n = len(s)
d = 2 ** (n - 1)
print(d * int(s, 2) % 1000000007)


x = input()
n = len(x)
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
	if x[i] == '1':
		pref = pow(2, i, mod)
		suf = pow(2, n - i - 1, mod) ** 2
		ans += pref * suf % mod
print(ans % mod)


s = input()
a = int(s, 2)
n = len(s)
print(a * 2 ** (n - 1) % 1000000007)


MOD = 1000000007
s = input()
n = len(s)
p = [1]
for i in range(301):
	p.append(2 * p[-1] % MOD)
res = 0
m = n
g = 0
for i in range(n):
	if s[i] == '1':
		res += p[g] * (p[2 * m - 2] % MOD) % MOD
		res = res % MOD
	g += 1
	m -= 1
print(res)


x = input()
if int(x) == 0:
	print(0)
else:
	trail = '0' * (len(x) - 1)
	while len(x) > 0 and x[0] == '0':
		x = x[1:]
	num = int(x + trail, 2) % 1000000007
	print(num)


import sys
with sys.stdin as fin, sys.stdout as fout:
	MOD = 10 ** 9 + 7
	x = next(fin).strip()
	n = len(x)
	ans = 0
	for i in range(n):
		if x[n - i - 1] == '1':
			ans += pow(2, n + i - 1, MOD)
			ans %= MOD
	print(ans, file=fout)


s = input()
ans = 0
for (i, c) in enumerate(s):
	if c == '1':
		ans += 1 << 2 * len(s) - i - 2
print(ans % (10 ** 9 + 7))


p = 1000000007
s = input()
print(int(s, 2) * pow(2, len(s) - 1) % p)


x = input()
print((int(x, 2) << len(x) - 1) % 1000000007)


MOD = int(1000000000.0 + 7)
x = input()[::-1]
n = len(x)
res = 0
for (i, t) in enumerate(x):
	if t == '1':
		res = (res + (1 << n - 1 + i)) % MOD
print(res)


M = 10 ** 9 + 7

def solve1(x):
	n = len(x)
	x = int(x, 2)
	ans = 0
	for a in range(2 ** n):
		for c in range(2 ** n):
			b = a ^ x
			d = c ^ x
			if a < c and b > d:
				ans += 1
	return ans % M

def solve2(x):
	return int(x, 2) * pow(2, len(x) - 1, M) % M
x = input()
print(solve2(x))


s = str(input())
a = len(s)
x = 2 ** (a - 1)
x %= 1000000007
y = 0
z = 0
for i in range(a - 1, -1, -1):
	if s[i] == '1':
		z += 2 ** y
		z %= 1000000007
	y += 1
print(x * z % 1000000007)


MOD = 1000000007
str = input()
l = len(str)

def b2d(str):
	ans = 0
	cnt = 0
	str = str[::-1]
	for k in str:
		if k == '1':
			ans += pow(2, cnt)
			ans %= MOD
		cnt += 1
	return ans
print(b2d(str) * pow(2, l - 1) % MOD)


s = input()
res = pow(2, len(s) - 1) * int(s, 2)
print(res % 1000000007)


mod = 10 ** 9 + 7
x = input()[::-1]
n = len(x)
ans = 0
for (i, t) in enumerate(x):
	if t == '1':
		ans = (ans + pow(2, n - 1 + i)) % mod
print(ans)


n = input().strip()
s = len(n)
k = int(n, 2)
start = 4 ** (s - 1)
zib = 2 ** (s - 1)
step = 2 ** (s - 1)
print((start + (k - zib) * step) % (10 ** 9 + 7))


s = input()
s = s[::-1]
ans = 0
for i in range(len(s)):
	if s[i] == '1':
		ans += (2 ** i) ** 2 * 2 ** (len(s) - i - 1)
print(ans % (10 ** 9 + 7))


MODULO = 1000000007

def solve(mask):
	n = len(mask)
	return sum((2 ** k * 4 ** (n - k - 1) for k in range(n) if mask[k] == '1')) % MODULO

def __starting_point():
	mask = input()
	complexity = solve(mask)
	print(complexity)
__starting_point()