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

Difficulty: competition

Starter code:

Solutions:
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(solve1(x))
print(solve2(x))




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()

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))

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)

#!/usr/bin/env python3
p = 1000000007
s = input()
print(int(s,2) * pow(2, len(s) - 1) % p)


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)

mod = int(1e9 +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)

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

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

# coding = utf-8
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 = 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)

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

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)

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



p = 1000000007

s = input()

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

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

x =input()
print((int(x,2) << (len(x) - 1))%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)


MOD = int(1e9 + 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)


pri=pow(10,9)+7

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