Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.

Each command is one of the following two types:   Go 1 unit towards the positive direction, denoted as '+'  Go 1 unit towards the negative direction, denoted as '-' 

But the Wi-Fi condition is so poor that Dreamoon's smartphone reports some of the commands can't be recognized and Dreamoon knows that some of them might even be wrong though successfully recognized. Dreamoon decides to follow every recognized command and toss a fair coin to decide those unrecognized ones (that means, he moves to the 1 unit to the negative or positive direction with the same probability 0.5). 

You are given an original list of commands sent by Drazil and list received by Dreamoon. What is the probability that Dreamoon ends in the position originally supposed to be final by Drazil's commands?


-----Input-----

The first line contains a string s_1 — the commands Drazil sends to Dreamoon, this string consists of only the characters in the set {'+', '-'}. 

The second line contains a string s_2 — the commands Dreamoon's smartphone recognizes, this string consists of only the characters in the set {'+', '-', '?'}. '?' denotes an unrecognized command.

Lengths of two strings are equal and do not exceed 10.


-----Output-----

Output a single real number corresponding to the probability. The answer will be considered correct if its relative or absolute error doesn't exceed 10^{ - 9}.


-----Examples-----
Input
++-+-
+-+-+

Output
1.000000000000

Input
+-+-
+-??

Output
0.500000000000

Input
+++
??-

Output
0.000000000000



-----Note-----

For the first sample, both s_1 and s_2 will lead Dreamoon to finish at the same position  + 1. 

For the second sample, s_1 will lead Dreamoon to finish at position 0, while there are four possibilites for s_2: {"+-++", "+-+-", "+--+", "+---"} with ending position {+2, 0, 0, -2} respectively. So there are 2 correct cases out of 4, so the probability of finishing at the correct position is 0.5. 

For the third sample, s_2 could only lead us to finish at positions {+1, -1, -3}, so the probability to finish at the correct position  + 3 is 0.

Difficulty: EASY
Tags: Bit manipulation

Probability

Combinatorics

Complete search

Dynamic programming

Mathematics
Skill types: Dynamic programming

Bit manipulation

Complete search

Starter code:

Solutions:
from math import factorial as fac
s = input()
s1 = input()
mov = 0
for i in range(len(s)):
	if s[i] == '+':
		mov += 1
	else:
		mov -= 1
tap = 0
count = 0
for i in range(len(s1)):
	if s1[i] == '+':
		tap += 1
	elif s1[i] == '-':
		tap -= 1
	else:
		count += 1
mov = mov - tap
if (count + mov) % 2 == 1:
	print(0)
	exit()
else:
	a = (count + mov) // 2
	b = count - a
	if b < 0 or a < 0:
		print(0)
		exit()
	else:
		x = fac(a + b) // (fac(a) * fac(b))
		print(x / pow(2, a + b))


from itertools import permutations
a = input()
b = input()
aplus = a.count('+')
aminus = len(a) - aplus
bplus = b.count('+')
bminus = b.count('-')
bjolly = len(b) - bplus - bminus
if bplus > aplus or bminus > aminus:
	print(0)
elif bjolly == 0 and aplus == bplus and (aminus == bminus):
	print(1)
else:
	combs = '+' * (aplus - bplus) + '-' * (aminus - bminus)
	res = len(set(permutations(combs))) / 2 ** len(combs)
	print(res)


s1 = input()
s2 = input()
f1 = +s1.count('+') - s1.count('-')
q = s2.count('?')
if q == 0:
	f2 = +s2.count('+') - s2.count('-')
	if f1 == f2:
		print('1.0000')
	else:
		print('0.0000')
	exit(0)
good_outcomes = 0
for mask in range(2 ** q):
	p = s2.count('+') + bin(mask).count('1')
	m = s2.count('-') + (q - bin(mask).count('1'))
	f2 = +p - m
	if f2 == f1:
		good_outcomes += 1
total_outcomes = 2 ** q
ans = good_outcomes / total_outcomes
print(ans)


import sys
from collections import Counter
from math import factorial
input = sys.stdin
output = sys.stdout
combinations_dynamic = dict()

def combinations(n, k):
	if k > n - k:
		k = n - k
	if k < 0:
		return 0
	if n < 1:
		return 0
	if k == 0:
		return 1
	if k == 1:
		return n
	question = tuple((n, k))
	if question not in combinations_dynamic:
		combinations_dynamic[question] = combinations(n - 1, k - 1) + combinations(n - 1, k)
	return combinations_dynamic[question]

def read_int():
	return [int(x) for x in input.readline().rstrip().split()]
commands = input.readline().rstrip()
received = input.readline().rstrip()
target = 0
for c in commands:
	if c == '+':
		target += 1
	else:
		target -= 1
(position, drop) = (0, 0)
for c in received:
	if c == '+':
		position += 1
	elif c == '-':
		position -= 1
	else:
		drop += 1
answer = 1.0 if target == position else 0.0
if drop > 0:
	need = abs(target - position)
	if drop < need:
		answer = 0.0
	else:
		plus = need
		if (drop - plus) % 2 != 0:
			answer = 0.0
		else:
			plus += (drop - plus) // 2
			answer = combinations(drop, plus) / 2 ** drop
output.write('%.12f\n' % answer)


def fact(n):
	return n * fact(n - 1) if n > 1 else 1
a = input()
s = input()
orig = a.count('+') - a.count('-')
curr = s.count('+') - s.count('-')
buff = s.count('?')
if orig < curr - buff or orig > curr + buff:
	print(0)
	exit(0)
if buff == 0:
	print(1)
	exit(0)
a = abs(orig - curr)
a += (buff - a) / 2
print('%.12f' % (fact(buff) / (fact(a) * fact(buff - a) * 2 ** buff)))


import sys
input = sys.stdin.readline
from math import factorial

def nCr(n, r):
	if r > n or r < 0:
		return 0
	return factorial(n) // (factorial(r) * factorial(n - r))
(a, b) = (input(), input())
n = b.count('?')
r = a.count('+') - b.count('+')
print(nCr(n, r) / pow(2, n))


a = input()
b = input()

def foo(b, i, pos, poss):
	if i == len(b):
		poss.append(pos)
	elif b[i] == '+':
		foo(b, i + 1, pos + 1, poss)
	elif b[i] == '-':
		foo(b, i + 1, pos - 1, poss)
	else:
		foo(b, i + 1, pos + 1, poss)
		foo(b, i + 1, pos - 1, poss)
pos0 = 0
for x in a:
	if x == '+':
		pos0 += 1
	else:
		pos0 -= 1
q = 0
for x in b:
	if x == '?':
		q += 1
poss = []
res = 0
foo(b, 0, 0, poss)
for x in poss:
	if x == pos0:
		res += 1
print(res / 2 ** q)


from collections import Counter as c
a = c(list(input()))
b = c(list(input()))
if b['+'] > a['+'] or b['-'] > a['-']:
	print('{:.12f}'.format(0))
else:
	w = abs(b['+'] - a['+'])
	p = abs(b['-'] - a['-'])
	if w == 0 or p == 0:
		print('{:.12f}'.format((1 / 2) ** b['?']))
	else:
		s = 1
		for i in range(1, w + 1):
			s *= i
		q = b['?']
		for i in range(1, w):
			q *= b['?'] - i
		ans = q / s * (1 / 2) ** w * (1 / 2) ** p
		print('{0:.12f}'.format(ans))


def get_finish_position(s):
	start = 0
	for i in s:
		if i == '+':
			start += 1
		elif i == '-':
			start -= 1
	return start

def get_possibilities(s):
	res = []

	def recurse(cur, indx):
		if len(cur) == len(s):
			res.append(''.join(cur))
			return
		if s[indx] == '?':
			for choice in ['+', '-']:
				cur.append(choice)
				recurse(cur, indx + 1)
				cur.pop()
		else:
			cur.append(s[indx])
			recurse(cur, indx + 1)
			cur.pop()
	recurse([], 0)
	return res
s1 = input()
s2 = input()
r1 = get_finish_position(s1)
p2 = get_possibilities(s2)
count = 0
for p in p2:
	if get_finish_position(p) == r1:
		count += 1
print(count / len(p2))


def solve():
	from math import factorial
	s1 = input()
	s2 = input()
	(cs1, cs2) = (0, 0)
	c2 = 0
	for i in s1:
		if i == '+':
			cs1 += 1
		else:
			cs1 -= 1
	for i in s2:
		if i == '+':
			cs2 += 1
		elif i == '-':
			cs2 -= 1
		else:
			c2 += 1
	if c2 == 0:
		if cs1 == cs2:
			print(float(1))
		else:
			print(float(0))
	else:
		l = []
		x = c2
		y = -1 * c2
		while x >= y:
			l.append(x)
			x -= 2
		if cs1 - cs2 in l:
			z = l.index(cs1 - cs2)
			pu = factorial(c2) // (factorial(z) * factorial(c2 - z))
			pd = 2 ** c2
			p = pu / pd
			print(p)
		else:
			print(float(0))
solve()


from sys import stdin, stdout
comb = {}

def choose(n, k):
	if (n, k) in comb:
		return comb[n, k]
	if n == k:
		return 1
	if k == 1:
		return n
	if k == 0:
		return 1
	comb[n, k] = choose(n - 1, k - 1) + choose(n - 1, k)
	return comb[n, k]
s1 = input()
s2 = input()

def run(s1, s2):
	pos = 0
	for c in s1:
		if c == '+':
			pos += 1
		else:
			pos -= 1
	cp = 0
	q = 0
	for c in s2:
		if c == '+':
			cp += 1
		elif c == '-':
			cp -= 1
		else:
			q += 1
	left = pos - cp
	if left % 2 != q % 2:
		return 0
	if abs(left) > q:
		return 0
	if left > 0:
		plus = left / 2 + q / 2
		return choose(q, plus) / 2 ** q
	else:
		minus = left / 2 + q / 2
		return choose(q, minus) / 2 ** q
print('{:.9f}'.format(run(s1, s2)))


a = input()
b = input()
from math import factorial as f
z = a.count('+') - b.count('+')
q = b.count('?')
if z == 0:
	print(1 / 2 ** q)
elif z < 0:
	print(0)
elif q < z:
	print(0)
elif q == z:
	print(1 / 2 ** q)
else:
	w = f(q) // (f(q - z) * f(z))
	print(w / 2 ** q)


import math

def ncr(n, k):
	return math.factorial(n) / (math.factorial(k) * math.factorial(n - k))
str1 = list(input())
str2 = list(input())
sum1 = {'+': 0, '-': 0}
sum2 = {'+': 0, '-': 0, '?': 0}
for i in range(len(str1)):
	sum1[str1[i]] += 1
	sum2[str2[i]] += 1
if sum2['+'] > sum1['+'] or sum2['-'] > sum1['-']:
	print(float(0))
else:
	print(1.0 / 2 ** sum2['?'] * ncr(sum2['?'], max(sum1['+'] - sum2['+'], sum1['-'] - sum2['-'])))


import math
from sys import stdin
I = stdin.readline
s = I()
t = I()
p = 0
for c in s:
	if c == '+':
		p += 1
(pt, qt) = (0, 0)
for c in t:
	if c == '+':
		pt += 1
	elif c == '?':
		qt += 1
req = p - pt
if req > qt or req < 0:
	ans = 0
else:
	ans = math.factorial(qt) / math.factorial(req)
	ans /= math.factorial(qt - req)
	ans /= pow(2, qt)
print(ans)


from collections import Counter
from math import factorial, log, sqrt

def nbCombinations(r, n):
	return factorial(n) // factorial(r) // factorial(n - r)
s1 = input()
s2 = input()
counterS1 = Counter(s1)
counterS2 = Counter(s2)
if counterS1 == counterS2:
	print('1.000000000000')
elif '?' not in counterS2:
	print('0.000000000000')
else:
	nbPlusToMuch = counterS2['+'] - counterS1['+']
	nbMinusToMuch = counterS2['-'] - counterS1['-']
	if nbPlusToMuch > 0 or nbMinusToMuch > 0:
		print('0.000000000000')
	else:
		if nbPlusToMuch < 0:
			k = abs(nbPlusToMuch)
		else:
			k = abs(nbMinusToMuch)
		n = counterS2['?']
		print(nbCombinations(k, n) * 0.5 ** n)


(s1, s2) = (input(), input())
(pm, p, p2, q, c) = ([1, -1], 0, 0, 0, 0)
for i in range(len(s1)):
	p += 1 if s1[i] == '+' else -1
	if s2[i] == '?':
		q += 1
	else:
		p2 += 1 if s2[i] == '+' else -1
from itertools import product
for ls in list(product(pm, repeat=q)):
	c += p - p2 == sum(ls)
print(c / 2 ** q)


from math import factorial

def probability(x, y, x1, y1):
	if x + y == x1 + y1:
		if x - y == x1 - y1:
			return 1
		else:
			return 0
	n = x + y - (x1 + y1)
	if n < x - x1 or n < y - y1:
		return 0
	else:
		return factorial(n) / (factorial(n - (x - x1)) * factorial(x - x1)) / 2 ** n
s1 = input()
s2 = input()
x = s1.count('+')
y = s1.count('-')
x1 = s2.count('+')
y1 = s2.count('-')
print(probability(x, y, x1, y1))


list1 = list(input())
list2 = list(input())
plus1 = list1.count('+')
plus2 = list2.count('+')
minus1 = list1.count('-')
minus2 = list2.count('-')
wths = list2.count('?')

def giveFactorial(n, x):
	if x == 0 or x == n or x > n or (n == 0):
		return 1
	else:
		return giveFactorial(n - 1, x - 1) + giveFactorial(n - 1, x)
a = giveFactorial(wths, plus1 - plus2)
if plus1 == plus2 and wths == 0:
	print(1)
elif wths == 0:
	print(0)
elif plus1 - plus2 > wths or minus1 - minus2 > wths:
	print(0)
else:
	print(0.5 ** (plus1 - plus2 + minus1 - minus2) * a)


(s1, s2) = (input(), input())
(aim, c, v) = (0, 0, 0)
for i in s1:
	aim += 1 if i == '+' else -1
for i in s2:
	if i == '?':
		v += 1
	else:
		c += 1 if i == '+' else -1
r = aim - c
(m, q) = ([], [])
for i in range(v):
	a = [1]
	for i in range(1, len(q)):
		a.append(q[i] + q[i - 1])
	a.append(1)
	q = a
k = v // 2
for i in range(k):
	m.append(v - i * 2)
if v != 0:
	if v % 2 == 0:
		m.append(0)
	else:
		m.append(1)
		m.append(-1)
for i in range(k):
	m.append((k - i - 1) * 2 - v)
res = float(1 if r == 0 and v == 0 else 0)
for i in range(len(m)):
	if m[i] == r:
		res = q[i] / 2 ** v
		break
print(res)


orig = input()
rec = input()
orig1 = orig.count('+')
orig0 = orig.count('-')
rec1 = rec.count('+')
rec0 = rec.count('-')
rec2 = rec.count('?')
if rec1 == orig1 and rec0 == orig0:
	print('%.12f' % 1)
elif rec1 > orig1 or rec0 > orig0:
	print('%.12f' % 0)
else:
	ans = ans1 = ans2 = 1
	pos = orig1 - rec1
	neg = orig0 - rec0
	total = pow(2, rec2)
	for i in range(1, pos + neg + 1):
		ans *= i
	for i in range(1, pos + 1):
		ans1 *= i
	for i in range(1, neg + 1):
		ans2 *= i
	poss = ans // ans1
	poss = poss // ans2
	print('%.12f' % (poss / total))


def fact(n):
	k = 1
	for i in range(1, n + 1):
		k *= i
	return k
s = input()
st = input()
p1 = m1 = p2 = m2 = 0
for i in range(len(s)):
	if s[i] == '+':
		p1 += 1
	else:
		m1 += 1
	if st[i] == '+':
		p2 += 1
	elif st[i] == '-':
		m2 += 1
if p1 == p2 and m1 == m2:
	print('1.0')
	exit()
t = len(s) - (p2 + m2)
tmp = 2 ** t
if p1 < p2 or m1 < m2:
	print('0.0')
else:
	m1 -= m2
	p1 -= p2
	ans = fact(t) / (fact(m1) * fact(p1))
	print(ans / tmp)


a = input()
b = input()
pa = a.count('+')
sa = pa - a.count('-')
pb = b.count('+')
sb = pb - b.count('-')
q = b.count('?')
n = abs(sa - sb)
if pa == pb and q == 0:
	print(float(1))
elif q - n & 1 or q < n:
	print(float(0))
else:
	y = (q - n) // 2
	fac = lambda x: 1 if x <= 1 else x * fac(x - 1)
	ans = fac(q) / (fac(y) * fac(q - y))
	print(ans * pow(0.5, q))


def ok(x):
	if '?' in x:
		return False
	return True
(final_pos, ans) = (0, 0)

def gen(x):
	global ans, final_pod
	if ok(x):
		currstr_pos = 0
		for ch in x:
			if ch == '+':
				currstr_pos += 1
			else:
				currstr_pos -= 1
		if currstr_pos == final_pos:
			ans += 1
	else:
		for i in range(len(x)):
			if x[i] == '?':
				a = x.copy()
				b = x.copy()
				a[i] = '+'
				b[i] = '-'
				gen(a)
				gen(b)
				break
s = list(input())
t = list(input())
for ch in s:
	if ch == '+':
		final_pos += 1
	else:
		final_pos -= 1
gen(t)
print(ans / 2 ** t.count('?'))


true = input()
check = input()
variants = ['']
positions = []

def divide(arr):
	new_arr = []
	for variant in arr:
		new_arr.append(variant + '+')
		new_arr.append(variant + '-')
	return new_arr
for i in range(len(check)):
	if check[i] != true[i] and check[i] == '?':
		variants = divide(variants)
	else:
		for j in range(len(variants)):
			variants[j] += check[i]

def position(variant):
	pos = 0
	for direction in variant:
		if direction == '+':
			pos += 1
		else:
			pos -= 1
	return pos
true_pos = position(true)
for var in variants:
	positions.append(position(var))
chance = positions.count(true_pos) / len(positions)
print(str(chance) + '0' * (14 - len(str(chance))))


def get_bin(x, n=0):
	return format(x, 'b').zfill(n)
drz = input()
drm = input()
val = drm.count('?')
t = val
cond = False
str1 = []
str2 = []
for i in range(0, len(drz)):
	if drm[i] != '?':
		str1.append(drm[i])
		str2.append(drz[i])
str1.sort()
str2.sort()
if str1 != str2 and val == 0:
	cond = True
if cond == True:
	print(0.0)
	exit(0)
if val == 0:
	print(1.0)
	exit(0)
val = pow(2, val)
store = []
for i in range(0, len(drz)):
	if drm[i] != '?':
		store.append(drm[i])
plus = drz.count('+')
minus = drz.count('-')
res = plus - minus
plus = store.count('+')
minus = store.count('-')
res2 = plus - minus
ls = []
for i in range(0, val):
	ls.append(get_bin(i, t))
fav_cases = 0
for u in ls:
	final = []
	get = [int(k) for k in u]
	for i in get:
		if i == 0:
			final.append(-1)
		else:
			final.append(1)
	if sum(final) + res2 == res:
		fav_cases += 1
print(fav_cases / val)


final = input()
mb = input()
pf = __builtins__.print

def print(arg):
	pf('{0:.12f}'.format(arg))

def precisepos():
	inifin = 0
	inimb = 0
	for x in final:
		if x == '+':
			inifin += 1
		else:
			inifin -= 1
	for x in mb:
		if x == '+':
			inimb += 1
		else:
			inimb -= 1
	return abs(inifin - inimb)

def main():
	global mb
	unknown = mb.count('?')
	mb = mb.replace('?', '')
	diff = precisepos()
	if unknown == 0:
		if diff == 0:
			print(1)
			return
		else:
			print(0)
			return
	elif diff > unknown:
		print(0)
		return
	else:
		m = (unknown + diff) // 2
		c = 1
		for i in range(m):
			c *= unknown - i
		for i in range(2, m + 1):
			c /= i
		result = c / (1 << unknown)
		print(result)
main()


import math

def ncr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
s0 = input()
s1 = input()
p0 = 0
p1 = 0
l = len(s0)
r = 0
for c in s0:
	if c == '+':
		p0 += 1
	elif c == '-':
		p0 -= 1
for c in s1:
	if c == '+':
		p1 += 1
	elif c == '-':
		p1 -= 1
	else:
		r += 1
if abs(p1 - p0) > r:
	print(0)
else:
	h = r - abs(p1 - p0)
	if h % 2 == 0:
		print(ncr(r, h // 2) / 2 ** r)
	else:
		print(0)


import os
import sys
from io import BytesIO, IOBase

def solution(s1, s2):
	(p1, m1) = (s1.count('+'), s1.count('-'))
	dest = p1 - m1
	(p2, m2) = (s2.count('+'), s2.count('-'))
	q = s2.count('?')
	cur = p2 - m2
	diff = dest - cur
	if diff == 0 and q == 0:
		write(1.0)
		return
	if diff != 0 and q == 0:
		write(0.0)
		return
	res = 0
	for x in range(2 ** q):
		binary = bin(x)[2:].zfill(q)
		cal = binary.count('1') - binary.count('0')
		res += 1 if cal == diff else 0
	write(res / 2 ** q)

def main():
	s1 = input()
	s2 = input()
	solution(s1, s2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


import itertools

def checkstring(string):
	res = 0
	for a in string:
		if a == '+':
			res += 1
		else:
			res -= 1
	return res
a = input()
b = input()
target = checkstring(a)
choices = []

def genchoices(string):
	if len(string) == 0:
		return ['']
	recursive = genchoices(string[1:])
	if string[0] == '+':
		return ['+' + x for x in recursive]
	elif string[0] == '-':
		return ['-' + x for x in recursive]
	else:
		return ['+' + x for x in recursive] + ['-' + x for x in recursive]
choices = genchoices(b)
correct_ones = 0
total_ones = len(choices)
for choice in choices:
	if checkstring(choice) == target:
		correct_ones += 1
import decimal
print(decimal.Decimal(correct_ones) / decimal.Decimal(total_ones))


def get_sum(text):
	count = 0
	for char in text:
		if char == '+':
			count += 1
		else:
			count -= 1
	return count

def check_probability(text, position, expected_value, actual_value):
	if position >= len(text):
		if expected_value != actual_value:
			return 0.0
		else:
			return 1.0
	if text[position] == '+':
		return check_probability(text, position + 1, expected_value, actual_value + 1)
	if text[position] == '-':
		return check_probability(text, position + 1, expected_value, actual_value - 1)
	if text[position] == '?':
		plus = check_probability(text, position + 1, expected_value, actual_value + 1)
		minus = check_probability(text, position + 1, expected_value, actual_value - 1)
		return (plus + minus) / 2
text1 = input()
text2 = input()
expected_value = get_sum(text1)
print('%.12f' % check_probability(text2, 0, expected_value, 0))


orig = input()
mess = input()
end_position = orig.count('+') - orig.count('-')
posses = dict()

def go(pos, index, prob):
	if index == len(mess):
		posses[pos] = posses.get(pos, 0) + prob
	elif mess[index] == '+':
		go(pos + 1, index + 1, prob)
	elif mess[index] == '-':
		go(pos - 1, index + 1, prob)
	else:
		go(pos + 1, index + 1, prob / 2)
		go(pos - 1, index + 1, prob / 2)
go(0, 0, 1.0)
print(posses.get(end_position, 0))


from collections import Counter
from math import *
o = Counter(input())
s = Counter(input())
s['+'] -= o['+']
s['-'] -= o['+']
p = s

def f(n, k):
	if k < 0 or k > n:
		return 0
	return factorial(n) // (factorial(k) * factorial(n - k))
print(f(p['?'], -p['+']) / 2 ** p['?'])


from math import factorial
import sys
sen = input()
rec = input()
sen_n = sen.count('+') - sen.count('-')
rec_n = rec.count('+') - rec.count('-')
rec_q = rec.count('?')
(a, b) = (abs(rec_n - sen_n) + (rec_q - abs(rec_n - sen_n)) // 2, (rec_q - abs(rec_n - sen_n)) // 2)
if a < 0 or b < 0:
	print(0)
else:
	print('%0.10f' % (factorial(a + b) / (factorial(a) * factorial(b) * 2 ** rec_q)))


import itertools
a = input()
b = input()
ap = a.count('+')
am = a.count('-')
bp = b.count('+')
bm = b.count('-')
bq = b.count('?')
if bq == 0:
	if ap == bp:
		print(1.0)
	else:
		print(0.0)
else:
	mas = list(itertools.product('+-', repeat=bq))
	if ap >= bp and am >= bm:
		ap -= bp
		am -= bm
		count = 0
		for el in mas:
			tmp_s = ''.join(el)
			if tmp_s.count('+') == ap and tmp_s.count('-') == am:
				count += 1
		print(count / len(mas))
	else:
		print(0.0)


(ans, power) = (0, 0)

def comb(x, y, d):
	global ans, power
	if d == 0:
		if x == y:
			ans += 1
		power += 1
		return
	comb(x, y + 1, d - 1)
	comb(x, y - 1, d - 1)
a = list(input())
b = list(input())
(x, y, d) = (0, 0, 0)
for i in range(len(a)):
	if a[i] == '+':
		x += 1
	if a[i] == '-':
		x -= 1
	if b[i] == '?':
		d += 1
	if b[i] == '+':
		y += 1
	if b[i] == '-':
		y -= 1
comb(x, y, d)
print('{0:.12f}'.format(ans / power))


m1 = list(input())
m2 = list(input())
n = len(m1)
c1 = 0
for d in m1:
	c1 += 1 if d == '+' else -1
c_m = []

def go(step, pos):
	if step == n:
		c_m.append(pos)
		return
	d = m2[step]
	if d == '+' or d == '?':
		go(step + 1, pos + 1)
	if d == '-' or d == '?':
		go(step + 1, pos - 1)
go(0, 0)
cnt = c_m.count(c1)
if cnt:
	print('%1.12f' % float(cnt / len(c_m)))
else:
	print('%1.12f' % 0)


a = input()
b = input()
p = a.count('+') - a.count('-')
MOD = 20
arr = [0] * 100
arr[MOD + p] = 1
for i in b:
	if i == '+':
		arr = arr[1:] + [0]
	elif i == '-':
		arr = [0] + arr[:-1]
	else:
		x = [0] * 100
		for i in range(1, 99):
			x[i - 1] += arr[i] / 2
			x[i + 1] += arr[i] / 2
		arr = x
print(arr[MOD])


s1 = input()
s2 = input()
count = 0
t = []
for i in s1:
	if i == '+':
		count += 1
	elif i == '-':
		count -= 1
for i in s2:
	if len(t) == 0:
		if i == '+':
			t.append(1)
		elif i == '-':
			t.append(-1)
		else:
			t.append(1)
			t.append(-1)
	elif i == '+':
		for j in range(len(t)):
			t[j] = t[j] + 1
	elif i == '-':
		for j in range(len(t)):
			t[j] = t[j] - 1
	else:
		l = len(t)
		for j in range(l):
			t.append(t[j] - 1)
			t[j] = t[j] + 1
num = 0
for i in range(len(t)):
	if t[i] == count:
		num += 1
print(num / len(t))


def combination(m, n):
	a = 1
	for i in range(n):
		a *= m - i
	for i in range(1, n + 1):
		a /= i
	return a
command = input()
recognize = input()
command = [i for i in command]
recognize = [i for i in recognize]
comPostive = 0
comNegative = 0
recPostive = 0
recNegative = 0
for i in command:
	if i == '+':
		comPostive += 1
	if i == '-':
		comNegative += 1
for i in recognize:
	if i == '+':
		recPostive += 1
	if i == '-':
		recNegative += 1
postive = comPostive - recPostive
negative = comNegative - recNegative
if postive == 0 and negative == 0:
	print(float(1))
elif postive >= 0 and negative >= 0:
	a = combination(postive + negative, postive)
	b = 2 ** (postive + negative)
	print(a / b)
else:
	print(float(0))


def fac(x):
	if x == 0 or x == 1:
		return 1
	f = 1
	for i in range(2, x + 1):
		f *= i
	return f
s1 = input()
s2 = input()
p = q = n = 0
for i in range(len(s1)):
	if s1[i] == '+':
		p += 1
	else:
		n += 1
	if s2[i] == '+':
		p -= 1
	elif s2[i] == '-':
		n -= 1
	else:
		q += 1
if p < 0 or n < 0:
	print(0)
else:
	k = fac(q) / fac(n) / fac(p) / pow(2, q)
	print(k)


import math
(s1, s2) = (input(), input())
(p1, p2, m1, m2, q) = (0, 0, 0, 0, 0)
if s1 == s2:
	print(1 / 1)
else:
	for i in range(len(s1)):
		if s1[i] == '+':
			p1 += 1
		elif s1[i] == '-':
			m1 += 1
		if s2[i] == '+':
			p2 += 1
		elif s2[i] == '-':
			m2 += 1
		elif s2[i] == '?':
			q += 1
	pa = abs(p1 - p2)
	ma = abs(m1 - m2)
	if pa + ma == q:
		print(math.factorial(q) / (math.factorial(pa) * math.factorial(ma) * pow(2, q)))
	else:
		print(0 / 1)


import itertools
s1 = input()
s2 = input()
s1_p = s1.count('+')
s1_n = s1.count('-')
s2_p = s2.count('+')
s2_n = s2.count('-')
s2_q = s2.count('?')
correct_pos = s1_p - s1_n
drea_pos = s2_p - s2_n
diff_pos = correct_pos - drea_pos
if s2_q == 0:
	if diff_pos == 0:
		print(1.0)
	else:
		print(0.0)
else:
	num = 0
	den = 0
	for c in itertools.product([1, -1], repeat=s2_q):
		if sum(c) == diff_pos:
			num += 1
		den += 1
	print('{0:.10f}'.format(float(num) / den))


a = input()
b = input()
expected = a.count('+') - a.count('-')

def solve(i, val):
	if i == len(b):
		return 1 if val == expected else 0
	if b[i] == '+':
		return solve(i + 1, val + 1)
	elif b[i] == '-':
		return solve(i + 1, val - 1)
	else:
		return solve(i + 1, val + 1) + solve(i + 1, val - 1)
print('%.12f' % (solve(0, 0) / pow(2, b.count('?'))))


from math import factorial as fact

def cou(i):
	a = i.count('+')
	b = i.count('-')
	c = i.count('?')
	return (a, b, c)
(p, q, e) = cou(input())
(r, s, f) = cou(input())
if p - r < 0 or q - s < 0:
	print(0)
elif p - r == 0 and q - s == 0:
	print(1)
else:
	m = p - r
	w = q - s
	k = fact(f) / (fact(m) * fact(w))
	n = 2 ** f
	print(k / n)


from math import factorial as fact
s1 = input()
s2 = input()
plus1 = s1.count('+')
minus1 = s1.count('-')
plus2 = s2.count('+')
minus2 = s2.count('-')
qCount = s2.count('?')
if plus1 == plus2 and minus1 == minus2:
	print(1)
else:
	plusReq = plus1 - plus2
	minusReq = minus1 - minus2
	if plusReq >= 0 and minusReq >= 0:
		ans = 0.5 ** qCount * fact(qCount) / (fact(plusReq) * fact(minusReq))
		print(ans)
	else:
		print(0)


from math import factorial as f

def count(a, b):
	return f(a + b) // f(a) // f(b)
s1 = input()
s2 = input()
pos1 = s1.count('+') - s1.count('-')
pos2 = s2.count('+') - s2.count('-')
a = pos1 - pos2
b = s2.count('?')
s = a + b
if s % 2 != 0 or s // 2 > b or s // 2 < 0:
	print(0)
else:
	plus = s // 2
	minus = b - plus
	print(count(plus, minus) / 2 ** b)


from collections import Counter
from math import factorial
s1 = input()
s2 = input()

def prob(n, k):
	if n < k:
		return 0
	den = factorial(n - k) * factorial(k) * 2 ** n
	return factorial(n) / den
ps1 = Counter(s1)['+']
ps2 = Counter(s2)['+']
nq2 = Counter(s2)['?']
diffp = ps1 - ps2
ans = 0
if diffp >= 0:
	ans = prob(nq2, diffp)
print('%0.12f' % ans)


def prob_right():
	Drazil = input()
	Drazil = sum([1 if d == '+' else -1 for d in Drazil])
	Dreamoon = input()
	Dreamoon = [1 if d == '+' else -1 if d == '-' else -100 for d in Dreamoon]
	if Drazil == sum(Dreamoon):
		return 1.0
	possible = []

	def dfs(index, Dreamoon, current, possible):
		i = index
		while i < len(Dreamoon):
			if Dreamoon[i] == -100:
				dfs(i + 1, Dreamoon, current + 1, possible)
				dfs(i + 1, Dreamoon, current - 1, possible)
				break
			else:
				current += Dreamoon[i]
				i += 1
		if i == len(Dreamoon):
			possible.append(current)
	dfs(0, Dreamoon, 0, possible)
	correct = sum([1 for val in possible if val == Drazil])
	return correct / len(possible)
print(prob_right())


a = input()
b = input()
p1 = 0
for i in a:
	if i == '+':
		p1 += 1
	else:
		p1 -= 1
count = 0
p2 = 0
for i in b:
	if i == '+':
		p2 += 1
	elif i == '-':
		p2 -= 1
	else:
		count += 1
s = 0
if count == 0:
	if p2 == p1:
		print('%.12f' % 1)
	else:
		print('%.12f' % 0)
else:
	for i in range(2 ** count):
		p = 0
		k = i
		plus = 0
		while k:
			if k % 2:
				plus += 1
			k //= 2
		minus = count - plus
		if p2 + plus - minus == p1:
			s += 1
	j = s / 2 ** count
	print('%.12f' % j)


def fact(n):
	if n <= 1:
		return 1
	else:
		return fact(n - 1) * n
t = 1
while t:
	t -= 1
	x = input()
	x = list(x)
	y = input()
	y = list(y)
	a = x.count('+')
	b = x.count('-')
	s = a - b
	a1 = y.count('+')
	b1 = y.count('-')
	q1 = y.count('?')
	if q1 == 0:
		if a1 - b1 == s:
			print('{0:.9f}'.format(1.0))
		else:
			print('{0:.9f}'.format(0.0))
	else:
		l = []
		temp1 = fact(q1)
		i = 0
		s1 = a1 - b1
		while q1 >= 0:
			t1 = fact(q1)
			t2 = fact(i)
			temp = temp1 / (t1 * t2)
			l.extend([s1 + (q1 - i)] * int(temp))
			q1 -= 1
			i += 1
		print('{0:.9f}'.format(l.count(s) / float(len(l))))


import math

def sequence_split_up(sequence):
	ans = [0, 0, 0]
	for i in sequence:
		if i == '+':
			ans[0] += 1
		elif i == '-':
			ans[1] += 1
		elif i == '?':
			ans[2] += 1
	return ans

def probability():
	actual_sequence = sequence_split_up(drazil_send)
	sequence_received = sequence_split_up(dreamoon_received)
	total_len = sum(actual_sequence)
	actual_ans = actual_sequence[0] - actual_sequence[1]
	ans_received = sequence_received[0] - sequence_received[1]
	difference = actual_ans - ans_received
	no_of_blanks = sequence_received[2]
	if no_of_blanks == 0:
		if actual_ans != ans_received:
			return 0
		return 1
	if abs(difference) > no_of_blanks:
		return 0
	ans_set = [0, 0]
	if difference > 0:
		ans_set[0] += difference
	elif difference < 0:
		ans_set[1] += abs(difference)
	blanks_left = no_of_blanks - abs(difference)
	ans_set[0] = ans_set[0] + blanks_left // 2
	ans_set[1] = ans_set[1] + blanks_left // 2
	x = math.factorial(no_of_blanks) // (math.factorial(ans_set[0]) * math.factorial(ans_set[1])) / math.pow(2, no_of_blanks)
	return x
drazil_send = input()
dreamoon_received = input()
print('%.12f' % probability())


from itertools import chain
(d1, d2) = (input(), input())
s1 = sum([1 if x == '+' else -1 for x in d1])
d = [0]
for s in d2:
	if s == '+':
		d = [x + 1 for x in d]
	elif s == '-':
		d = [x - 1 for x in d]
	else:
		d = list(chain.from_iterable(((x + 1, x - 1) for x in d)))
print(round(d.count(s1) / len(d), 9))


from sys import stdin, stdout
from sys import maxsize
input = stdin.readline

def solve():
	pass

def chose(n, r):
	r = max(r, n - r)
	ans = 1
	for i in range(r + 1, n + 1):
		ans *= i
	for j in range(1, n - r + 1):
		ans //= j
	return ans
test = 1
for t in range(0, test):
	s1 = list(input().strip())
	s2 = list(input().strip())
	(c, c_, ex) = (0, 0, 0)
	for el in s1:
		if el == '+':
			c += 1
		else:
			c -= 1
	for el in s2:
		if el == '+':
			c_ += 1
		elif el == '-':
			c_ -= 1
		else:
			ex += 1
	ans = 0
	temp = ex - abs(c_ - c)
	if temp >= 0 and temp % 2 == 0:
		x = temp // 2
		ans = chose(ex, x)
		ans = ans / (1 << ex)
	print(ans)
	ans = solve()


def findAllFinalPositions(instructions):
	finalPositions = [0]
	for instruction in instructions:
		if instruction == '+':
			for i in range(len(finalPositions)):
				finalPositions[i] += 1
		elif instruction == '-':
			for i in range(len(finalPositions)):
				finalPositions[i] -= 1
		else:
			new_list = []
			for position in finalPositions:
				new_list.append(position + 1)
				new_list.append(position - 1)
			finalPositions = new_list
	return finalPositions
instructions1 = input()
real_final_position = findAllFinalPositions(instructions1)[0]
instructions2 = input()
all_possible_final_positions = findAllFinalPositions(instructions2)
print(all_possible_final_positions.count(real_final_position) / len(all_possible_final_positions))


s1 = input()
s2 = input()
n = len(s1)
k1 = 0
for i in range(n):
	if s1[i] == '+':
		k1 += 1
	else:
		k1 -= 1
k2 = 0
z = 0
for i in range(n):
	if s2[i] == '+':
		k2 += 1
	elif s2[i] == '-':
		k2 -= 1
	else:
		z += 1
a1 = 0
a2 = 0
k2 = k1 - k2
import math
for i in range(z + 1):
	a2 += math.factorial(z) // (math.factorial(i) * math.factorial(z - i))
	if z - 2 * i == k2:
		a1 += math.factorial(z) // (math.factorial(i) * math.factorial(z - i))
print(a1 / a2)


def resolve(path, goal):
	if '?' not in path:
		if path.count('+') - path.count('-') != goal:
			return 0
		else:
			return 1
	index = path.index('?')
	return resolve(path[:index] + '+' + path[index + 1:], goal) + resolve(path[:index] + '-' + path[index + 1:], goal)
cmds = input()
drmoon = input()
total = 2 ** drmoon.count('?')
print(resolve(drmoon, cmds.count('+') - cmds.count('-')) / total)


from math import factorial as f

def C(n, k):
	return f(n) // (f(n - k) * f(k))
s = input()
t = input()
p = s.count('+')
p2 = t.count('+')
q = t.count('?')
if p == p2:
	ans = 0.5 ** q
elif p2 > p:
	ans = 0
elif q < p - p2:
	ans = 0
else:
	ans = C(q, p - p2) / 2 ** q
print(ans)


s1 = str(input())
s2 = str(input())
prob = 1.0
aux = []
parada1 = 0
parada2 = 0
for i in range(len(s1)):
	if s1[i] == '+':
		parada1 += 1
	else:
		parada1 -= 1
	if s2[i] == '+':
		parada2 += 1
	elif s2[i] == '-':
		parada2 -= 1
	elif len(aux) == 0:
		aux = [1, -1]
	else:
		s = []
		for i in aux:
			s.append(i + 1)
			s.append(i - 1)
		aux = s
count = 0
for i in range(len(aux)):
	aux[i] += parada2
	if aux[i] == parada1:
		count += 1
if len(aux) == 0 and parada1 != parada2:
	prob = 0
elif len(aux) != 0:
	prob = count / len(aux)
print(prob)


from math import factorial as f
s1 = input()
s2 = input()
cp = s1.count('+') - s1.count('-')
wp = s2.count('+') - s2.count('-')
qc = s2.count('?')
dp = max(cp - wp, wp - cp)
if dp > qc or dp % 2 != qc % 2:
	print(0)
else:
	k1 = (qc + dp) // 2
	k2 = (qc - dp) // 2
	print(f(qc) / f(k1) / f(k2) / (1 << qc))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
a = input().strip()
b = input().strip()
dst = x = q = 0
for i in a:
	if i == '+':
		dst += 1
	else:
		dst -= 1
for i in b:
	if i == '+':
		x += 1
	elif i == '-':
		x -= 1
	else:
		q += 1
x = dst - x
ds = [0]
for i in range(q):
	new = []
	for k in ds:
		new.append(k + 1)
	for k in ds:
		new.append(k - 1)
	ds = new
ans = ds.count(x) / len(ds)
print(ans)


from itertools import chain
line = input()
p = line.count('+') - line.count('-')
d = [0]
for c in input():
	if c == '-':
		d = [x - 1 for x in d]
	elif c == '+':
		d = [x + 1 for x in d]
	else:
		d = list(chain.from_iterable(((x + 1, x - 1) for x in d)))
print(round(d.count(p) / len(d), 9))


import math
import sys

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
st1 = input()
st2 = input()
plus1 = int(st1.count('+'))
plus2 = int(st2.count('+'))
minus1 = int(st1.count('-'))
minus2 = int(st2.count('-'))
ques2 = int(st2.count('?'))
ans1 = plus1 - minus1
ans2 = plus2 - minus2
if ques2 == 0:
	if ans1 == ans2:
		print(1)
	else:
		print(0)
	sys.exit()
ans3 = int(ans1 - ans2)
temp = ques2
for i in range(0, ques2 + 1):
	if temp - i == ans3:
		break
	temp = temp - 1
if temp - i != ans3:
	print(0)
	sys.exit()
value = int(nCr(ques2, temp))
print(value / pow(2, ques2))


s1 = list(input())
s2 = list(input())
n = len(s1)
pos = [0]
for i in range(n):
	if s1[i] == '+':
		pos.append(pos[i] + 1)
	else:
		pos.append(pos[i] - 1)
pos2 = [[0]]
for i in range(n):
	if s2[i] == '?':
		a = []
		for j in pos2[i]:
			a.append(j + 1)
			a.append(j - 1)
		pos2.append(a)
	elif s2[i] == '+':
		a = []
		for j in pos2[i]:
			a.append(j + 1)
		pos2.append(a)
	elif s2[i] == '-':
		a = []
		for j in pos2[i]:
			a.append(j - 1)
		pos2.append(a)
count = 0
for t in pos2[-1]:
	if t == pos[-1]:
		count += 1
print('{:0.15f}'.format(count / len(pos2[-1])))


import math
s = input()
s1 = input()
plus = s.count('+') - s1.count('+')
minus = s.count('-') - s1.count('-')
v = s1.count('?')
if plus < 0 or minus < 0:
	print(0)
	exit()
print(math.factorial(v) / math.factorial(v - plus) / math.factorial(plus) * 0.5 ** v)


import math
list1 = list(input())
list2 = list(input())
mais1 = list1.count('+')
menos1 = list1.count('-')
mais2 = list2.count('+')
menos2 = list2.count('-')
interrogacao = list2.count('?')
if interrogacao == 0 and mais1 == mais2:
	print('%.12f' % 1)
elif mais2 > mais1 or menos2 > menos1:
	print('%.12f' % 0)
elif mais1 == mais2 or menos1 == menos2:
	print('%.12f' % 0.5 ** interrogacao)
else:
	a = mais1 - mais2
	b = menos1 - menos2
	res = 0.5 ** a * 0.5 ** b * (math.factorial(a + b) / (math.factorial(a) * math.factorial(b)))
	print('%.12f' % res)


from collections import deque
s1 = input().strip()
s2 = input().strip()
final_pos_s1 = 0
for cmd in s1:
	final_pos_s1 += 1 if cmd == '+' else -1
anchor_point_s2 = 0
num_question_marks = 0
for cmd in s2:
	if cmd == '?':
		num_question_marks += 1
	else:
		anchor_point_s2 += 1 if cmd == '+' else -1
if num_question_marks == 0:
	print(1 if final_pos_s1 == anchor_point_s2 else 0)
else:
	q = deque()
	for i in range(num_question_marks):
		if i == 0:
			q.appendleft(anchor_point_s2 - 1)
			q.appendleft(anchor_point_s2 + 1)
		else:
			qlen = len(q)
			for _ in range(qlen):
				cur = q.pop()
				q.appendleft(cur - 1)
				q.appendleft(cur + 1)
	num_correct_positions = 0
	for e in q:
		if e == final_pos_s1:
			num_correct_positions += 1
	probability = num_correct_positions / len(q)
	print(probability)


sent = input()
recv = input()
reqd = 0
count = 0
for i in range(len(sent)):
	if recv[i] == '?':
		count += 1
		if sent[i] == '+':
			reqd += 1
		else:
			reqd -= 1
	if sent[i] == '+' and recv[i] == '-':
		reqd += 2
	if sent[i] == '-' and recv[i] == '+':
		reqd -= 2
favourable = 0
total = 2 ** count

def recur(n, cur):
	global reqd, favourable
	if n == 0:
		if cur == reqd:
			favourable += 1
		return
	recur(n - 1, cur + 1)
	recur(n - 1, cur - 1)
recur(count, 0)
print(favourable / total)


def popcount(x):
	if x == 0:
		return 0
	else:
		return (x & 1) + popcount(x >> 1)
totald = input()
total = 0
for i in totald:
	if i == '+':
		total += 1
	else:
		total -= 1
currentd = input()
current = 0
nani = 0
for i in currentd:
	if i == '+':
		current += 1
	elif i == '-':
		current -= 1
	else:
		nani += 1
travel = abs(total - current)
if nani == 0:
	if travel == 0:
		print(1 / 1)
		exit()
	else:
		print(0 / 1)
		exit()
total = 0
numbers = [int(x) for x in range(2 ** nani)]
for i in numbers:
	if 2 * popcount(i) - nani == travel:
		total += 1
print(total / 2 ** nani)


s1 = input()
s2 = input()
summa = 0
for i in range(len(s1)):
	if s1[i] == '-':
		summa -= 1
	else:
		summa += 1
summ = 0

def gen(sum1, qw):
	global summ, summa
	if qw == 0:
		if sum1 == summa:
			summ += 1
		return
	else:
		gen(sum1 + 1, qw - 1)
		gen(sum1 - 1, qw - 1)
sum1 = 0
qw = 0
for i in range(len(s2)):
	if s2[i] == '-':
		sum1 -= 1
	elif s2[i] == '+':
		sum1 += 1
	else:
		qw += 1
gen(sum1, qw)
print(summ / 2 ** qw)


a = str(input())
b = str(input())
difference = 0
unknown = 0
for x in range(len(a)):
	if a[x] == '+':
		difference += 1
	else:
		difference -= 1
	if b[x] == '?':
		unknown += 1
	elif b[x] == '+':
		difference -= 1
	else:
		difference += 1
difference = abs(difference)
dp = max(unknown, difference) * [0] + [0] + [1] + [0] + max(unknown, difference) * [0]
for x in range(unknown):
	new_dp = [0] * (len(dp) - 2)
	for x in range(len(new_dp)):
		new_dp[x] = dp[x] * 0.5 + dp[x + 2] * 0.5
	dp = [0] + new_dp + [0]
print(dp[max(unknown, difference) + 1 + difference])


import math
a = input()
b = input()
rP = a.count('+') - a.count('-')
p = b.count('+') - b.count('-')
dist = abs(rP - p)
q = b.count('?')
if (q - dist) % 2 or q - dist < 0:
	print('0.0')
else:
	eqw = (q - dist) // 2
	prob = math.factorial(q) / (math.factorial(q - eqw) * math.factorial(eqw)) * 0.5 ** q
	print(prob)


n1 = input()
n2 = input()
pos = 0
for i in n1:
	if i == '+':
		pos = pos + 1
	else:
		pos = pos - 1
ll = []
ans = [0]
for j in n2:
	if j == '+':
		for i in range(len(ans)):
			ans[i] += 1
	elif j == '-':
		for i in range(len(ans)):
			ans[i] -= 1
	else:
		l1 = []
		for i in range(len(ans)):
			l1.append(ans[i] - 1)
		for i in range(len(ans)):
			ans[i] += 1
		ans.extend(l1)
sol = 0
for i in ans:
	if i == pos:
		sol += 1
print('{0:.12f}'.format(sol / len(ans)))


def fact(n):
	if n == 1 or n == 0:
		return 1
	else:
		p = 1
		for i in range(1, n + 1):
			p *= i
		return p
s = input()
s2 = input()
p = s.count('+')
m = s.count('-')
c = s2.count('+')
d = s2.count('-')
if p == c and m == d:
	print(1)
elif p >= c and m >= d and (c + d + (len(s2) - (c + d)) == len(s2)):
	remc = p - c
	remd = m - d
	totalcom = 2 ** (remc + remd)
	validpermu = fact(remc + remd) / (fact(remc) * fact(remd))
	print(validpermu / totalcom)
else:
	print(0)


a = input()
b = input()
pa = a.count('+')
na = a.count('-')
pb = b.count('+')
nb = b.count('-')
if pb > pa or nb > na:
	print(0)
elif pb == pa and nb == na:
	print(1)
else:
	r = pa - pb
	q = b.count('?')
	u = 1
	d = 1
	for i in range(r):
		u *= q - i
		d *= i + 1
	ans = u // d
	print(ans / 2 ** q)


import math
a = list(input())
b = list(input())
p = a.count('+') - b.count('+')
m = a.count('-') - b.count('-')
if m < 0 or p < 0:
	print(0)
	exit(0)
l = math.factorial(p + m) / (math.factorial(p) * math.factorial(m))
print(l * 0.5 ** (p + m))


import math
drazilCommands = list(input())
dreamoonCommands = list(input())
finalPos = 0
currPos = 0
unknown = 0
for i in drazilCommands:
	if i == '+':
		finalPos += 1
	else:
		finalPos -= 1
for i in dreamoonCommands:
	if i == '+':
		currPos += 1
	elif i == '-':
		currPos -= 1
	else:
		unknown += 1
x = int((unknown + (finalPos - currPos)) / 2)
if x > unknown or x < 0:
	probability = 0.0
else:
	probability = math.factorial(unknown) / (math.factorial(x) * math.factorial(unknown - x)) / 2 ** unknown
print(probability)


from itertools import product
sum_a = sum(map(lambda l: 1 if l == '+' else -1, input()))
ins_b = input()
sum_b = 0
unk = 0
for char in ins_b:
	if char == '+':
		sum_b += 1
	elif char == '-':
		sum_b -= 1
	else:
		unk += 1
if unk == 0 and sum_b == sum_a:
	print(1.0)
elif unk == 0:
	print(0.0)
else:
	right = 0
	total = 0
	for num in product([1, -1], repeat=unk):
		if sum(num) + sum_b == sum_a:
			right += 1
		total += 1
	print(right / total)


import math
a = input()
b = input()
x = a.count('+') - b.count('+')
y = a.count('-') - b.count('-')
c = a.count('+') - a.count('-')
d = b.count('+') - b.count('-')
e = c - d
f = b.count('?')
if x == 0 and y == 0:
	print(1)
elif f == 0 and (x != 0 or y != 0):
	print(0)
elif x != 0 and y == 0:
	print(1 / 2 ** f)
elif y != 0 and x == 0:
	print(1 / 2 ** f)
elif abs(e) > f:
	print(0)
else:
	print(math.factorial(f) / (math.factorial(y) * math.factorial(x) * 2 ** f))


def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
s1 = input()
s2 = input()
l1 = [0, 0]
l2 = [0, 0, 0]
l1[0] = s1.count('+')
l1[1] = s1.count('-')
l2[0] = s2.count('+')
l2[1] = s2.count('-')
l2[2] = s2.count('?')
if l1[0] == l2[0] and l1[1] == l2[1]:
	print('%.10f' % 1)
elif l2[2] == 0 and (l1[0] != l2[0] or l1[1] != l2[1]):
	print('%.10f' % 0)
else:
	mx = l1.index(max(l1))
	if l1[mx] > l2[mx] + l2[2]:
		print('%.10f' % 0)
	else:
		d1 = l1[0] - l2[0]
		d2 = l1[1] - l2[1]
		print('%.10f' % (nCr(l2[2], d2) / 2 ** l2[2]))


from functools import reduce
a = list(str(input()))
b = list(str(input()))
c = s = 0
for it in a:
	if it == '+':
		s += 1
for it in b:
	if it == '+':
		s -= 1
	elif it == '?':
		c += 1
if s < 0:
	print(0.0)
elif c == 0:
	if s == 0:
		print(1.0)
	else:
		print(0.0)
else:
	la = list(range(1, s + 1))
	la.append(1)
	lb = list(range(c + 1 - s, c + 1))
	lb.append(1)
	print(reduce(lambda x, y: x * y, lb) // reduce(lambda x, y: x * y, la) / 2 ** c)


def btrack(to_be, arr, change):
	if to_be == 0:
		if sum(arr) - arr[0] == change:
			arr[0] += 1
	else:
		arr.append(1)
		btrack(to_be - 1, arr, change)
		arr.pop()
		arr.append(-1)
		btrack(to_be - 1, arr, change)
		arr.pop()
correct = input()
wrong = input()
corr = 0
worr = 0
to_be = 0
for i in correct:
	if i == '+':
		corr += 1
	elif i == '-':
		corr -= 1
for i in wrong:
	if i == '+':
		worr += 1
	elif i == '-':
		worr -= 1
	elif i == '?':
		to_be += 1
change = abs(corr - worr)
arr = []
arr.append(0)
btrack(to_be, arr, change)
print(arr[0] / 2 ** to_be)


x = 0
cnt = 0

def count_func(n, m):
	global cnt
	global x
	if m == 0:
		if n == x:
			cnt += 1
		return
	count_func(n + 1, m - 1)
	count_func(n - 1, m - 1)
input_str = input()
for i in range(len(input_str)):
	if input_str[i] == '+':
		x += 1
	else:
		x -= 1
input_str = input()
y = 0
z = 0
for i in range(len(input_str)):
	if input_str[i] == '+':
		y += 1
	elif input_str[i] == '-':
		y -= 1
	else:
		z += 1
count_func(y, z)
ans = float(1.0 / pow(2, z) * cnt)
print('%.15f' % ans)


import math

def ncr(n, r):
	return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
s1 = input()
r1 = sum((1 for ch in s1 if ch == '+'))
pos1 = r1 - (len(s1) - r1)
s2 = input()
r2 = sum((1 for ch in s2 if ch == '+'))
l2 = sum((1 for ch in s2 if ch == '-'))
q2 = len(s2) - r2 - l2
pos2 = r2 - l2
if pos2 - q2 > pos1 or pos2 + q2 < pos1 or abs(pos1 - pos2) % 2 != q2 % 2:
	print(0.0)
else:
	print(ncr(q2, (pos1 - (pos2 - q2)) // 2) / 2 ** q2)


T = input('')
T1 = input('')
cont = 0
casos = 0
for k in T:
	if k == '+':
		cont += 1
	else:
		cont -= 1
L = [0]
for k in T1:
	L1 = []
	if k == '?':
		casos += 1
	for j in range(len(L)):
		if k == '+':
			L[j] += 1
		elif k == '-':
			L[j] -= 1
		elif k == '?':
			L1 += [L[j] + 1]
			L1 += [L[j] - 1]
	if len(L1) > 0:
		L = L1
cont1 = 0
for k in range(len(L)):
	if L[k] == cont:
		cont1 += 1
print('%.12f' % (cont1 / 2 ** casos))


raw_input = input

def fn(s, n, i, req, got):
	if i == n:
		if got == req:
			return 1
		return 0
	if s[i] == '+':
		return fn(s, n, i + 1, req, got + 1)
	if s[i] == '-':
		return fn(s, n, i + 1, req, got - 1)
	return fn(s, n, i + 1, req, got + 1) + fn(s, n, i + 1, req, got - 1)
corr = raw_input()
s = raw_input()
temp = 0
qs = 0
for i in s:
	if i == '?':
		qs += 1
for i in corr:
	if i == '+':
		temp += 1
	else:
		temp -= 1
ans = fn(s, len(s), 0, temp, 0) * 0.1 / ((1 << qs) * 0.1)
print('%.9f' % ans)


import math
first = input()
second = input()
delta = first.count('+') - first.count('-') - (second.count('+') - second.count('-'))
cnt = second.count('?')
if (delta + cnt) % 2 != 0:
	print(0)
else:
	x = (delta + cnt) // 2
	if x >= 0 and x <= cnt:
		ans = math.factorial(cnt) // (math.factorial(x) * math.factorial(cnt - x))
		print(ans / 2 ** cnt)
	else:
		print(0)


def pos_ends(sent_pos, recieved_pos, varience_values):
	if varience_values == 0:
		return 1 if sent_pos == recieved_pos else 0
	else:
		return pos_ends(sent_pos, recieved_pos + 1, varience_values - 1) + pos_ends(sent_pos, recieved_pos - 1, varience_values - 1)

def main():
	sent = input().strip()
	recieved = input().strip()
	sent_pos = 0
	recieved_pos = 0
	varience_values = 0
	for i in range(0, len(sent)):
		if sent[i] == '+':
			sent_pos += 1
		else:
			sent_pos -= 1
		if recieved[i] == '+':
			recieved_pos += 1
		elif recieved[i] == '-':
			recieved_pos -= 1
		else:
			varience_values += 1
	if varience_values == 0 and sent_pos == recieved_pos:
		print('1.0')
		return
	num_valid_positions = pos_ends(sent_pos, recieved_pos, varience_values)
	print('{}'.format(num_valid_positions / 2 ** varience_values))
	return
main()


x = input()
y = input()
actual = 0
for i in x:
	if i == '+':
		actual += 1
	else:
		actual -= 1
l = len(y)
(counta, count) = (0, 0)
q = []
q.append((0, 0))
while len(q) != 0:
	p = q.pop()
	if p[1] == l:
		count += 1
		if p[0] == actual:
			counta += 1
		continue
	if y[p[1]] == '?':
		q.append((p[0] + 1, p[1] + 1))
		q.append((p[0] - 1, p[1] + 1))
	else:
		q.append((p[0] + (1 if y[p[1]] == '+' else -1), p[1] + 1))
print(counta / count)


fact = [1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0, 3628800.0]
s = input()
s1 = input()
(k, k1, kv) = (0, 0, 0)
for c in s:
	if c == '+':
		k += 1
	else:
		k -= 1
for c in s1:
	if c == '+':
		k1 += 1
	if c == '-':
		k1 -= 1
	if c == '?':
		kv += 1
d = k - k1
if d < 0:
	d = -d
if d > kv or (d % 2 and (not kv % 2)):
	print(0.0)
elif d == 0 and kv == 0:
	print(1.0)
else:
	print(fact[kv] / fact[int((kv - d) / 2)] / fact[kv - int((kv - d) / 2)] / 2.0 ** kv)


def dv(n):
	m = n
	p = 1
	d1 = 0
	while m > 0:
		d1 = d1 + m % 2 * p
		p = p * 10
		m = m // 2
	return d1
a = list(input())
b = list(input())
cord1 = a.count('+') - a.count('-')
cord2 = b.count('+') - b.count('-')
kol = b.count('?')
if kol != 0:
	ll = 0
	for i in range(0, 2 ** kol + 1):
		cord = cord2
		mas = list(str(dv(i)))
		mas1 = ['0'] * (kol - len(mas))
		mas = mas1 + mas
		for j in mas:
			if j == '1':
				cord += 1
			else:
				cord -= 1
		if cord == cord1:
			ll += 1
	print(ll / 2 ** kol)
elif cord1 == cord2:
	print(1)
else:
	print(0)


import sys
correct = 0

def f(s1, s2, i, suma, sumatemp):
	global correct
	if i == len(s2):
		if sumatemp == suma:
			correct += 1
	elif s2[i] == '?':
		f(s1, s2, i + 1, suma, sumatemp + 1)
		f(s1, s2, i + 1, suma, sumatemp - 1)
	else:
		if s2[i] == '+':
			sumatemp += 1
		else:
			sumatemp -= 1
		f(s1, s2, i + 1, suma, sumatemp)
n = 1
s1 = sys.stdin.readline().strip().replace(' ', '')
s2 = sys.stdin.readline().strip().replace(' ', '')
suma = 0
ways = 1
correct = 0
for i in range(len(s1)):
	if s1[i] == '+':
		suma += 1
	else:
		suma -= 1
	if s2[i] == '?':
		ways *= 2
f(s1, s2, 0, suma, 0)
print(correct / ways)


from math import factorial
a = input()
b = input()
ap = a.count('+')
bp = b.count('+')
dp = ap - bp
bq = b.count('?')
if dp < 0:
	print(0.0)
	exit(0)
if bq - dp < 0:
	print(0.0)
	exit(0)
print(factorial(bq) / factorial(dp) / factorial(bq - dp) / (1 << bq))


dz = input()
dm = input()
import itertools
ac_o = dz.count('+') * 1 + dz.count('-') * -1
dm_o = dm.count('+') * 1 + dm.count('-') * -1
conds = dm.count('?')
c = 0
for i in itertools.product([1, -1], repeat=conds):
	if sum(i) + dm_o == ac_o:
		c += 1
print(format(c / 2 ** conds, '.12f'))


def nCr(n, r):
	return fact[n] // (fact[r] * fact[n - r])
fact = [1]
for i in range(1, 11):
	fact.append(fact[-1] * i)
s1 = input()
s2 = input()
p1 = s1.count('+')
p2 = s2.count('+')
x = s2.count('?')
if p2 > p1:
	print(0)
else:
	print(nCr(x, p1 - p2) / 2 ** x)


s = input()
s1 = input()
kol_p = 0
kol_m = 0
kol_p1 = 0
kol_m1 = 0
tmp = 0
for c in s:
	if c == '+':
		kol_p += 1
	else:
		kol_m += 1
for c in s1:
	if c == '+':
		kol_p1 += 1
	elif c == '-':
		kol_m1 += 1
	else:
		tmp += 1
if kol_p1 > kol_p or kol_m1 > kol_m:
	print(0.0)
	exit(0)
nado = kol_p - kol_p1
ans = 1
for i in range(tmp - nado + 1, tmp + 1):
	ans *= i
for i in range(1, nado + 1):
	ans //= i
print(ans / 2 ** tmp)


from collections import Counter
sa = input()
sb = input()
d = Counter(sa)['+'] - Counter(sa)['-']

def dp(s, t, p):
	if s == '':
		if p == t:
			ct.append(1)
		return
	if s[0] == '+':
		dp(s[1:], t, p + 1)
	elif s[0] == '-':
		dp(s[1:], t, p - 1)
	else:
		dp(s[1:], t, p + 1)
		dp(s[1:], t, p - 1)
ct = []
dp(sb, d, 0)
dt = Counter(sb)
if '?' not in sb:
	print(len(ct))
else:
	print(len(ct) / 2 ** dt['?'])


import math
s1 = input()
s2 = input()
moves = s2.count('?')
s2 = s2.replace('?', '')
final_position = 0
for c in s1:
	final_position += 1 if c == '+' else -1
current_position = 0
for c in s2:
	current_position += 1 if c == '+' else -1
distance = current_position - final_position
if abs(distance + moves) % 2 != 0 or moves < abs(distance):
	print(0)
	exit()
m = (moves + abs(distance)) / 2
moves_f = math.factorial(moves)
m_f = math.factorial(m)
nCr = moves_f / (m_f * math.factorial(moves - m))
print(nCr / (1 << moves))


q = 0
for i in input():
	if i == '+':
		q += 1
	else:
		q -= 1
a = k = 0
for i in input():
	if i == '+':
		k += 1
	elif i == '-':
		k -= 1
	else:
		a += 1
arr = [k]
for i in range(a):
	arr.extend(arr)
	for j in range(int(len(arr) / 2)):
		arr[j] += 1
	for j in range(int(len(arr) / 2), len(arr)):
		arr[j] -= 1
hit = arr.count(q)
print(hit / 2 ** a)


import math
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def arr(n, m):
	return math.factorial(n + m) // (math.factorial(m) * math.factorial(n))
s = input().strip()
p = s.count('+')
p = p - (len(s) - p)
s2 = input().strip()
x = 0
c = 0
for i in range(len(s2)):
	if s2[i] == '+':
		x += 1
	elif s2[i] == '-':
		x -= 1
	else:
		c += 1
req = abs(p - x)
if req > c:
	print(0)
elif p > x:
	plus = p - x
	t = c
	c -= plus
	if c % 2 == 0:
		plus += c // 2
		minus = c // 2
		print(arr(plus, minus) / pow(2, t))
	else:
		print(0)
else:
	minus = x - p
	t = c
	c -= minus
	if c % 2 == 0:
		plus = c // 2
		minus += c // 2
		print(arr(plus, minus) / pow(2, t))
	else:
		print(0)


def f(e):
	s = 1
	for i in range(2, e + 1):
		s *= i
	return s
c = sum([1 if i == '+' else -1 for i in input()])
a = 0
d = []
for i in input():
	if i == '+':
		d.append(1)
	elif i == '-':
		d.append(-1)
	else:
		a += 1
if a == 0:
	print([0, 1][c == sum(d)])
else:
	i = (c - sum(d) + a) // 2
	count = f(a) // (f(i) * f(a - i))
	print(count / pow(2, a))


from math import factorial

def dreamoon_wifi2(sdl, sdn):
	qc = 0
	pc = 0
	for (cdl, cdn) in zip(sdl, sdn):
		if cdn == '?':
			qc += 1
			if cdl == '+':
				pc += 1
		elif cdn != cdl:
			if cdl == '+':
				pc += 1
			else:
				pc -= 1
	if abs(pc) > qc:
		return 0.0
	ans = factorial(qc) / (factorial(abs(pc)) * factorial(qc - abs(pc))) / 2 ** qc
	return ans

def dreamoon_wifi(sdl, sdn):
	(sdlp, sdlm) = (sdl.count('+'), sdl.count('-'))
	(sdnp, sdnm, sdnq) = (sdn.count('+'), sdn.count('-'), sdn.count('?'))
	if sdlp < sdnp or sdlm < sdnm or sdlp - sdnp + sdlm - sdnm > sdnq:
		return 0.0
	ans = factorial(sdnq) / (factorial(sdlp - sdnp) * factorial(sdlm - sdnm)) / 2 ** sdnq
	return ans
sdl = input()
sdn = input()
print(dreamoon_wifi(sdl, sdn))


from math import factorial as fact
s1 = input()
s2 = input()
c1 = s1.count('+')
c2 = s1.count('-')
c3 = s2.count('+')
c4 = s2.count('-')
c5 = s2.count('?')
if c1 - c3 < 0 or c2 - c4 < 0:
	print(0)
else:
	res = fact(c5) / (fact(c5 - (c2 - c4)) * fact(c2 - c4))
	print(res / 2 ** c5)


import math
s1 = list(input())
s2 = list(input())
v1 = s1.count('+')
v2 = s1.count('-')
v3 = s2.count('+')
v4 = s2.count('-')
pos = v1 - v3
neg = v2 - v4
if pos < 0 or neg < 0:
	print('%.12f' % 0)
	exit()
var = len(s2) - v3 - v4
if pos > 0 and neg > 0:
	ans = math.factorial(pos + neg) / (2 ** var * math.factorial(pos) * math.factorial(neg))
	print('%.12f' % ans)
else:
	ans = 1 / 2 ** var
	print('%.12f' % ans)


s1 = input()
s2 = input()
m = q = 0
for i in s1:
	m += int(i == '+')
	m -= int(i == '-')
for i in s2:
	m -= int(i == '+')
	m += int(i == '-')
	q += int(i == '?')
m = abs(m)
if m > q or q % 2 != m % 2:
	print(f'{0.0 / 1.0}\n')
else:
	l = list()
	v = n = 1
	d = q
	a = 0
	for i in range(q // 2 + 1):
		a += v if i == q // 2 and q % 2 == 0 else 2 * v
		l.append(v)
		v *= d
		v /= n
		n += 1
		d -= 1
	print(f'{l[-(m // 2) - 1] / a}\n')


import math
s1 = input()
s2 = input()
c1 = s1.count('+')
c2 = s1.count('-')
c3 = s2.count('+')
c4 = s2.count('-')
ans = 0
c = s2.count('?')
if c == 0 and c2 == c4 and (c3 == c1):
	ans = 1 / 1
elif c == 0 and (c3 != c1 or c2 != c4):
	ans = 0 / 1
elif c3 > c1 or c4 > c2:
	ans = 0 / 1
else:
	d1 = c2 - c4
	d2 = c1 - c3
	d = d1 + d2
	ans = math.factorial(d) / (math.factorial(d1) * math.factorial(d2))
	ans /= pow(2, c)
print('{0:.12f}'.format(ans))


dreamoon = input()
drazil = input()
dreamoon_plus = 0
drazil_plus = 0
question_marks = 0
length = 0
for (i, j) in zip(dreamoon, drazil):
	length += 1
	if i == '+':
		dreamoon_plus += 1
	if j == '+':
		drazil_plus += 1
	elif j == '?':
		question_marks += 1
final_position = dreamoon_plus - (length - dreamoon_plus)
drazil_final = drazil_plus - (length - drazil_plus - question_marks)
if question_marks == 0:
	if final_position == drazil_final:
		print(1)
	else:
		print(0)
elif final_position > drazil_final and drazil_final + question_marks < final_position:
	print(0)
elif final_position < drazil_final and drazil_final - question_marks > final_position:
	print(0)
elif abs(drazil_final - final_position) % 2 == 0 and question_marks % 2 == 1:
	print(0)
elif abs(drazil_final - final_position) % 2 == 1 and question_marks % 2 == 0:
	print(0)
else:
	d = final_position - drazil_final
	possible = 0
	n_bits = 1 << question_marks
	for i in range(n_bits):
		plus = bin(i).count('1')
		minus = question_marks - plus
		if plus - minus == d:
			possible += 1
	print(possible / 2 ** question_marks)


matrix = []
for i in range(11):
	aux = []
	for x in range(11):
		aux.append(-1)
	matrix.append(aux)
l1 = input()
l2 = input()
cont1 = [0, 0]
cont2 = [0, 0, 0]
for i in range(len(l1)):
	if l1[i] == '+':
		cont1[0] += 1
	if l2[i] == '+':
		cont2[0] += 1
	if l1[i] == '-':
		cont1[1] += 1
	if l2[i] == '-':
		cont2[1] += 1
	if l2[i] == '?':
		cont2[2] += 1
mas = cont1[0] - cont2[0]
menos = cont1[1] - cont2[1]

def recurcion(x, y):
	if x == 0 and y == 0:
		return 1
	if matrix[x][y] != -1:
		return matrix[x][y]
	else:
		a1 = 0
		a2 = 0
		if x - 1 >= 0:
			a1 = recurcion(x - 1, y)
		if y - 1 >= 0:
			a2 = recurcion(x, y - 1)
		matrix[x][y] = a1 + a2
		return a1 + a2
if mas == 0 and menos == 0:
	print('1')
else:
	print(recurcion(mas, menos) / 2 ** cont2[2])


s1 = input()
s2 = input()
r = 0
f = 0
for x in s1:
	r += 1 if x == '+' else -1
for x in s2:
	if x == '+':
		r -= 1
	elif x == '-':
		r += 1
	else:
		f += 1
a = [[0] * (f * 2 + 1) for i in range(f + 1)]
a[0][f] = 1
for i in range(1, f + 1):
	for j in range(f * 2 + 1):
		if j:
			a[i][j] += a[i - 1][j - 1]
		if j < f * 2:
			a[i][j] += a[i - 1][j + 1]
		a[i][j] /= 2
print('{:.10f}'.format(0) if f < abs(r) else '{:.10f}'.format(a[-1][r + f]))


s1 = input()
s2 = input()
P = s1.count('+') - s1.count('-')
C = s2.count('+') - s2.count('-')
Goal = abs(P - C)
Cnt = s2.count('?')
K = [[0] * 21 for i in range(11)]
K[0][10] = 1.0
for i in range(1, Cnt + 1):
	for j in range(0, 21, 1):
		if j - 1 >= 0:
			K[i][j] += K[i - 1][j - 1] * 0.5
		if j + 1 <= 20:
			K[i][j] += K[i - 1][j + 1] * 0.5
if Goal + 10 <= 20:
	print(K[Cnt][Goal + 10])
else:
	print(0.0)


import sys
s1 = sys.stdin.readline()[:-1]
s2 = sys.stdin.readline()[:-1]
p = [0, 0]
m = [0, 0]
q = 0
Qneed = [0, 0]
for i in range(len(s1)):
	if s1[i] == '+':
		p[0] = p[0] + 1
	elif s1[i] == '-':
		m[0] = m[0] + 1
	if s2[i] == '+':
		p[1] = p[1] + 1
	elif s2[i] == '-':
		m[1] = m[1] + 1
	else:
		q = q + 1
if p[0] > p[1]:
	Qneed[0] = p[0] - p[1]
else:
	Qneed[0] = p[1] - p[0]
if m[0] > m[1]:
	Qneed[1] = m[0] - m[1]
else:
	Qneed[1] = m[1] - m[0]

def findCh(count, pl, mn):
	if pl > 0 or mn > 0:
		if pl > 0:
			count = findCh(count, pl - 1, mn)
		if mn > 0:
			count = findCh(count, pl, mn - 1)
	else:
		count = count + 1
	return count
tmpToAns = abs(p[0] - p[1]) + abs(m[0] - m[1])
if tmpToAns == 0:
	print(1)
elif tmpToAns - q != 0:
	print(0)
else:
	print(findCh(0, Qneed[0], Qneed[1]) / 2 ** (Qneed[0] + Qneed[1]))


def ans(p, k):
	nonlocal d
	if k == n:
		d.append(p)
		return
	ans(p + 1, k + 1)
	ans(p - 1, k + 1)
	return
s1 = input()
s2 = input()
b = 0
k = 0
d = []
for i in s1:
	if i == '+':
		b += 1
	else:
		b -= 1
for i in s2:
	if i == '+':
		b -= 1
	elif i == '-':
		b += 1
	else:
		k += 1
n = k
ans(0, 0)
s = 0
for i in d:
	if i == b:
		s += 1
if b > k:
	print('%.9f' % 0)
elif b == k:
	print('%.9f' % (1 / 2 ** k))
elif (k - b) % 2 == 0:
	print('%.9f' % (s / 2 ** k))
else:
	print('%.9f' % 0)


from math import factorial
s1 = input()
s2 = input()
if '?' not in s2:
	c1 = s1.count('+') - s1.count('-')
	c2 = s2.count('+') - s2.count('-')
	if c1 == c2:
		print('{0:.9f}'.format(1))
	else:
		print('{0:.9f}'.format(0))
elif s2.count('+') > s1.count('+') or s2.count('-') > s1.count('-'):
	print('{0:.9f}'.format(0))
else:
	k = s1.count('+') - s2.count('+')
	n = s2.count('?')
	possi = pow(2, s2.count('?'))
	prob = factorial(n) / (factorial(n - k) * factorial(k)) / possi
	print('{0:.9f}'.format(prob))


brasil = list(input())
lua = list(input())
fb = 0
fl = [0]
for i in brasil:
	if i == '+':
		fb += 1
	else:
		fb -= 1
for i in lua:
	if i == '+':
		for x in range(len(fl)):
			fl[x] += 1
	elif i == '-':
		for x in range(len(fl)):
			fl[x] -= 1
	else:
		fl = fl + fl
		for x in range(0, len(fl) // 2):
			fl[x] -= 1
		for x in range(len(fl) // 2, len(fl)):
			fl[x] += 1
cont = 0
for x in fl:
	if x == fb:
		cont += 1
print(cont / len(fl))


Drazil = sum([int('1') if x == '+' else int('-1') for x in list(input())])
Dreamoon = [int('1') if x == '+' else int('-1') if x == '-' else x for x in list(input())]
num = Dreamoon.count('?')
if num == 0:
	temp = sum(Dreamoon)
	if temp == Drazil:
		print('%.12f' % (temp / Drazil))
	else:
		print('%.12f' % 0)
else:
	sum_ = 0
	for x in Dreamoon:
		if x != '?':
			sum_ += x
	dist = Drazil - sum_
	if (dist + num) % 2 != 0 or num < abs(dist):
		print('%.12f' % 0)
	else:
		m = (num + abs(dist)) // 2
		c = 1
		for i in range(m):
			c *= num - i
		for i in range(2, m + 1):
			c /= i
		answer = c / 2 ** num
		print('%.12f' % answer)


from math import factorial
s = input().rstrip()
s1 = input().rstrip()
pos1 = 0
pos = 0
posi = 0
negi = 0
posi1 = 0
negi1 = 0
ques1 = 0
for i in s:
	if i == '+':
		pos += 1
		posi += 1
	else:
		pos -= 1
		negi += 1
for i in s1:
	if i == '+':
		posi1 += 1
	elif i == '-':
		negi1 += 1
	else:
		ques1 += 1
if posi == posi1 and negi == negi1:
	print(1)
	exit()
diff1 = posi - posi1
diff = negi - negi1
if diff < 0 or diff1 < 0:
	print(0)
else:
	outcomes = 2 ** ques1
	nume = factorial(ques1)
	deno = factorial(ques1 - diff1) * factorial(diff1)
	fav1 = nume / deno
	ques1 = ques1 - diff1
	num1 = factorial(ques1)
	deno1 = factorial(ques1 - diff) * factorial(diff)
	fav2 = num1 / deno1
	ans = fav1 * fav2
	print(ans / outcomes)


s = input()
s1 = input()
(l, l1) = ([], [])
for i in range(len(s)):
	if s[i] == '+':
		l.append(1)
	else:
		l.append(-1)
	if s1[i] == '+':
		l1.append(1)
	elif s1[i] == '-':
		l1.append(-1)
	else:
		l1.append(0)
ans = 0.0
c = l1.count(0)
if c == 0:
	if sum(l) == sum(l1):
		ans = 1.0
	print('{0:.9f}'.format(ans))
	exit()
a = []
s = sum(l1)
for j in range(2 ** c):
	p = 0
	for i in range(c):
		y = j % 2
		j //= 2
		if y == 0:
			p -= 1
		else:
			p += 1
	a.append(s + p)
ans = a.count(sum(l)) / len(a)
print('{0:.9f}'.format(ans))


from math import factorial
real = input()
recog = input()
s_real = 0
s_recog = 0
question = 0
length = 0
for i in real:
	if i == '+':
		s_real += 1
	else:
		s_real -= 1
for i in recog:
	if i == '+':
		s_recog += 1
	elif i == '-':
		s_recog -= 1
	else:
		question += 1
diff = abs(s_recog - s_real)
if diff > question or diff % 2 != question % 2:
	print(0)
else:
	n = (diff + question) / 2
	c = factorial(question) / factorial(n) / factorial(question - n)
	print(c * 0.5 ** question)


import math
s1 = str(input())
s2 = str(input())
d1 = 0
d2 = 0
n = 0
answer = 0
for i in s1:
	if i == '+':
		d1 += 1
	else:
		d1 -= 1
for i in s2:
	if i == '+':
		d2 += 1
	elif i == '?':
		n += 1
	else:
		d2 -= 1
if n >= abs(d2 - d1):
	y = (n - abs(d1 - d2)) / 2
	if y % 1 == 0:
		answer = math.factorial(n) / math.factorial(n - y) / math.factorial(y) / 2 ** n
print('%.9f' % answer)


from math import *

def nCr(n, r):
	f = factorial
	return f(n) / f(r) / f(n - r)
(s1, s2) = [input() for i in range(2)]
(s1_pos, s2_pos, s1_neg, s2_neg, s1_q) = (s1.count('+'), s2.count('+'), s1.count('-'), s2.count('-'), s2.count('?'))
ans = 0
if s1_q == 0:
	if s1_pos == s2_pos:
		ans = 1
	else:
		ans = 0
else:
	diff1 = s1_pos - s2_pos
	if diff1 > s1_q or diff1 < 0:
		ans = 0
	else:
		ans = nCr(s1_q, diff1) / 2 ** s1_q
print('{:.12f}'.format(ans))


import math
sent = input()
received = input()
sp = sent.count('+')
sm = sent.count('-')
rp = received.count('+')
rm = received.count('-')
quest = received.count('?')
dist = sp - rp
if dist < 0 or dist > quest:
	print(0)
elif dist == 0 and quest == 0:
	print(1)
else:
	total = 2 ** quest
	possible = math.factorial(quest) / math.factorial(dist) / math.factorial(quest - dist)
	print(possible / total)


__author__ = 'Juan Barros'

def solve(A, B):
	sumAux = 0
	for i in A:
		sumAux += 1 if i == '+' else -1
	return back(B, 0, sumAux, 0)

def back(A, i, n, aux):
	if i >= len(A):
		return 0.0 if n != aux else 1.0
	if A[i] == '+':
		return back(A, i + 1, n, aux + 1)
	if A[i] == '-':
		return back(A, i + 1, n, aux - 1)
	if A[i] == '?':
		mais = back(A, i + 1, n, aux + 1)
		menos = back(A, i + 1, n, aux - 1)
		return (mais + menos) / 2
a = input()
b = input()
print('%.12f' % solve(a, b))


from collections import Counter
import math
l = list(input())
l1 = list(input())
a = Counter(l)
b = Counter(l1)
if a['+'] < b['+'] or a['-'] < b['-']:
	print('0')
	exit()
else:
	a1 = a['+'] - b['+']
	b1 = a['-'] - b['-']
s = math.factorial(a1 + b1) // (math.factorial(a1) * math.factorial(b1))
s1 = float(2 ** (a1 + b1))
print(s / s1)


a = input()
b = input()
final = a.count('+') - a.count('-')
start = b.count('+') - b.count('-')
rand = b.count('?')

def choose(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0
if rand == 0:
	if start == final:
		prob = 1.0
	else:
		prob = 0.0
elif rand % 2 != (final - start) % 2:
	prob = 0.0
else:
	plus_required = (final - start + rand) // 2
	if plus_required < 0 or plus_required > rand:
		prob = 0.0
	else:
		prob = 0.5 ** rand * choose(rand, plus_required)
print(prob)


whereToGo = 0
originalRight = input()
for correct in originalRight:
	if correct == '+':
		whereToGo += 1
	else:
		whereToGo -= 1
whereHeIs = 0
originalWrong = list(input())
newWrong = [x for x in originalWrong if x != '?']
for wrong in newWrong:
	if wrong == '+':
		whereHeIs += 1
	else:
		whereHeIs -= 1
if len(newWrong) == len(originalWrong):
	if whereHeIs == whereToGo:
		print(1.0)
	else:
		print(0.0)
else:
	numberOfUnknowns = len(originalRight) - len(newWrong)

	def generateOnesZeroes(length):

		def addToList(charHere, listHere):
			returnList = []
			for element in listHere:
				returnList.append(charHere + element)
			return returnList
		if length == 0:
			return []
		elif length == 1:
			return ['1', '0']
		returnThis = addToList('1', generateOnesZeroes(length - 1)) + addToList('0', generateOnesZeroes(length - 1))
		return returnThis
	possiblePlaces = []
	for element in generateOnesZeroes(numberOfUnknowns):
		place = whereHeIs
		for char in element:
			if char == '1':
				place += 1
			else:
				place -= 1
		possiblePlaces.append(place)
	numberOfOccurances = 0
	for element in possiblePlaces:
		if element == whereToGo:
			numberOfOccurances += 1
	print(numberOfOccurances / len(possiblePlaces))


s1 = input()
s2 = input()
d = k = 0
for i in range(len(s1)):
	if s1[i] == '+':
		d += 1
	if s2[i] == '-':
		d += 1
	if s1[i] == '-':
		d -= 1
	if s2[i] == '+':
		d -= 1
	if s2[i] == '?':
		k += 1
(p, m) = (int((k + d) / 2), int((k - d) / 2))

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
if p < 0 or m < 0:
	print(0)
else:
	print(fact(p + m) / (fact(p) * fact(m)) / 2 ** (p + m))


from itertools import product
sent = input()
revieved = input()
s = 0
r = [0, 0, 0]
for i in sent:
	if i == '+':
		s += 1
	else:
		s -= 1
for i in revieved:
	if i == '+':
		r[0] += 1
	elif i == '-':
		r[1] += 1
	else:
		r[2] += 1
perms = [sum(i) + r[0] - r[1] for i in list(product([1, -1], repeat=r[2]))]
ans = perms.count(s) / len(perms)
print('%.9f' % ans)


from math import factorial as fac
s1 = input()
s2 = input()
plus = s1.count('+') - s2.count('+')
minus = s1.count('-') - s2.count('-')
qs = s2.count('?')
if plus < 0 or minus < 0:
	print(0)
else:
	ans = fac(qs) / (fac(plus) * fac(minus)) / 2 ** qs
	print(ans)


a = input()
res = 0
for i in a:
	if i == '-':
		res -= 1
	else:
		res += 1
b = input()
cann = b.count('?')
res2 = 0
for i in b:
	if i == '-':
		res2 -= 1
	elif i == '+':
		res2 += 1
import itertools
can = 0
total = 0
for i in itertools.product(['-', '+'], repeat=cann):
	f = 0
	for j in i:
		if j == '-':
			f -= 1
		else:
			f += 1
	if f + res2 == res:
		can += 1
	total += 1
if total == 0:
	print(1)
else:
	print(can / total)


fact = [1]
for i in range(1, 10 + 1):
	fact.append(i * fact[i - 1])
s1 = input()
s2 = input()
d1 = {'?': 0, '+': 0, '-': 0}
d2 = {'?': 0, '+': 0, '-': 0}
for i in s1:
	try:
		d1[i] += 1
	except:
		d1[i] = 1
for i in s2:
	try:
		d2[i] += 1
	except:
		d2[i] = 1
flag = 0
if d2['?'] == 0:
	for i in d1:
		if d1[i] != d2[i]:
			flag = 1
	if flag:
		print('0.000000000000')
	else:
		print('1.000000000000')
else:
	q = 2 ** d2['?']
	a = d1['+'] - d2['+']
	b = d1['-'] - d2['-']
	if a < 0 or b < 0:
		flag = 1
	else:
		p = fact[d2['?']] / (fact[b] * fact[a])
	if flag:
		print('0.000000000000')
	else:
		print(p / q)


def cal(n, k):
	return c(n, k) * pow(0.5, n)

def c(n, m):
	k1 = 1
	k2 = 1
	for i in range(n - m + 1, n + 1):
		k1 *= i
	for i in range(1, m + 1):
		k2 *= i
	return k1 // k2
s1 = input()
pos1 = s1.count('+') - s1.count('-')
s2 = input()
pos2 = s2.count('+') - s2.count('-')
x = s2.count('?')
dx = abs(pos1 - pos2)
if x < dx or (x - dx) % 2 == 1:
	print(0)
else:
	print(cal(x, (x - dx) // 2))


s1 = input()
s2 = input()
desout = s1.count('+') - s1.count('-')
curout = s2.count('+') - s2.count('-')
uncer = s2.count('?')
if uncer == 0:
	if desout == curout:
		print('%1.12f' % 1)
	else:
		print('%1.12f' % 0)
elif abs(desout - curout) > uncer:
	print('%1.12f' % 0)
elif (abs(desout - curout) + uncer) // 2 != int(abs(desout - curout) + uncer) // 2:
	print('%1.12f' % 0)
else:
	p = (abs(desout - curout) + uncer) // 2

	def fun(n):
		if n <= 1:
			return 1
		else:
			return n * fun(n - 1)
	ans = fun(uncer) / (fun(p) * fun(uncer - p) * 2 ** uncer)
	print('%1.12f' % ans)


def f(m, n):
	if m == 0 or n == 0:
		return 1
	return f(m - 1, n) + f(m, n - 1)
s = input()
c = input()
s_ans = 0
c_ans = 0
cnt = 0
for i in s:
	if i == '+':
		s_ans += 1
	if i == '-':
		s_ans -= 1
for i in c:
	if i == '+':
		c_ans += 1
	if i == '-':
		c_ans -= 1
	if i == '?':
		cnt += 1
if c.find('?') == -1 and s_ans == c_ans:
	print('1.000000000000')
elif c.find('?') == -1 and s_ans != c_ans:
	print('0.000000000000')
elif abs(s_ans - c_ans) > cnt:
	print('0.000000000000')
else:
	cha = s_ans - c_ans
	jia = 0
	jian = 0
	if cha > 0:
		jia += cha
	else:
		jian -= cha
	jia += (cnt - abs(cha)) // 2
	jian += (cnt - abs(cha)) // 2
	print(f'{f(jia, jian) / 2 ** cnt:.9f}')


from sys import stdin

def recur(a, c, cont):
	if c == len(a):
		return cont
	if a[c] == '+':
		return recur(a, c + 1, cont + 1)
	elif a[c] == '-':
		return recur(a, c + 1, cont - 1)

def machete(b, d, t, y):
	if d == len(b):
		return (t, y)
	if b[d] == '?':
		return machete(b, d + 1, t, y + 1)
	if b[d] == '+':
		return machete(b, d + 1, t + 1, y)
	elif b[d] == '-':
		return machete(b, d + 1, t - 1, y)

def combin(i, j, b1, k):
	if len(b1) == i:
		if k == recur(j, 0, 0):
			return 1
		else:
			return 0
	elif b1[i] == '+' or b1[i] == '-':
		j = j + b1[i]
		return combin(i + 1, j, b1, k)
	else:
		return combin(i + 1, j + '+', b1, k) + combin(i + 1, j + '-', b1, k)

def main():
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	(x, w) = machete(b, 0, 0, 0)
	k = recur(a, 0, 0)
	o = combin(0, '', b, k) / 2 ** w
	print('{:0.12f}'.format(o))
main()


from math import *

def comb(n, k):
	if k > n:
		return 0
	return factorial(n) / factorial(k) / factorial(n - k)
s1 = input()
s2 = input()
f1 = sum((1 for i in s1 if i == '+')) + sum((-1 for i in s1 if i == '-'))
f2 = sum((1 for i in s2 if i == '+')) + sum((-1 for i in s2 if i == '-'))
resto = s2.count('?')
dis = abs(f1 - f2)
if resto == 0:
	if f1 == f2:
		print(1)
	else:
		print(0)
elif dis <= resto and (resto - dis) % 2 == 0:
	prob = comb(resto, dis + (resto - dis) // 2) * 0.5 ** resto
	print(prob)
else:
	print(0)


from math import factorial as f
s1 = input()
s2 = input()
drazil = s1.count('+') - s1.count('-')
doraemon = s2.count('+') - s2.count('-')
unrecog = s2.count('?')
if abs(drazil - doraemon) <= unrecog:
	r = abs(drazil - doraemon) + unrecog
	if r % 2 == 1:
		prob = 0
	else:
		r /= 2
		n = unrecog
		prob = f(n) / (f(r) * f(n - r) * 2 ** n)
else:
	prob = 0
print(f'{prob:.9f}')


from sys import stdin, stdout
s1 = stdin.readline().strip()
s2 = stdin.readline().strip()
(p, m) = (0, 0)
(p2, m2, q) = (0, 0, 0)
for x in s1:
	if x == '+':
		p += 1
	else:
		m += 1
for x in s2:
	if x == '+':
		p2 += 1
	elif x == '-':
		m2 += 1
	else:
		q += 1
if q == 0:
	if not p == p2:
		print('{:.12f}'.format(0))
	else:
		print('{:.12f}'.format(1))
else:
	dp = p - p2
	dm = m - m2
	if dp + dm > q or dp < 0 or dm < 0:
		print('{:.12f}'.format(0))
	else:
		t = [[1 for x in range(11)] for y in range(11)]
		for i in range(2, 11):
			for j in range(1, i):
				t[i][j] = t[i - 1][j - 1] + t[i - 1][j]
		print('{:.12f}'.format(0.5 ** q * t[q][dp]))


import itertools
(bef, aft) = (input(), input())
act = 0
for i in bef:
	if i == '+':
		act += 1
	else:
		act -= 1
gue = 0
for i in aft:
	if i == '+':
		gue += 1
	if i == '-':
		gue -= 1
(num, den) = (0, 0)
for i in itertools.product([0, 1], repeat=aft.count('?')):
	cur = gue
	for j in i:
		if j == 0:
			cur -= 1
		else:
			cur += 1
	if cur == act:
		num += 1
	den += 1
print(num / den)


def rec(q, ans):
	if q == 0:
		if ans == ca:
			return 1
		else:
			return 0
	return rec(q - 1, ans + 1) + rec(q - 1, ans - 1)
c = [i for i in input()]
f = [i for i in input()]
ca = fa = 0
q = 0
n = len(c)
for i in range(n):
	if c[i] == '+':
		ca += 1
	else:
		ca -= 1
	if f[i] == '+':
		fa += 1
	elif f[i] == '-':
		fa -= 1
	else:
		q += 1
print(rec(q, fa) / 2 ** q)


import math
seq = list(input())
dec = list(input())
count_p = 0
count_n = 0
count_u = 0
for c in seq:
	if c == '+':
		count_p += 1
	if c == '-':
		count_n += 1
for c in dec:
	if c == '+':
		count_p -= 1
	if c == '-':
		count_n -= 1
	if c == '?':
		count_u += 1
count_p = max(0, count_p)
count_n = max(0, count_n)
if count_u < count_n + count_p:
	ans = 0
else:
	possible = math.factorial(count_u) / (math.factorial(count_n) * math.factorial(count_p))
	total = 2 ** count_u
	ans = possible / total
print(ans)


from math import factorial as f
s1 = input()
s2 = input()
ad = 0
mi = 0
ad1 = 0
mi1 = 0
qu = 0
for i in range(len(s1)):
	if s1[i] == '+':
		ad = ad + 1
	else:
		mi = mi + 1
for i in range(len(s2)):
	if s2[i] == '+':
		ad1 = ad1 + 1
	elif s2[i] == '-':
		mi1 = mi1 + 1
	else:
		qu = qu + 1
rad = ad - ad1
rmi = mi - mi1
if rad < 0 or rmi < 0:
	z = 0
	print('{0:.12f}'.format(z))
elif rad + rmi > qu:
	z = 0
	print('{0:.12f}'.format(z))
else:
	p = pow(2, qu)
	e = rad + rmi
	re = f(qu) // (f(rad) * f(qu - rad))
	re1 = f(qu) // (f(rmi) * f(qu - rmi))
	ans = re / p
	print('{0:.12f}'.format(ans))


from math import factorial as fa
s = input()
r = input()
cf = s.count('+')
pos = 2 * cf - len(s)
ce = r.count('?')
cf_r = r.count('+')
pos_r = cf_r - (len(r) - ce - cf_r)
t = abs(pos_r - pos)
if ce == 0:
	if pos == pos_r:
		print(1)
	else:
		print(0)
elif t > len(s) or t > ce:
	print(0)
else:
	x = ce - t
	if x % 2:
		print(0)
		exit(0)
	else:
		r = t + x / 2
		fav = fa(ce) / (fa(r) * fa(ce - r))
		print(fav / 2 ** ce)


def main():
	x = sum(((-1, 1)[c == '+'] for c in input()))
	psi = [0.0] * 21
	psi[10] = 1.0
	for c in input():
		(le, ri) = (psi[1:] + [0.0], [0.0] + psi[:-1])
		if c == '+':
			psi = ri
		elif c == '-':
			psi = le
		else:
			psi = [(a + b) / 2 for (a, b) in zip(le, ri)]
	print('{:1.12f}'.format(psi[x + 10]))
main()


def fact(n):
	l = [1]
	for i in range(1, n + 1):
		l.append(i * l[i - 1])
	return l[n]
l1 = input()
l2 = input().strip()
a = 2 * l1.count('+') - len(l1) - l2.count('+') + l2.count('-')
p = l2.count('?')
if abs(a) > p:
	print(0)
elif l2.count('?') == 0:
	if l1.count('+') == l2.count('+'):
		print(1)
	else:
		print(0)
else:
	n = abs((p - a) // 2)
	m = abs((p + a) // 2)
	k = fact(n + m) // (fact(n) * fact(m))
	prob = float(k / 2 ** p)
	print(prob)


import math
from math import *

def printNcR(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p
s1 = list(input())
n = len(s1)
s2 = list(input())
final = 0
for i in range(n):
	if s1[i] == '+':
		final += 1
	else:
		final -= 1
final_reach = 0
doubt = 0
for i in range(n):
	if s2[i] == '+':
		final_reach += 1
	elif s2[i] == '-':
		final_reach -= 1
	else:
		doubt += 1
if doubt == 0:
	if final == final_reach:
		print(1)
	else:
		print(0)
elif abs(final - final_reach) > doubt:
	print(0.0)
else:
	k = final - final_reach
	pos = (doubt + k) // 2
	neg = (doubt - k) // 2
	l = printNcR(doubt, pos)
	print(l / 2 ** doubt)


def cal(m, n):
	total = 1.0
	for i in range(m + 1, m + n + 1):
		total *= i / (i - m)
	total /= 2 ** (m + n)
	return total

def parse(s):
	plus = 0
	minus = 0
	question = 0
	for i in s:
		if i == '+':
			plus += 1
		elif i == '-':
			minus += 1
		elif i == '?':
			question += 1
	return (plus, minus, question)

def main():
	s1 = input()
	s2 = input()
	s1_parse = parse(s1)
	s2_parse = parse(s2)
	if s1_parse[0] == s2_parse[0] and s1_parse[1] == s2_parse[1]:
		print(1.0)
	elif s2_parse[2] == 0:
		print(0.0)
	elif s1_parse[0] < s2_parse[0] or s2_parse[1] < s2_parse[1]:
		print(0.0)
	elif s1_parse[0] > s2_parse[0] + s2_parse[2] or s1_parse[1] > s2_parse[1] + s2_parse[2]:
		print(0.0)
	else:
		plus_needed = s1_parse[0] - s2_parse[0]
		minus_needed = s1_parse[1] - s2_parse[1]
		print(cal(plus_needed, minus_needed))
main()


def solve(n, at):
	global sum, acou, dao
	if n == n2:
		if at == acou:
			dao += 1
		sum += 1
		return
	if s2[n] == '+':
		solve(n + 1, at + 1)
	elif s2[n] == '-':
		solve(n + 1, at - 1)
	else:
		solve(n + 1, at + 1)
		solve(n + 1, at - 1)
s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
(sum, acou, dao) = (0, 0, 0)
for i in s1:
	if i == '+':
		acou += 1
	else:
		acou -= 1
solve(0, 0)
print('{0:.12f}'.format(dao / sum))


ch1 = str(input())
ch2 = str(input())
r1 = 0
r2 = 0
h = 0
n = len(ch1)
for i in range(n):
	if ch1[i] == '+':
		r1 += 1
	else:
		r1 -= 1
	if ch2[i] == '+':
		r2 += 1
	elif ch2[i] == '-':
		r2 -= 1
	else:
		h += 1
d = abs(r1 - r2)

def fact(n):
	if n <= 1:
		return 1
	else:
		return n * fact(n - 1)

def binom(n, k):
	return fact(n) // (fact(k) * fact(n - k))
if d % 2 != h % 2:
	print(0)
else:
	k = (h - d) // 2
	if k < 0:
		print(0)
	else:
		print(binom(h, k) * 0.5 ** h)


def fac(n):
	if n == 0 or n == 1:
		return 1
	return n * fac(n - 1)

def nchoosek(n, k):
	return fac(n) / fac(n - k) / fac(k)
s1 = input()
goal = sum((1 if x == '+' else -1 for x in s1))
s2 = input()
offset = sum((1 for x in s2 if x == '+')) - sum((1 for x in s2 if x == '-'))
wildcards = sum((1 for x in s2 if x == '?'))
needed = abs(goal - offset)
other = wildcards - needed
if needed > wildcards:
	print(0)
	exit(0)
if needed == 0 and wildcards == 0:
	print(1)
	exit(0)
print(nchoosek(wildcards, needed + other // 2) / 2 ** wildcards)


from collections import defaultdict

def nCr(n: int, r: int):
	assert n >= r
	dp = [0] * (n + 1)
	for i in range(n + 1):
		pre = 1
		for j in range(i + 1):
			if j == 0 or j == i:
				dp[j] = 1
			else:
				(temp, dp[j]) = (dp[j], dp[j] + pre)
				pre = temp
	return dp[r]

def main():
	s1 = input()
	s2 = input()
	correct_position = s1.count('+') - s1.count('-')
	position = s2.count('+') - s2.count('-')
	diff = abs(correct_position - position)
	num_of_q = s2.count('?')
	n = num_of_q - diff
	if diff == 0 and num_of_q == 0:
		print(1)
	elif diff > num_of_q or n % 2 != 0:
		print(0)
	else:
		ans = nCr(num_of_q, n // 2 + diff) * 0.5 ** num_of_q
		print('{:.10f}'.format(ans))
main()


import itertools as ittls
from collections import Counter
from functools import reduce
import string

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
pos = sum(map(lambda x: 1 if x == '+' else -1, input()))
path = Counter(list(input()))
pos = abs(pos - path['+'] + path['-'])
qmarks = path['?']
if qmarks < pos or qmarks - pos & 1:
	print(0)
	quit()

def cnum(n, k):
	if k == 0:
		return 1
	return reduce(lambda x, y: x * y, range(n - k + 1, n + 1)) // reduce(lambda x, y: x * y, range(1, k + 1))
print('%.15f' % (cnum(qmarks, pos + (qmarks - pos) // 2) / (1 << qmarks)))


li = [1] * 11
for i in range(1, 11):
	li[i] = li[i - 1] * i
str1 = input()
str2 = input()
(cnt, cnt1, cnt2) = (0, 0, 0)
for i in str1:
	if i == '+':
		cnt2 += 1
	else:
		cnt2 -= 1
for i in str2:
	if i == '?':
		cnt += 1
	elif i == '+':
		cnt1 += 1
	else:
		cnt1 -= 1
for i in range(cnt + 1):
	if cnt1 + cnt - 2 * i == cnt2:
		ans = li[cnt] // (li[i] * li[cnt - i])
		print(ans / 2 ** cnt)
		break
else:
	print(0)


s1 = input()
s2 = input()
a1 = 0
a2 = 0
u = 0
for i in range(len(s1)):
	if s1[i] == '+':
		a1 += 1
	else:
		a1 -= 1
	if s2[i] == '+':
		a2 += 1
	elif s2[i] == '?':
		u += 1
	else:
		a2 -= 1

def fact(n):
	res = 1
	for i in range(1, n + 1):
		res *= i
	return res

def c(n, k):
	return fact(n) // (fact(k) * fact(n - k))
if u == 0:
	if a1 == a2:
		print(1.0)
	else:
		print(0.0)
elif u + a2 - a1 < 0 or (u + a2 - a1) % 2 != 0:
	print(0.0)
else:
	minuses = (u + a2 - a1) // 2
	print(c(u, minuses) / 2 ** u)


def c(n, k):
	if k == 0 or k == n:
		return 1
	if k < 0 or k > n:
		return 0
	return c(n - 1, k) + c(n - 1, k - 1)
a = input()
b = input()
t = a.count('+') - a.count('-') - b.count('+') + b.count('-')
k = b.count('?')
if t % 2 != k % 2:
	print(0)
else:
	x = (t + k) / 2
	print(c(k, x) / 2 ** k)


def fun(a, s, i, l):
	if i == l and a == 0:
		return 1
	if i == l and a != 0:
		return 0
	if s[i] == '+':
		return fun(a - 1, s, i + 1, l)
	elif s[i] == '-':
		return fun(a + 1, s, i + 1, l)
	else:
		return fun(a + 1, s, i + 1, l) + fun(a - 1, s, i + 1, l)
s0 = input()
s0 = list(s0)
s1 = input()
s1 = list(s1)
l = len(s0)
a = 0
for i in s0:
	if i == '+':
		a += 1
	else:
		a -= 1
k = fun(a, s1, 0, l)
t = 0
for i in s1:
	if i == '?':
		t += 1
ans = k / 2 ** t
print('{0:.12f}'.format(k / 2 ** t))


from math import factorial
f = factorial
zil = input()
mon = input()
net = 0
ran = 0
for x in range(len(zil)):
	if mon[x] == '?':
		ran += 1
		if zil[x] == '+':
			net += 1
		else:
			net -= 1
	elif mon[x] != zil[x]:
		if zil[x] == '+':
			net += 2
		else:
			net -= 2
net = abs(net)
if net > ran:
	print(0)
elif ran == 0:
	print(1)
else:
	diff = ran - net
	if diff % 2 != 0 and diff != 0:
		print(0)
	else:
		diff /= 2
		denom = pow(2, ran)
		num = f(ran) / (f(diff) * f(net + diff))
		print(num / denom)


def calc(s):
	contador = 0
	for c in s:
		if c == '+':
			contador += 1
		else:
			contador -= 1
	return contador
string_um = input()
string_dois = input()
v = calc(string_um)
p = []
n = len(string_dois)
m = 0
for i in range(n):
	if string_dois[i] == '?':
		p.append(i)
		m += 1
count = 0
for i in range(1 << m):
	string_tres = list(string_dois)
	for j in range(m):
		if i & 1 << j:
			string_tres[p[j]] = '+'
		else:
			string_tres[p[j]] = '-'
	if calc(string_tres) == v:
		count += 1
print('{:.9f}'.format(count / (1 << m)))


comandosCorretos = list(input())
comandosRecebidos = list(input())
posicaoDesejada = 50 + comandosCorretos.count('+') - comandosCorretos.count('-')
matriz = [[0 for i in range(100)] for j in range(100)]
lvl = 50
qtdDeComandos = len(comandosCorretos)
matriz[0][lvl] = 1
for i in range(1, qtdDeComandos + 1):
	if comandosRecebidos[i - 1] == '+':
		for j in range(1, 100):
			matriz[i][j] = matriz[i - 1][j - 1]
	if comandosRecebidos[i - 1] == '-':
		for j in range(0, 99):
			matriz[i][j] = matriz[i - 1][j + 1]
	if comandosRecebidos[i - 1] == '?':
		for j in range(1, 99):
			matriz[i][j] = 0.5 * matriz[i - 1][j - 1] + 0.5 * matriz[i - 1][j + 1]
print(matriz[qtdDeComandos][posicaoDesejada])


import sys
import math
input = sys.stdin.readline
a = list(input())
b = list(input())
x = a.count('+') - b.count('+')
y = a.count('-') - b.count('-')
if x < 0 or y < 0:
	print(0)
else:
	fact = math.factorial(x + y) / (math.factorial(x) * math.factorial(y))
	total = 2 ** (x + y)
	print(fact / total)


s1 = input()
s2 = input()
l = [0]
n = len(s1)
for i in range(n):
	if s2[i] == '+':
		for j in range(len(l)):
			l[j] += 1
	elif s2[i] == '-':
		for j in range(len(l)):
			l[j] -= 1
	else:
		k = len(l)
		for j in range(k):
			l.append(l[j] - 1)
			l.append(l[j] + 1)
		l = l[k:]
co = 0
for i in range(n):
	if s1[i] == '+':
		co += 1
	else:
		co -= 1
to = 0
for i in range(len(l)):
	if l[i] == co:
		to += 1
print(to / len(l))


from math import factorial as f
s1 = input()
s2 = input()
q = s2.count('?')
pos = lambda x: x.count('+') - x.count('-')
c = lambda n, k: f(n) / (f(k) * f(n - k))
offset = pos(s1) - pos(s2)
tr_pas = []
for i in range(q + 1):
	tr_pas += [c(q, i)]
r = []
for i in range(q + 1):
	r += [q - 2 * i]
a = 0 if offset not in r else tr_pas[r[::-1].index(offset)]
b = 2 ** q
print(a / b)


from math import ceil, sqrt, gcd, factorial

def comb(n, r):
	if n < 0 or n < r:
		return 0
	return factorial(n) // (factorial(r) * factorial(n - r))
a = list(input())
b = list(input())
k = a.count('+')
p = b.count('+')
m = b.count('?')
r = k - p
if m < r or r < 0:
	print(0.0)
else:
	print(comb(m, r) / 2 ** m)


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
x = input()
plus = x.count('+')
minus = x.count('-')
x = input()
plus_ = x.count('+')
minus_ = x.count('-')
n = x.count('?')
a = plus - plus_
b = minus - minus_
if a < 0 or b < 0 or a + b != n:
	print(0.0)
else:
	print(nCr(n, a) / (1 << n))


q = input()
w = input()
r = []
e = []
t = 0
for i in q:
	if i == '+':
		r.append(1)
	else:
		r.append(-1)
for i in w:
	if i == '+':
		e.append(1)
	elif i == '-':
		e.append(-1)
	else:
		e.append(0)
		t += 1
k = [[0] * 30 for _ in range(30)]
k[0][0] = 1
for i in range(1, 29):
	for j in range(i, -1, -1):
		if j == 0:
			k[i][j] = k[i - 1][j + 1]
		else:
			k[i][j] = (k[i - 1][j + 1] + k[i - 1][j - 1]) / 2
y = sum(r) - sum(e)
print(k[t][y if y >= 0 else -1 * y])


import math
s1 = input()
s2 = input()
target = sum([1 if s == '+' else -1 for s in s1])
now = s2.count('+')
now -= s2.count('-')
question = s2.count('?')

def ncr(n, r):
	return math.factorial(n) // math.factorial(n - r) // math.factorial(r)
cand = {}
conds = [ncr(question, q) for q in range(question + 1)]
for i in range(question + 1):
	prob = conds[i] / sum(conds)
	cand[now + i - (question - i)] = prob
if target in cand:
	print(cand[target])
else:
	print(0)


import math
inp = input().strip()
dec = input().strip()
inp_dict = {'+': 0, '-': 0}
dec_dict = {'+': 0, '-': 0, '?': 0}
for i in range(len(inp)):
	if inp[i] == '+':
		inp_dict['+'] += 1
	elif inp[i] == '-':
		inp_dict['-'] += 1
for i in range(len(dec)):
	if dec[i] == '+':
		dec_dict['+'] += 1
	elif dec[i] == '-':
		dec_dict['-'] += 1
	elif dec[i] == '?':
		dec_dict['?'] += 1
if dec_dict['+'] == inp_dict['+'] and dec_dict['-'] == inp_dict['-']:
	print(1.0)
else:
	temp = inp_dict['+'] - dec_dict['+']
	temp1 = inp_dict['-'] - dec_dict['-']
	if temp + temp1 == dec_dict['?'] and temp >= 0 and (temp1 >= 0):
		temp2 = math.factorial(temp + temp1) / (math.factorial(temp) * math.factorial(temp1))
		for i in range(temp1 + temp):
			temp2 = temp2 * 0.5
		print(temp2)
	else:
		print(0.0)


total = 0
pdest = 0
memo = dict()

def func(s, index, pos, dest, memo):
	global total
	global pdest
	key = str(index) + ':' + str(pos)
	if key in memo:
		total += 1
		if memo[key] == dest:
			pdest += 1
	if index == len(s):
		total += 1
		if pos == dest:
			pdest += 1
		return pos
	if s[index] == '+':
		to_return = func(s, index + 1, pos + 1, dest, memo)
	elif s[index] == '-':
		to_return = func(s, index + 1, pos - 1, dest, memo)
	elif s[index] == '?':
		to_return = func(s, index + 1, pos + 1, dest, memo)
		to_return = func(s, index + 1, pos - 1, dest, memo)
	return to_return
c = input()
s = input()
dest = 0
for i in range(len(c)):
	if c[i] == '+':
		dest += 1
	else:
		dest -= 1
func(s, 0, 0, dest, memo)
print(pdest / total)


from copy import deepcopy
s1 = input()
s2 = input()
position = 0
for ch in s1:
	if ch == '+':
		position += 1
	else:
		position -= 1
positions = [0]
for ch in s2:
	if ch == '+':
		for i in range(len(positions)):
			positions[i] += 1
	elif ch == '-':
		for i in range(len(positions)):
			positions[i] -= 1
	else:
		temp1 = deepcopy(positions)
		temp2 = deepcopy(positions)
		for i in range(len(positions)):
			temp1[i] += 1
			temp2[i] -= 1
		positions = temp1 + temp2
print(sum((x == position for x in positions)) / len(positions))


drazil = list(input())
dreamoon = list(input())
total = 0
cnt = dreamoon.count('?')
if cnt == 0:
	if drazil.count('+') == dreamoon.count('+') and dreamoon.count('-') == drazil.count('-'):
		print(1)
	else:
		print(0)
	exit()
arr = [bin(i)[2:] + '0' * (cnt - len(bin(i)[2:])) for i in range(2 ** cnt)]
indexes = []
for i in range(len(dreamoon)):
	if dreamoon[i] == '+':
		total += 1
	elif dreamoon[i] == '-':
		total -= 1
real = 0
for i in range(len(drazil)):
	if drazil[i] == '+':
		real += 1
	elif drazil[i] == '-':
		real -= 1
original = 0
for i in range(len(arr)):
	fake = total
	for j in arr[i]:
		if j == '1':
			fake += 1
		else:
			fake -= 1
	if fake == real:
		original += 1
print(original / len(arr))


s1 = input()
s2 = input()
import math
f = math.factorial
s1_n = s1_p = s2_p = s2_n = s2_un = 0
for x in s1:
	if x == '+':
		s1_p += 1
	else:
		s1_n += 1
for x in s2:
	if x == '+':
		s2_p += 1
	elif x == '-':
		s2_n += 1
	else:
		s2_un += 1
if s2_un == 0:
	if s2_n == s1_n and s1_p == s2_p:
		print(1)
	else:
		print(0)
elif s2_p > s1_p or s2_n > s1_n:
	print(0)
else:
	print(f(s1_n - s2_n + (s1_p - s2_p)) / (f(s1_n - s2_n) * f(s1_p - s2_p) * 2 ** s2_un))


from collections import defaultdict as dd
from collections import deque
from collections import Counter
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def factorial(a):
	if a == 1 or a == 0:
		return 1
	else:
		return a * factorial(a - 1)

def binomial(n, k):
	res = factorial(n)
	res /= factorial(k)
	res /= factorial(n - k)
	return res
s1 = input()
s2 = input()
c1 = Counter(s1)
c2 = Counter(s2)
arrival1 = c1['+'] - c1['-']
arrival_temp2 = c2['+'] - c2['-']
dist = abs(arrival1 - arrival_temp2)
if dist > c2['?']:
	ans = 0
else:
	n = c2['?']
	k = (dist + n) // 2
	ans = binomial(n, k) / 2 ** n
print(ans)


def recursive(soma, i):
	if i == n:
		if soma == resu:
			resp[0] += 1
		else:
			resp[1] += 1
	elif lista[i] == '+':
		soma += 1
		recursive(soma, i + 1)
	elif lista[i] == '-':
		soma -= 1
		recursive(soma, i + 1)
	else:
		recursive(soma + 1, i + 1)
		recursive(soma - 1, i + 1)
listav = input()
resp = [0, 0]
n = len(listav)
resu = 0
for e in listav:
	if e == '+':
		resu += 1
	else:
		resu -= 1
lista = input()
recursive(0, 0)
print('{:.12f}'.format(resp[0] / (resp[0] + resp[1])))


s1 = input()
s2 = input()
target = 0
for i in s1:
	if i == '-':
		target -= 1
	else:
		target += 1
ans = 0
zeroes = 0
for i in s2:
	if i == '-':
		ans -= 1
	elif i == '+':
		ans += 1
	else:
		zeroes += 1
if '?' not in s2:
	if target == ans:
		print(1)
	else:
		print(0)
else:
	t = abs(target - ans)
	n = 0
	p = 0
	while n < 1 << zeroes:
		temp = 0
		for i in range(zeroes):
			if n & 1 << i:
				temp += 1
			else:
				temp -= 1
		if temp == t:
			p += 1
		n += 1
	print(p / 2 ** zeroes)


s = list(input())
t = list(input())

def nck(n, k):
	if n < k:
		return 0
	if k == 0 or n == 0:
		return 1
	return nck(n - 1, k - 1) + nck(n - 1, k)
d = s.count('+') - s.count('-')
e = t.count('+') - t.count('-')
q = t.count('?')
x = abs(d - e)
n = (q + 1) // 2 + x // 2
print(nck(q, n) / 2 ** q)


s = list(input().strip())
r = list(input().strip())

def calc(str):
	if str == '+':
		return 1
	elif str == '-':
		return -1
	else:
		return 0
res = 0
for str in s:
	res += calc(str)
cur = []
for i in r:
	h = calc(i)
	curNow = []
	if len(cur):
		for c in cur:
			if h != 0:
				curNow.append(c + h)
			else:
				curNow.append(c + 1)
				curNow.append(c - 1)
	elif h != 0:
		curNow.append(h)
	else:
		curNow.append(-1)
		curNow.append(1)
	cur = curNow
sum = len([x for x in cur if x == res]) / len(cur)
print('%1.10f' % sum)


def solve(target, t, i=0, ans=0, l=[]):
	if i == len(t):
		if ans == target:
			l.append(1)
			return
		else:
			l.append(0)
			return
	if t[i] == '-':
		solve(target, t, i + 1, ans - 1, l)
	elif t[i] == '+':
		solve(target, t, i + 1, ans + 1, l)
	else:
		solve(target, t, i + 1, ans - 1, l)
		solve(target, t, i + 1, ans + 1, l)
	return l
s = input()
o = s.count('+')
z = s.count('-')
target = o - z
t = input()
ans = solve(target, t)
print(ans.count(1) / len(ans))


import math
a = input()
b = input()
i = a.count('+')
j = a.count('-')
k = b.count('+')
l = b.count('-')
m = b.count('?')
c1 = i - j
c2 = k - l
c = abs(c1 - c2)
w = m - c
x = w // 2
y = w // 2 + c
if c == 0 and m == 0:
	print(1)
elif c > m:
	print(0)
else:
	x = math.factorial(m) // (math.factorial(x) * math.factorial(y))
	print(x / pow(2, m))


import os
import sys
from math import *
from collections import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def nCr(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p
a = input()
b = input()
Acp = a.count('+')
Acm = a.count('-')
Bcp = b.count('+')
Bcm = b.count('-')
if Bcp > Acp or Bcm > Acm:
	print(0)
	exit()
empty = b.count('?')
need_p = -Bcp + Acp
need_m = -Bcm + Acm
print(nCr(empty, need_p) / 2 ** empty)


def f(n, k):
	c = 1
	for i in range(k):
		c *= n - i
	for i in range(1, k + 1):
		c /= i
	c /= pow(2, n)
	return c
s1 = input()
s2 = input()
target = s2.count('+') - s2.count('-') - (s1.count('+') - s1.count('-'))
n = s2.count('?')
if target < -n or target > n or (target + n) % 2 == 1:
	print(0)
else:
	k = (target + n) // 2
	p = f(n, k)
	print(p)


import math
s1 = input()
s2 = input()

def new_factorial(x):
	if x > 0:
		return math.factorial(x)
	else:
		return 1
if len(s1) == 0 and len(s2) == 0:
	prob = 0
	print(res.format(prob))
else:
	res = '{:.12f}'
	undefined = s2.count('?')
	plus = s1.count('+') - s2.count('+')
	minus = s1.count('-') - s2.count('-')
	if undefined == 0 and plus != 0 and (minus != 0):
		prob = 0
		print(res.format(prob))
	else:
		all_permut = new_factorial(plus + minus)
		plus_permut = new_factorial(plus)
		minus_permut = new_factorial(minus)
		undefined_possibilities = 2 ** undefined
		prob = all_permut // (plus_permut * minus_permut)
		prob = prob / undefined_possibilities
		print(res.format(prob))


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
a = input()
b = input()
ap = a.count('+')
an = a.count('-')
bp = b.count('+')
bn = b.count('-')
bq = b.count('?')
if bq == abs(ap - bp) + abs(an - bn):
	temp = nCr(bq, abs(ap - bp)) / pow(2, bq)
	print(temp)
else:
	print(0)


s1 = input()
s2 = input()
op = 0
cp = 0

def fact(n):
	if n == 0:
		return 1
	else:
		return n * fact(n - 1)
for x in s1:
	if x == '+':
		op += 1
	else:
		op -= 1
ur = 0
for x in s2:
	if x == '+':
		cp += 1
	elif x == '-':
		cp -= 1
	else:
		ur += 1
total = 2 ** ur
if ur == 0:
	if cp == op:
		print('1')
	else:
		print('0')
elif cp == op:
	if ur % 2 == 0:
		ans = fact(ur) // fact(ur // 2) ** 2
		print(ans / total)
	else:
		print('0')
else:
	posi = abs(op - cp)
	temp = ur
	ur -= posi
	if ur >= 0 and ur % 2 == 0:
		posi += ur // 2
		ur = ur // 2
		ans = fact(temp) // (fact(posi) * fact(ur))
		print(ans / total)
	else:
		print('0')


import itertools
product = itertools.product

def calcula(s, aux=()):
	res = 0
	inda = 0
	for e in s:
		if e == '+':
			res += 1
		elif e == '-':
			res -= 1
		else:
			if aux[inda] == '+':
				res += 1
			else:
				res -= 1
			inda += 1
	return res
sa = list(input())
sb = list(input())
qtd = sb.count('?')
possi = list(product(['+', '-'], repeat=qtd))
reA = calcula(sa)
if qtd == 0:
	if reA == calcula(sb):
		print('{0:.12f}'.format(1.0))
	else:
		print('{0:.12f}'.format(0.0))
else:
	work = 0
	for i in range(len(possi)):
		if reA == calcula(sb, possi[i]):
			work += 1
	print('{0:.12f}'.format(work / len(possi)))


s1 = input()
s2 = input()
pos = 0
pos2 = 0
for i in s1:
	if i == '+':
		pos += 1
	else:
		pos -= 1
how = 0
for i in s2:
	if i == '+':
		pos2 += 1
	elif i == '-':
		pos2 -= 1
	else:
		how += 1
correct = 0
total = 0

def f(mypos, moves, goal):
	global correct, total
	if moves == 0:
		if mypos == goal:
			correct += 1
		total += 1
	else:
		f(mypos + 1, moves - 1, goal)
		f(mypos - 1, moves - 1, goal)
f(pos2, how, pos)
print(correct / total)


a = input()
b = input()
correct = 0
for i in a:
	if i == '+':
		correct += 1
	else:
		correct -= 1
run = 0
doubt = 0
for i in b:
	if i == '+':
		run += 1
	elif i == '-':
		run -= 1
	else:
		doubt += 1
if doubt == 0:
	if run == correct:
		print(1)
	else:
		print(0)
else:
	mask = (1 << doubt) - 1
	correct_trial = 0
	while mask >= 0:
		c = mask
		temp = run
		for j in range(doubt):
			if c & 1:
				temp += 1
			else:
				temp -= 1
			c >>= 1
		if temp == correct:
			correct_trial += 1
		mask -= 1
	print(correct_trial / (1 << doubt))


import math

def op(x):
	return math.factorial(x)
s = input()
t = input()
n = 0
m = 0
l = 0
a = 0
for i in range(len(s)):
	if s[i] == '+':
		n += 1
		a += 1
	else:
		n -= 1
	if t[i] == '?':
		l += 1
	elif t[i] == '+':
		m += 1
		a -= 1
	else:
		m -= 1
k = abs(m - n)
if k % 2 == 0 and l % 2 == 1 or l < k:
	print(0)
elif l == 0 and k == 0:
	print(1)
else:
	print(op(l) / op(l - a) / op(a) / 2 ** l)


def solve(index, pos):
	global w, r
	if index == MAX:
		if pos == final:
			r += 1
		else:
			w += 1
		return
	if s2[index] == '+':
		solve(index + 1, pos + 1)
	elif s2[index] == '-':
		solve(index + 1, pos - 1)
	elif s2[index] == '?':
		solve(index + 1, pos + 1)
		solve(index + 1, pos - 1)
s1 = input()
s2 = input()
MAX = len(s1)
w = 0
r = 0
final = 0
for e in s1:
	if e == '+':
		final += 1
	elif e == '-':
		final -= 1
solve(0, 0)
ans = r / (r + w)
print('{:.12f}'.format(ans))


a = list(input())

def fact(x):
	p = 1
	for i in range(1, int(x + 1)):
		p *= i
	return p

def binom(x, y):
	return fact(y) / (fact(x) * fact(y - x))
for i in range(len(a)):
	if a[i] == '+':
		a[i] = 1
	elif a[i] == '-':
		a[i] = -1
b = list(input())
num0 = 0.0
for i in range(len(a)):
	if b[i] == '+':
		b[i] = 1
	elif b[i] == '-':
		b[i] = -1
	elif b[i] == '?':
		b[i] = 0
		num0 += 1
sa = sum(a)
sb = sum(b)
delta = abs(sa - sb)
if num0 == 0:
	if delta > 0:
		print(0.0)
	else:
		print(1.0)
elif delta > num0 or int(num0 - delta) % 2 == 1:
	print(0.0)
else:
	x = int(num0 - delta) // 2
	y = int(num0)
	print(binom(x, y) / 2 ** y)


fact = [1]
for i in range(1, 11):
	fact.append(fact[-1] * i)
s = input()
s1 = input()
n = s.count('+')
n1 = s1.count('+')
if n1 > n:
	print(0)
else:
	extra = s1.count('?')
	plus = n - n1
	c = fact[extra] // (fact[extra - plus] * fact[plus])
	c /= pow(2, extra)
	print(c)


from sys import stdin, stdout
from collections import deque, Counter, defaultdict
from math import factorial as fact

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
s1 = input()
s2 = input()
x1 = y1 = x2 = y2 = pro = 0
for i in s1:
	if i == '+':
		x1 += 1
	else:
		y1 += 1
for i in s2:
	if i == '+':
		x2 += 1
	elif i == '-':
		y2 += 1
	else:
		pro += 1
if pro:
	a = abs(x1 - x2)
	b = abs(y1 - y2)
	if a + b > pro:
		print(f'{0.0:.9f}')
	else:
		ans = fact(pro) / (fact(pro - a) * fact(a))
		print(f'{ans / 2 ** pro:.9f}')
elif x1 == x2 and y1 == y2:
	print(f'{1.0:.9f}')
else:
	print(f'{0.0:.9f}')


def factorial(n):
	ans = 1
	if n == 0:
		return 1
	for i in range(1, n + 1):
		ans *= i
	return ans

def ncr(n, r):
	n = abs(n)
	if r > n:
		return 0
	ans = factorial(n)
	ans = ans // factorial(n - r)
	ans = ans // factorial(r)
	return ans
A = input()
B = input()
QMarks = B.count('?')
TotalA = A.count('+') - A.count('-')
TotalB = B.count('+') - B.count('-')
denominator = 2 ** QMarks
if QMarks < abs(TotalA - TotalB):
	print(0)
else:
	x = (QMarks - abs(TotalA - TotalB)) // 2
	x += abs(TotalA - TotalB)
	num = ncr(QMarks, x)
	print(num / denominator)


import math
s1 = input()
s2 = input()
dist = 0
pos = 0
unrecognized = 0
for i in s1:
	if i == '+':
		dist += 1
	else:
		dist -= 1
for i in s2:
	if i == '+':
		pos += 1
	elif i == '-':
		pos -= 1
	elif i == '?':
		unrecognized += 1
difference = dist - pos
if abs(difference) > abs(unrecognized):
	print('{0:.9f}'.format(float(0)))
else:
	extra = unrecognized - abs(difference)
	perm_extra = 1
	for i in range(1, unrecognized + 1):
		perm_extra = perm_extra * i
	perm_extra = perm_extra / (math.factorial(extra / 2 + (unrecognized - extra)) * math.factorial(extra / 2))
	if extra % 2 != 0:
		print('{0:.9f}'.format(float(0)))
	else:
		print('{0:.9f}'.format(float(perm_extra * 0.5 ** unrecognized)))


def factorial(n):
	if n <= 1:
		return 1
	return n * factorial(n - 1)
original = input()
received = input()
originalNum = original.count('+') - original.count('-')
receivedNum = received.count('+') - received.count('-')
variance = received.count('?')
difference = abs(originalNum - receivedNum)
if variance == 0:
	if difference == 0:
		print(1.0)
	else:
		print(0.0)
elif difference > variance or difference % 2 != variance % 2:
	print(0.0)
else:
	difference += variance
	difference //= 2
	c = factorial(variance) / (factorial(difference) * factorial(variance - difference))
	print(c / 2 ** variance)


from math import factorial as fa
s1 = input()
s2 = input()
a = s1.count('+') - s2.count('+')
b = s1.count('-') - s2.count('-')
c = s2.count('?')
if a < 0 or b < 0:
	print(0)
else:
	print(fa(c) / (fa(a) * fa(c - a)) / 2 ** c)


drazil = input()
dreomond = input()
n = len(drazil)
position = 0
for i in drazil:
	position += 1 if i == '+' else -1
dre_pos = 0
questions = 0
for i in dreomond:
	if i == '+':
		dre_pos += 1
	elif i == '-':
		dre_pos -= 1
	else:
		questions += 1
possibilies = [dre_pos]
for i in range(questions):
	new = []
	for j in possibilies:
		new.extend([j + 1, j - 1])
	possibilies = new
k = 0
for i in possibilies:
	if i == position:
		k += 1
print(k / len(possibilies) * 1.0)


def solve(s1, s2):
	s1e = s1.count('+') - s1.count('-')
	s2e = s2.count('+') - s2.count('-')
	un = s2.count('?')
	t = s1e - s2e
	if t > un or t < -un:
		return 0
	else:
		plus = (t + un) // 2
		m = 1
		for i in range(un, plus, -1):
			m *= i
		for i in range(1, un - plus + 1):
			m /= i
		for i in range(un):
			m /= 2
		return m
s1 = input()
s2 = input()
print(solve(s1, s2))


from math import factorial
str1 = input()
x = 0
for i in str1:
	x += 1 if i == '+' else -1
(y, z) = (0, 0)
str2 = input()
for j in str2:
	if j == '?':
		z += 1
	else:
		y += 1 if j == '+' else -1
x = abs(x - y)
if x > z or (z - x) % 2 == 1:
	print(0)
else:
	x = x + (z - x) // 2
	print(factorial(z) // (factorial(z - x) * factorial(x)) / 2 ** z)


import math
drazil = input()
doraemon = input()
draval = 0
for i in drazil:
	if i == '+':
		draval += 1
	else:
		draval -= 1
ques = 0
doraval = 0
for i in doraemon:
	if i == '+':
		doraval += 1
	elif i == '-':
		doraval -= 1
	else:
		ques += 1
diff = abs(draval - doraval)
p = 0
n = 0
remains = ques - diff
if diff > ques:
	print(float(0))
else:
	p += diff
	p += remains / 2
	n += remains / 2
	calc = math.factorial(ques) / (math.factorial(p) * math.factorial(n) * 2 ** ques)
	print(calc)


from math import factorial
s1 = input()
s2 = input()
n = 0
x1 = 0
for i in range(len(s1)):
	if s1[i] == '+':
		x1 += 1
	else:
		x1 -= 1
x2 = 0
for i in range(len(s2)):
	if s2[i] == '+':
		x2 += 1
	elif s2[i] == '?':
		n += 1
	else:
		x2 -= 1
x = abs(x1 - x2)
if x > n:
	print(0)
elif x == n:
	print(1 / 2 ** n)
elif (n - x) % 2 == 1:
	print(0)
else:
	print(factorial(n) // (factorial((n - x) // 2) * factorial(n - (n - x) // 2)) / 2 ** n)


def get_val(val1, s2):
	return 1 if s(s2)[0] == val1 else 0

def s(s):
	d = 0
	cnt = 0
	for c in s:
		if c == '+':
			cnt += 1
		elif c == '-':
			cnt -= 1
		else:
			d += 1
	return (cnt, d)

def correct(i, val1, s2, con):
	if len(con) == len(s2):
		return get_val(val1, con)
	choice1 = choice2 = choice3 = 0
	if s2[i] == '?':
		choice1 = correct(i + 1, val1, s2, con + '+')
		choice2 = correct(i + 1, val1, s2, con + '-')
	else:
		choice3 = correct(i + 1, val1, s2, con + s2[i])
	return sum([choice2, choice3, choice1])

def main():
	s1 = input()
	s2 = input()
	all_pos = 2 ** s(s2)[1]
	val1 = s(s1)[0]
	if all_pos == 1:
		val2 = s(s2)[0]
		if val1 == val2:
			print(1)
		else:
			print(0)
	else:
		print(correct(0, val1, s2, '') / all_pos)
main()


def ckn(k, n):
	ans = 1
	for i in range(1, k + 1):
		ans *= n - k + i
		ans /= i
	return ans
inp = input()
out = input()
pinp = inp.count('+') - inp.count('-')
pout = out.count('+') - out.count('-')
move = out.count('?')
dist = pinp - pout
if abs(dist) > move or (dist + move) % 2 != 0:
	ans = 0
else:
	case_acc = ckn((move + abs(dist)) // 2, move)
	case_all = 1 << move
	ans = case_acc / case_all
print('%.10f' % ans, end='')


from math import factorial
send = input()
receive = input()
cntP = send.count('+')
cntN = send.count('-')
cnt1 = receive.count('+')
cnt2 = receive.count('-')
mark = receive.count('?')
total = pow(2, mark)
if cntP < cnt1 or cntN < cnt2:
	valid = 0
else:
	valid = factorial(mark) / factorial(mark - cntP + cnt1) / factorial(cntP - cnt1)
print(f'{valid / total:0.12f}')


from math import factorial

def combination(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
(sent, received) = (input(), input())
(target, place, mark) = (sent.count('+') - sent.count('-'), received.count('+') - received.count('-'), received.count('?'))
target = abs(target - place)
if target > mark or target & 1 != mark & 1:
	print(0)
elif mark == 0 and target == 0:
	print(1)
else:
	print(combination(mark, mark - target >> 1) / (1 << mark))


import sys
correct = 0

def f(s1, s2, i, suma, sumatemp):
	global correct
	if i == len(s2):
		if sumatemp == suma:
			correct += 1
	elif s2[i] == '?':
		f(s1, s2, i + 1, suma, sumatemp + 1)
		f(s1, s2, i + 1, suma, sumatemp - 1)
	else:
		if s2[i] == '+':
			sumatemp += 1
		else:
			sumatemp -= 1
		f(s1, s2, i + 1, suma, sumatemp)

def getSuma(i, s1):
	if i >= len(s1):
		return 0
	if s1[i] == '+':
		return getSuma(i + 1, s1) + 1
	else:
		return getSuma(i + 1, s1) - 1

def getWays(i, s2):
	if i >= len(s2):
		return 1
	if s2[i] == '?':
		return 2 * getWays(i + 1, s2)
	else:
		return getWays(i + 1, s2)
n = 1
s1 = sys.stdin.readline().strip().replace(' ', '')
s2 = sys.stdin.readline().strip().replace(' ', '')
ways = 1
correct = 0
suma = getSuma(0, s1)
ways = getWays(0, s2)
f(s1, s2, 0, suma, 0)
print(correct / ways)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
hash_map = {}

def solve(i, cur_sum):
	if i == len(s2):
		if cur_sum == total:
			return 1
		return 0
	if (i, cur_sum) in hash_map:
		return hash_map[i, cur_sum]
	count = 0
	if s2[i] == '?':
		for k in [1, -1]:
			count += solve(i + 1, cur_sum + k)
	elif s2[i] == '+':
		count += solve(i + 1, cur_sum + 1)
	else:
		count += solve(i + 1, cur_sum - 1)
	hash_map[i, cur_sum] = count
	return count
s1 = insr()
s2 = insr()
total = 0
q_count = 0
for c in s1:
	if c == '+':
		total += 1
	else:
		total -= 1
for c in s2:
	if c == '?':
		q_count += 1
res = solve(0, 0)
if res == 0 or q_count == 0:
	print(res)
else:
	print(res / 2 ** q_count)


def factorial(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
s = input()
u = input()
target = s.count('+')
current = u.count('+')
moves = u.count('?')
needed = target - current
if needed < 0 or needed > moves:
	print(0)
else:
	print(factorial(moves) / (factorial(needed) * factorial(moves - needed)) * 0.5 ** moves)


from collections import Counter, defaultdict, deque
goal = input()
target = goal.count('+') - goal.count('-')
test = input()
n = len(goal)
p = deque([0] * 50)
p[25] = 1.0
for el in test:
	if el == '+':
		p.rotate(1)
	elif el == '-':
		p.rotate(-1)
	else:
		newp = [0] * 50
		for i in range(49):
			newp[i] = (p[i - 1] + p[i + 1]) / 2
		p = deque(newp)
print(p[25 + target])


from math import factorial as fact
original = input()
ori_pos = original.count('+')
ori_neg = original.count('-')
dup = input()
dup_pos = dup.count('+')
dup_neg = dup.count('-')
dup_not = dup.count('?')
if dup_not == 0:
	if ori_pos == dup_pos:
		print('1.000000000000')
	else:
		print('0.000000000000')
elif ori_pos < dup_pos or ori_neg < dup_neg:
	print('0.000000000000')
else:
	a = ori_pos - dup_pos
	b = ori_neg - dup_neg
	fa = fact(dup_not)
	ans = fa / (fact(a) * fact(b))
	print('{:0.12f}'.format(ans / (2 << dup_not - 1)))


import sys
s = input()
a = 0
for i in range(len(s)):
	if s[i] == '+':
		a += 1
	else:
		a -= 1
s = input()
q = 0
for i in range(len(s)):
	if s[i] == '+':
		a -= 1
	elif s[i] == '-':
		a += 1
	else:
		q += 1
if q == 0:
	if a == 0:
		print(1)
	else:
		print(0)
	sys.exit()
pas = [1, 1]
while len(pas) - 1 < q:
	pas2 = [1]
	for i in range(len(pas) - 1):
		pas2.append(pas[i] + pas[i + 1])
	pas2.append(1)
	pas = pas2
s = 0
for i in range(len(pas)):
	s += pas[i]
n = range(-q, q + 2, 2)
if a in n:
	i = n.index(a)
	print(pas[i] / s)
else:
	print(0)


__author__ = 'neki'
import sys

def outcome(command):
	pos = 0
	for i in command:
		if i == '+':
			pos += 1
		elif i == '-':
			pos -= 1
		else:
			print('Error')
	return pos

def computeFinishes(k):
	nonlocal finish, recCommand, xCom, nSol
	if k >= len(xCom):
		nSol += 1
		solCom = recCommand[:]
		for i in range(len(xCom)):
			if xCom[i] == 1:
				solCom[i] = '+'
			if xCom[i] == 2:
				solCom[i] = '-'
		finish[outcome(solCom)] += 1
		return
	if recCommand[k] == '?':
		for j in range(1, 3):
			xCom[k] = j
			computeFinishes(k + 1)
	else:
		computeFinishes(k + 1)
	xCom[k] = 0
sentCommand1 = str(input())
recCommand1 = str(input())
sentCommand = ['A'] * len(sentCommand1)
recCommand = ['B'] * len(recCommand1)
for i in range(len(sentCommand1)):
	sentCommand[i] = sentCommand1[i]
	recCommand[i] = recCommand1[i]
sentFinish = outcome(sentCommand)
finish = {}
for i in range(-10, 11):
	finish[i] = 0
xCom = [0] * len(recCommand)
nSol = 0
computeFinishes(0)
result = finish[sentFinish] / nSol
print('{result:.12f}'.format(result=result))


import os
import sys
from io import BytesIO, IOBase
from typing import Union

def main():
	a = input()
	b = input()
	pos = 0
	for i in a:
		if i == '+':
			pos += 1
		elif i == '-':
			pos -= 1
	guesses = 0
	rpos = 0
	for i in b:
		if i == '-':
			rpos -= 1
		elif i == '+':
			rpos += 1
		else:
			guesses += 1
	needed = abs(pos - rpos)
	if needed > guesses:
		print(0)
	else:
		guesses -= needed
		if guesses % 2 != 0:
			print(0)
		else:
			vacant = guesses // 2
			from math import comb
			print(comb(guesses + needed, vacant) / 2 ** (guesses + needed))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
pascal = [[1], [1, 1]]
for i in range(10):
	tmp = []
	base = pascal[-1].copy()
	for i in range(1, len(base)):
		tmp.append(base[i - 1] + base[i])
	tmp.insert(0, 1)
	tmp.insert(len(tmp), 1)
	pascal.append(tmp)

def solve():
	sen = input()
	rec = input()
	n = len(sen)
	s_pos = 0
	r_pos = 0
	unknown = rec.count('?')
	base = '+' * unknown
	for i in range(n):
		if sen[i] == '+':
			s_pos += 1
		elif sen[i] == '-':
			s_pos -= 1
		if rec[i] == '+':
			r_pos += 1
		elif rec[i] == '-':
			r_pos -= 1
	val = [unknown - i * 2 for i in range(unknown + 1)]
	p = pascal[unknown]
	combo = dict()
	diff = s_pos - r_pos
	tot = sum(p)
	for i in range(unknown + 1):
		combo[val[i]] = p[i]
	if diff == unknown == 0:
		print(1.0)
	elif diff not in combo:
		print(0.0)
	else:
		print(combo[diff] / tot)
solve()


from math import factorial as f

def main():
	a = input()
	b = input()
	ap = a.count('+')
	an = a.count('-')
	bp = b.count('+')
	bn = b.count('-')
	tandatanya = b.count('?')
	if tandatanya == 0:
		if ap - an != bp - bn:
			print('%.9f' % 0)
		else:
			print('%.9f' % 1)
		return
	probab = float(1 / pow(2, tandatanya))
	x = (ap - an - (bp - bn) + tandatanya) // 2
	y = tandatanya - x
	if x < 0 or y < 0:
		print('%.9f' % 0)
		return
	probab *= f(tandatanya) / (f(x) * f(y))
	print('%.9f' % probab)
main()


from math import factorial as f
(a, b) = (input(), input())
(q, b) = (b.count('?'), b.replace('?', ''))
if b:
	b = eval('1'.join(b) + '1')
else:
	b = 0
diff = abs(eval('1'.join(a) + '1') - b)
if q < diff or (q - diff) % 2:
	print(0)
	exit()
x = (q - diff) / 2
print(f(q) / f(x) / f(q - x) / 2 ** q)


def ncr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
l1 = list(input())
l2 = list(input())
c1 = 0
c2 = 0
c3 = 0
for k in range(len(l1)):
	if l1[k] == '+':
		c1 += 1
	if l2[k] == '+':
		c2 += 1
	if l2[k] == '?':
		c3 += 1
a = c1 - c2
if c3 >= a and a >= 0:
	a1 = ncr(c3, a)
	print(a1 / 2 ** c3)
else:
	print(0)


def solution(s, ref, n, c):
	if c == ref and n <= 0:
		return 1
	if n <= 0:
		return 0
	if s[n - 1] == '+':
		return solution(s, ref, n - 1, c + 1)
	if s[n - 1] == '-':
		return solution(s, ref, n - 1, c - 1)
	else:
		return solution(s, ref, n - 1, c - 1) + solution(s, ref, n - 1, c + 1)
s1 = input()
s2 = input()
ref = 0
u = 0
for i in range(len(s1)):
	if s1[i] == '+':
		ref += 1
	else:
		ref -= 1
	if s2[i] == '?':
		u += 1
if u == 0:
	if solution(s2, ref, len(s2), 0) == 1:
		print(1.0)
	else:
		print(0.0)
else:
	print(solution(s2, ref, len(s2), 0) / 2 ** u)


a = list(input())
b = list(input())
c = b[:]
initplus = a.count('+')
initminus = a.count('-')
final = initplus - initminus
ans = 0
bp = b.count('+')
bm = b.count('-')
bq = b.count('?')
fac = [1] * 11
for i in range(2, 11):
	fac[i] = i * fac[i - 1]
if bp > initplus or bm > initminus:
	print(0)
else:
	nop = initplus - bp
	nom = initminus - bm
	if (bq - (nop + nom)) % 2 != 0:
		print(0)
	else:
		print(fac[nop + nom] / (fac[nop] * fac[nom]) / (1 << bq))


def chng(c):
	return -1 if c == '-' else 1 if c == '+' else 0

def f(z, d):
	if z == 0:
		nonlocal al
		al += 1
		if d == 0:
			nonlocal ne
			ne += 1
	else:
		f(z - 1, d - 1)
		f(z - 1, d + 1)
A = input()
B = input()
n = len(A)
x = 0
y = 0
z = 0
for i in range(n):
	x += chng(A[i])
	y += chng(B[i])
	if B[i] == '?':
		z += 1
if z == 0 and x == y:
	print(1)
else:
	d = abs(x - y)
	al = 0
	ne = 0
	f(z, d)
	print(ne / al)


import math

def nCr(n, r):
	return math.factorial(n) / (math.factorial(r) * math.factorial(n - r))

def count_plus_minus_qmark(s):
	plus_count = 0
	minus_count = 0
	qmark_count = 0
	for c in s:
		if c == '+':
			plus_count += 1
		elif c == '-':
			minus_count += 1
		else:
			qmark_count += 1
	return (plus_count, minus_count, qmark_count)

def calculate_probability(mcount, pcount):
	N = mcount + pcount
	return 0.5 ** N * nCr(N, mcount)

def counts_calc(s1counts, s2counts):
	total_diff = s1counts[0] - s2counts[0] - (s1counts[1] - s2counts[1])
	qcount = s2counts[2]
	pcount = (total_diff + qcount) // 2
	mcount = (qcount - total_diff) // 2
	return (pcount, mcount)
s1 = input()
s2 = input()
s1counts = count_plus_minus_qmark(s1)
s2counts = count_plus_minus_qmark(s2)
if s2counts[2] < abs(s1counts[0] - s2counts[0] - (s1counts[1] - s2counts[1])):
	prob = 0
else:
	(pcount, mcount) = counts_calc(s1counts, s2counts)
	prob = calculate_probability(mcount, pcount)
print(prob)


import math
a = input()
b = input()
c = 0
for i in a:
	if i == '+':
		c += 1
	else:
		c -= 1
d = 0
e = 0
for i in b:
	if i == '+':
		d += 1
	elif i == '-':
		d -= 1
	else:
		e += 1
if d - e <= c and c <= d + e:
	r = abs(d - c)
	r = (e - r) // 2
	x = math.factorial(e) / (math.factorial(r) * math.factorial(e - r))
	x /= pow(2, e)
	print(x)
else:
	print(0)


from itertools import product
s = input()
r = input()
a = b = c = count = 0
for i in range(len(s)):
	if s[i] == '+':
		a += 1
	else:
		a -= 1
	if r[i] == '+':
		b += 1
	elif r[i] == '-':
		b -= 1
	else:
		c += 1
d = [sum(x) for x in product([1, -1], repeat=c)]
count = 0
for x in d:
	if b + x == a:
		count += 1
print(count / 2 ** c)


s1 = str(input())
s2 = str(input())

def Fac(x):
	if x == 1 or x == 0:
		return 1
	return x * Fac(x - 1)
ans = 0
for i in s1:
	if i == '+':
		ans += 1
	else:
		ans -= 1
num = 0
for i in s2:
	if i == '+':
		ans -= 1
	elif i == '-':
		ans += 1
	else:
		num += 1
if num == 0:
	if ans == 0:
		print(float(1))
	else:
		print(0)
elif (num + ans) % 2 != 0 or num < ans or num + ans < 0:
	print(float(0))
else:
	x = int((num + ans) / 2)
	v = int(Fac(num) / (Fac(x) * Fac(num - x)))
	s = 1
	while num != 0:
		s *= 2
		num -= 1
	print(float(v / s))


import math
str1 = input()
str2 = input()
value = 0
value_2 = 0
unknown = 0
for x in str1:
	if x == '+':
		value += 1
	else:
		value -= 1
for x in str2:
	if x == '+':
		value_2 += 1
	elif x == '-':
		value_2 -= 1
	else:
		unknown += 1
plus_count = 0
minus_count = 0
rav = 0
x = value - value_2
if abs(x) <= unknown:
	if x >= 0:
		plus_count += x
		rav = unknown - plus_count
	else:
		minus_count += x
		rav = unknown - minus_count
	if plus_count == 0 and minus_count == 0 and (rav == 0):
		print('1.000000000000')
	elif rav % 2 == 0:
		rav = int(rav / 2)
		plus_count += rav
		minus_count += rav
		k = max(plus_count, minus_count)
		C = math.factorial(unknown) / (math.factorial(unknown - k) * math.factorial(k))
		O = math.pow(2, unknown)
		res = C / O
		print(f'{res:.12f}')
	else:
		print('0.000000000000')
else:
	print('0.000000000000')


str1 = input()
str2 = input()
a = [0]
destiny = 0
for i in str1:
	if i == '+':
		destiny += 1
	else:
		destiny -= 1
for i in str2:
	if i == '+':
		for i in range(len(a)):
			a[i] += 1
	elif i == '-':
		for i in range(len(a)):
			a[i] -= 1
	else:
		for i in range(len(a)):
			k = a[i]
			a[i] -= 1
			a.append(k + 1)
check = False
count_ques = 0
for i in a:
	if i == destiny:
		count_ques += 1
print(count_ques / len(a))


from sys import stdin
input = lambda : stdin.readline()
from math import ceil, sqrt, gcd, factorial
a = input().strip()
b = input().strip()
poso = 0
pos = 0
count = 0
for i in range(len(a)):
	if b[i] == '?':
		count += 1
	elif b[i] == '+':
		pos += 1
	else:
		pos -= 1
	if a[i] == '+':
		poso += 1
	else:
		poso -= 1
if abs(poso - pos) <= count:
	t = abs(poso - (pos - count)) // 2
	q = factorial(count) // (factorial(t) * factorial(count - t))
	print(q / pow(2, count))
else:
	print(0.0)


a = input()
b = input()
l = a.count('+') - a.count('-')
k = b.count('?')
if k == 0:
	if b.count('+') - b.count('-') == l:
		print(1)
	else:
		print(0)
else:
	n = 2 ** k
	r = k
	c = []
	t = 0
	while r >= 0:
		c.append(r - t)
		t += 1
		r -= 1
	import math
	d = []
	for i in range(k + 1):
		d.append(math.factorial(k) // (math.factorial(i) * math.factorial(k - i)))
	f = b.count('+') - b.count('-')
	if l - f in c:
		print(d[c.index(l - f)] / sum(d))
	else:
		print(0)


s1 = input()
s2 = input()
n = len(s1)

def fac(x):
	if x < 2:
		return 1
	else:
		return x * fac(x - 1)

def comb(p, n):
	return fac(n) / (fac(p) * fac(n - p))
p1 = 0
for i in s1:
	if i == '+':
		p1 += 1
p2 = 0
c = 0
for i in s2:
	if i == '+':
		p2 += 1
	elif i == '?':
		c += 1
if p1 > p2 + c or n - p1 > n - p2:
	print(0)
elif c == 0:
	if p1 == p2:
		print(1)
	else:
		print(0)
else:
	print(comb(p1 - p2, c) / 2 ** c)


fact = [1] * 11
for i in range(1, 11):
	fact[i] = i * fact[i - 1]
s = input('')
s1 = input('')
plus = s.count('+')
minus = s.count('-')
plus1 = s1.count('+')
minus1 = s1.count('-')
baki = s1.count('?')
if baki == 0:
	if minus == minus1 and plus == plus1:
		print(1)
	else:
		print(0)
elif plus > plus1 + baki or minus > minus1 + baki:
	print(0)
else:
	total = 2 ** baki
	pbaki = plus - plus1
	pminus = minus - minus1
	poss = fact[pbaki + pminus] / (fact[pminus] * fact[pbaki])
	print(poss / total)


import math
s1 = input()
s2 = input()
s1p = s1.count('+')
s1m = s1.count('-')
s2p = s2.count('+')
s2m = s2.count('-')
s2q = 0
if '?' in s2:
	s2q = s2.count('?')
if s2q == 0:
	if s1p == s2p and s1m == s2m:
		print('%.12f' % 1)
	else:
		print('%.12f' % 0)
elif s1p >= s2p and s1m >= s2m:
	s2q = math.factorial(s2q) / (math.factorial(s1p - s2p) * math.factorial(s1m - s2m))
	print('%.12f' % (s2q / 2 ** s2.count('?')))
else:
	print('%.12f' % 0)


def fac(n):
	if n == 0:
		return 1
	return fac(n - 1) * n

def get_list_of_chance(list_of_chance, chance):
	v = -chance
	for i in range(0, chance + 1):
		list_of_chance[i] = v
		v = v + 2
	return list_of_chance
string1 = input()
string2 = input()
plus1 = string1.count('+')
minus1 = string1.count('-')
plus2 = string2.count('+')
minus2 = string2.count('-')
chance = string2.count('?')
steps1 = plus1 - minus1
steps2 = plus2 - minus2
if chance == 0:
	print(float(steps1 == steps2))
else:
	list_of_chance = []
	for i in range(0, chance + 1):
		list_of_chance.append(0)
	list_of_chance = get_list_of_chance(list_of_chance, chance)
	for i in range(0, chance + 1):
		list_of_chance[i] = list_of_chance[i] + steps2
	if steps1 in list_of_chance:
		if list_of_chance[0] == steps1 or list_of_chance[chance] == steps1:
			count = 1
		else:
			index = list_of_chance.index(steps1)
			if index > (chance + 1) / 2:
				index = chance - index
			index = index
			count = fac(chance) / (fac(chance - index) * fac(index))
		print(count / 2 ** chance)
	else:
		print(0)


sent = input()
received = input()
intendedFinalPos = 0
actualFinalPos = 0
possibleFinalPos = []
numberUnknown = 0
probability = 0
for i in sent:
	if i == '+':
		intendedFinalPos += 1
	else:
		intendedFinalPos -= 1
for i in received:
	if i == '+':
		actualFinalPos += 1
	elif i == '-':
		actualFinalPos -= 1
	else:
		numberUnknown += 1
possibleFinalPos.append(actualFinalPos)
for i in range(1, numberUnknown + 1):
	temp = list(possibleFinalPos)
	for j in range(len(possibleFinalPos)):
		possibleFinalPos[j] += 1
	for j in range(len(temp)):
		temp[j] -= 1
	possibleFinalPos.extend(temp)
probability = possibleFinalPos.count(intendedFinalPos) / len(possibleFinalPos)
print(probability)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def check(sa, sb, string):
	if len(string) == 0:
		if sa == sb:
			return 1
		else:
			return 0
	if string[0] == '+':
		return check(sa, sb + 1, string[1:])
	elif string[0] == '-':
		return check(sa, sb - 1, string[1:])
	else:
		return check(sa, sb + 1, string[1:]) + check(sa, sb - 1, string[1:])
for _ in range(1):
	a = input()
	b = input()
	(sa, un) = (0, 0)
	for i in range(len(a)):
		if a[i] == '+':
			sa += 1
		else:
			sa -= 1
		if b[i] == '?':
			un += 1
	res = check(sa, 0, b)
	print('%.12f' % (res / 2 ** un))


import math
s1 = str(input())
s2 = str(input())
sum1 = 0
sum2 = 0
steps = 0

def prob(x, y):
	if x > y:
		return 0
	elif y == 0:
		if x == 0:
			return 1
		else:
			return 0
	else:
		return (prob(x - 1, y - 1) + prob(x + 1, y - 1)) / 2
for i in range(len(s1)):
	if s1[i] == '+':
		sum1 += 1
	if s1[i] == '-':
		sum1 -= 1
	if s2[i] == '+':
		sum2 += 1
	if s2[i] == '-':
		sum2 -= 1
	if s2[i] == '?':
		steps += 1
end = sum2 - sum1
print(prob(end, steps))


s = input()
(P, M) = (s.count('+'), s.count('-'))
s = input()
(p, m) = (s.count('+'), s.count('-'))
if m > M or p > P:
	print(0)
else:
	r = P + M - (p + m)
	dp = [[0.0] * (r + 1) for i in range(r + 1)]
	dp[0][0] = 1
	for i in range(1, r + 1):
		for j in range(i + 1):
			if j - 1 >= 0:
				dp[i - j][j] += dp[i - j][j - 1] / 2
			if i - j - 1 >= 0:
				dp[i - j][j] += dp[i - j - 1][j] / 2
	print(dp[P - p][M - m])


ex = input()
re = input()
ans = 0
for i in ex:
	if i == '+':
		ans += 1
	else:
		ans -= 1
tot = re.count('?')
res = 0
cnt = 0

def recur(times, sumtn):
	global cnt
	if times == 0:
		if sumtn == ans:
			cnt += 1
		return
	recur(times - 1, sumtn + 1)
	recur(times - 1, sumtn - 1)
for i in re:
	if i == '+':
		res += 1
	elif i == '-':
		res -= 1
if tot == 0:
	if res == ans:
		print(1)
	else:
		print(0)
else:
	recur(tot, res)
	print(cnt / 2 ** tot)


from math import factorial as fact
a = input()
b = input()
aplus = a.count('+')
aminus = len(a) - aplus
bplus = b.count('+')
bminus = b.count('-')
bjolly = len(b) - bplus - bminus
if bplus > aplus or bminus > aminus:
	print(0)
else:
	c = aplus - bplus
	res = fact(bjolly) / fact(bjolly - c) / fact(c) / 2 ** bjolly
	print(res)


n = input()
s = 0
for i in n:
	if i == '+':
		s += 1
	else:
		s -= 1
l = [0]
n = input()
for i in n:
	if i == '+':
		l = list(map(lambda x: x + 1, l))
	elif i == '-':
		l = list(map(lambda x: x - 1, l))
	else:
		e = len(l)
		for j in range(e):
			l.append(l[j] + 1)
			l.append(l[j] - 1)
		l = l[e:]
c = 0
for i in l:
	if i == s:
		c += 1
print(float(c) / float(len(l)))


from sys import stdin, stdout, setrecursionlimit
s = input()
t = input()
cou1 = cou2 = cou3 = 0
for x in s:
	if x == '+':
		cou1 += 1
	else:
		cou1 -= 1
a = b = 0

def rec(i, k):
	global a
	global b
	if i == len(k) - 1:
		if k[i] != '?':
			cou = 0
			for x in k:
				if x == '-':
					cou -= 1
				else:
					cou += 1
			if cou == cou1:
				a += 1
			b += 1
		else:
			rec(i, k[:-1] + '+')
			rec(i, k[:-1] + '-')
	elif k[i] != '?':
		rec(i + 1, k)
	else:
		rec(i + 1, k[:i] + '-' + k[i + 1:])
		rec(i + 1, k[:i] + '+' + k[i + 1:])
rec(0, t)
print(a / b)


import sys
import math
import os
data1 = input()
data2 = input()
(a, b) = (0, 0)
(c, d) = (0, 0)
vprs = 0
for i in range(len(data1)):
	if data1[i] == '+':
		a += 1
	else:
		b += 1
for i in range(len(data2)):
	if data2[i] == '+':
		c += 1
	elif data2[i] == '-':
		d += 1
	else:
		vprs += 1
if vprs == 0:
	if a == c and b == d:
		print('%.9f' % 1)
	else:
		print('%.9f' % 0)
elif c > a or d > b:
	print('%.9f' % 0)
else:
	deltaM = a - c
	deltaP = b - d
	total = 2 ** vprs
	fak1 = 1
	fak2 = 1
	fak3 = 1
	for i in range(1, vprs + 1):
		fak1 *= i
	for i in range(1, deltaM + 1):
		fak2 *= i
	for i in range(1, deltaP + 1):
		fak3 *= i
	ans = fak1 / (fak2 * fak3) / total
	print('%.9f' % ans)


from itertools import product as c
s = input()
s2 = input()
ans1 = 0
ans2 = 0
q = 0
for i in range(len(s)):
	if s[i] == '+':
		ans1 += 1
	elif s[i] == '-':
		ans1 -= 1
	if s2[i] == '+':
		ans2 += 1
	elif s2[i] == '-':
		ans2 -= 1
	else:
		q += 1
t = 0
lis = list(c('+-', repeat=q))
for i in lis:
	cur = 0
	for j in i:
		if j == '+':
			cur += 1
		else:
			cur -= 1
	if cur == abs(ans1 - ans2):
		t += 1
print('%.9f' % (t / max(1, len(lis))))


def fc(a):
	p = 1
	while a > 1:
		p = p * a
		a -= 1
	return p
a1 = input()
a2 = input()
p1 = a1.count('+')
m1 = a1.count('-')
p2 = a2.count('+')
m2 = a2.count('-')
if p1 < p2 or m1 < m2:
	p = 0.0
elif len(a1) is p2 + m2:
	p = 1.0
else:
	p1 = p1 - p2
	m1 = m1 - m2
	p = fc(m1 + p1) / (fc(p1) * fc(m1) * 2 ** (m1 + p1))
print('%.12f' % p)


import copy
s1 = input()
s2 = input()
final_destination = 0
for symbol in s1:
	if symbol == '+':
		final_destination += 1
	else:
		final_destination -= 1
possible_destination = [0]
for symbol in s2:
	if symbol == '+':
		possible_destination = [1 + i for i in possible_destination]
	elif symbol == '-':
		possible_destination = [i - 1 for i in possible_destination]
	else:
		values = []
		for num in possible_destination:
			values.append(num + 1)
			values.append(num - 1)
		possible_destination = copy.deepcopy(values)
count_value = possible_destination.count(final_destination)
if count_value == 0:
	print(0)
else:
	result = count_value / len(possible_destination)
	print(round(result, 9))


from math import factorial
s = input()
s1 = input()
plus = s.count('+') - s1.count('+')
minus = s.count('-') - s1.count('-')
n = s1.count('?')
if plus < 0 or minus < 0:
	print(0)
else:
	print(factorial(n) / factorial(n - plus) / factorial(plus) * 0.5 ** n)


s1 = input()
s2 = input()
w = 0
need = 0
have = 0
for i in s1:
	if i == '+':
		need += 1
	else:
		need -= 1
for i in s2:
	if i == '+':
		have += 1
	elif i == '-':
		have -= 1
	else:
		w += 1
need -= have
if abs(need) > w:
	print(0.0)
elif (w - abs(need)) % 2 == 1:
	print(0.0)
else:
	y = abs(need) + (w - abs(need)) // 2
	ans1 = 1
	ans2 = 1
	for i in range(y):
		ans1 *= w - i
		ans2 *= i + 1
	print(ans1 // ans2 / 2 ** w)


from math import factorial
s1 = input()
s2 = input()
true_disp = sum((1 if x == '+' else -1 for x in s1))
guaranteed_disp = 0
random_num = 0
for char in s2:
	if char == '+':
		guaranteed_disp += 1
	elif char == '-':
		guaranteed_disp -= 1
	elif char == '?':
		random_num += 1
diff = true_disp - guaranteed_disp

def prob(k, x):
	t = (x + k) // 2
	p = comb(k, t) / 2 ** k
	return p

def comb(n, m):
	return factorial(n) // (factorial(m) * factorial(n - m))
if diff % 2 != random_num % 2 or random_num < abs(diff):
	print(0)
else:
	print(prob(random_num, diff))


orig = input()
pnt = 0
for i in orig:
	if i == '+':
		pnt += 1
	else:
		pnt -= 1
cmd = input()
pnt2 = 0
q = 0
for i in cmd:
	if i == '+':
		pnt2 += 1
	elif i == '-':
		pnt2 -= 1
	else:
		q += 1
match = 0
for bit in range(1 << q):
	p = pnt2
	for i in range(q):
		if bit & 1 << i:
			p += 1
		else:
			p -= 1
	if p == pnt:
		match += 1
if q == 0:
	print(1 if pnt == pnt2 else 0)
else:
	print(match / 2 ** q)


from math import factorial
a = input()
b = input()
p1 = a.count('+') - a.count('-')
p2 = b.count('+') - b.count('-')
v = b.count('?')
n = p1 - p2
a = (n + v) / 2
if 0 <= a <= v:
	print(factorial(v) / factorial(a) / factorial(v - a) / float(2 ** v))
else:
	print(0)


drazil = input()
dreamoon = input()
from math import factorial
c = sum((i == '?' for i in dreamoon))
fpos = sum((1 if i == '+' else -1 for i in drazil))
dpos = sum((1 if i == '+' else -1 if i == '-' else 0 for i in dreamoon))
diff = fpos - dpos
negs = c - diff
if negs % 2 != 0:
	print(0)
	exit()
if abs(diff) > c:
	print(0)
	exit()
negs //= 2
pos = c - negs
ans = factorial(c) // (factorial(negs) * factorial(pos))
ans *= 0.5 ** c
print(ans)


s1 = input()
s2 = input()
s1 = ' '.join(s1)
s2 = ' '.join(s2)
s1 = s1.split()
s2 = s2.split()
(a, b, c, d, e) = (0, 0, 0, 0, 0)
for i in s1:
	if i == '+':
		a += 1
	elif i == '-':
		b += 1
for i in s2:
	if i == '+':
		c += 1
	elif i == '-':
		d += 1
	elif i == '?':
		e += 1
f = a - b
g = c - d
h = abs(f - g)
if abs(f - g) > e:
	print('0.000000000000')
elif h <= e:
	x = int((h + e) / 2)
	a1 = 1
	a2 = 1
	a3 = 1
	for i in range(1, e + 1):
		a1 = a1 * i
	for i in range(1, x + 1):
		a2 = a2 * i
	for i in range(1, e - x + 1):
		a3 = a3 * i
	y = a1 / (a2 * a3)
	i = y * 0.5 ** e
	print('%.12f' % i)


import collections
import itertools
import math
s1 = list(input())
s2 = list(input())
h1 = collections.Counter(s1)
h2 = collections.Counter(s2)
flag = False
if '?' not in h2:
	if h1['+'] == h2['+']:
		if h1['-'] == h2['-']:
			flag = True
			print(1)
	else:
		print(0)
elif flag == False:
	flag1 = False
	for i in h2.keys():
		if i == '?':
			continue
		if i not in h1:
			flag1 = True
			break
	if flag1:
		print(0)
	else:
		flag2 = False
		required_plus = required_minus = 0
		if '+' in h2:
			required_plus = h1['+'] - h2['+']
			if required_plus < 0:
				print(0)
				flag2 = True
		else:
			required_plus = h1['+']
		if flag2 == False:
			if '-' in h2:
				required_minus = h1['-'] - h2['-']
			else:
				required_minus = h1['-']
			count = h2['?']
			total = 2 ** count
			if required_plus == 0:
				num = 1
			if required_minus == 0:
				num = 1
			else:
				x = math.factorial(count)
				y = math.factorial(required_plus)
				z = math.factorial(count - required_plus)
				num = x / (y * z)
			ans = num / total
			print(ans)


import itertools

def main():
	send = input()
	recv = input()
	pos = 0
	for c in send:
		if c == '+':
			pos += 1
		else:
			pos -= 1
	est = 0
	amb = 0
	for c in recv:
		if c == '+':
			est += 1
		elif c == '-':
			est -= 1
		else:
			amb += 1
	remain = pos - est
	prob = 0.0
	if amb == 0:
		if remain == 0:
			prob = 1.0
		else:
			prob = 0.0
	else:
		num = 0
		den = 0
		for seq in itertools.product(('+', '-'), repeat=amb):
			den += 1
			val = 0
			for c in seq:
				if c == '+':
					val += 1
				else:
					val -= 1
			if val == remain:
				num += 1
		prob = num / den
	print(prob)
	return
main()


s1 = sum(map(lambda x: 1 if x == '+' else 0, input()))
str2 = list(input())
s2 = 0
remCount = 0
for i in str2:
	if i == '+':
		s2 += 1
	elif i == '?':
		remCount += 1
count = 0
for i in range(2 ** remCount):
	temp = s2 + bin(i)[2:].count('1')
	if temp == s1:
		count += 1
print(count / 2 ** remCount)


b = list(input())
a = list(input())
b1 = b.count('+')
b2 = b.count('-')
a1 = a.count('+')
a2 = a.count('-')
a3 = a.count('?')
x1 = b1 - a1
x2 = b2 - a2
if x1 < 0 or x2 < 0:
	print('0.000000000000')
elif a3 == 0:
	print('1.000000000000')
else:
	tot = 1 << a3
	x = 1
	for i in range(2, a3 + 1, 1):
		x = x * i
	y = 1
	for i in range(1, b1 - a1 + 1, 1):
		y = y * i
	z = 1
	for i in range(1, b2 - a2 + 1, 1):
		z = z * i
	x = x / (z * y)
	print(x / tot)


import sys
from functools import lru_cache

def main(og, got):
	a_pos = 0
	for c in og:
		if c == '+':
			a_pos += 1
		else:
			a_pos -= 1

	@lru_cache(maxsize=None)
	def dfs(i, pos):
		if i >= len(got):
			if pos == a_pos:
				return (1, 1)
			else:
				return (0, 1)
		act = got[i]
		if act == '+':
			return dfs(i + 1, pos + 1)
		elif act == '-':
			return dfs(i + 1, pos - 1)
		else:
			(l, lt) = dfs(i + 1, pos - 1)
			(r, rt) = dfs(i + 1, pos + 1)
			return (l + r, lt + rt)
	(n, t) = dfs(0, 0)
	print(n / t)
for (e, line) in enumerate(sys.stdin.readlines()):
	inp = line.strip()
	if e == 0:
		og = inp
	else:
		c = inp
main(og, c)


from math import factorial

def C(n, k):
	return int(factorial(n) / factorial(k) / factorial(n - k))
str1 = input()
str2 = input()
pos1 = 0
pos2 = 0
need = 0
for i in str1:
	if i == '+':
		pos1 += 1
	else:
		pos1 -= 1
for i in str2:
	if i == '+':
		pos2 += 1
	elif i == '-':
		pos2 -= 1
	else:
		need += 1
diff = abs(pos1 - pos2)
if diff % 2 != need % 2:
	print(0)
elif need == 0:
	if pos1 == pos2:
		print(1)
	else:
		print(0)
elif diff > need:
	print(0)
else:
	a = (need + diff) // 2
	print(C(need, a) / 2 ** need)


(s1, s2) = (input(), input())
p = s1.count('+') - s2.count('+')
m = s1.count('-') - s2.count('-')

def c(a, b):

	def fac(a):
		return fac(a - 1) * a if a else 1
	return fac(a) // fac(b) // fac(a - b)
if m < 0 or p < 0:
	print(0)
	exit(0)
print('%.10f' % (c(p + m, m) / 2 ** (p + m)))


import os
from sys import stdin, stdout

def backtrack(i, st, cur, hm):
	if i == len(st):
		if cur not in hm:
			hm[cur] = 0
		hm[cur] += 1
		return
	if st[i] == '+':
		backtrack(i + 1, st, cur + 1, hm)
	elif st[i] == '-':
		backtrack(i + 1, st, cur - 1, hm)
	else:
		backtrack(i + 1, st, cur + 1, hm)
		backtrack(i + 1, st, cur - 1, hm)

def solve(tc):
	s = stdin.readline().strip()
	t = stdin.readline().strip()
	destine = 0
	for c in s:
		if c == '+':
			destine += 1
		elif c == '-':
			destine -= 1
	hm = {}
	backtrack(0, t, 0, hm)
	lower = 0
	upper = 0
	for (k, v) in hm.items():
		if k == destine:
			upper = v
		lower += v
	print(upper / lower)
tcs = 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


import math
s1 = list(input())
s2 = list(input())
(p1, m1, p2, m2, c) = (0, 0, 0, 0, 0)
for i in range(len(s1)):
	if s1[i] == '+':
		p1 += 1
	if s1[i] == '-':
		m1 += 1
	if s2[i] == '+':
		p2 += 1
	if s2[i] == '-':
		m2 += 1
	if s2[i] == '?':
		c += 1
p = abs(p1 - p2)
m = abs(m1 - m2)
if p + m == c:
	print(math.factorial(c) / (math.factorial(p) * math.factorial(m) * pow(2, c)))
else:
	print(0 / 1)


from math import factorial, pow
send = input()
received = input()
pos = 0
for p in send:
	pos = pos + 1 if p == '+' else pos - 1
qcount = 0
curr_pos = 0
for p in received:
	if p == '+':
		curr_pos = curr_pos + 1
	elif p == '-':
		curr_pos = curr_pos - 1
	if p == '?':
		qcount += 1
if qcount == 0:
	print('{:.12f}'.format(1.0 if pos == curr_pos else 0.0))
else:
	exp_val_q = abs(pos - curr_pos)
	if exp_val_q % 2 != qcount % 2 or qcount < exp_val_q:
		print('{:.12f}'.format(0.0))
	else:
		neg = (qcount - exp_val_q) / 2
		posi = qcount - neg
		val = factorial(qcount) / (factorial(neg) * factorial(posi) * pow(2, qcount))
		print('{:.12f}'.format(val))


sent = input()
rcvd = input()
n = len(sent)
(orgP, orgM) = (0, 0)
(recP, recM) = (0, 0)
for c in sent:
	if c is '+':
		orgP += 1
	else:
		orgM += 1
for c in rcvd:
	if c is '+':
		recP += 1
	elif c is '-':
		recM += 1
un = n - recM - recP
reqP = orgP - recP
reqM = orgM - recM
if reqP + reqM is not un or reqP < 0 or reqM < 0:
	print(0.0)
	exit(0)
factN = 1
factP = 1
factM = 1
for i in range(1, un + 1):
	factN *= i
	if i is reqM:
		factM = factN
	if i is reqP:
		factP = factN
prob = factN / factM
prob /= factP
prob /= pow(2, un)
print(prob)


import math
a = input()
b = input()
dicb = {}
s = 0
s2 = 0
count = 0
for i in range(len(a)):
	if a[i] == '+':
		s += 1
	else:
		s -= 1
	if b[i] == '+':
		s2 += 1
	elif b[i] == '-':
		s2 -= 1
	else:
		count += 1
if count == 0 and s == s2:
	print(1)
elif abs(s - s2) > count or (count - abs(s - s2)) % 2 != 0:
	print(0)
else:
	x = (count - abs(s - s2)) // 2 + abs(s - s2)
	print(math.factorial(count) / math.factorial(x) / math.factorial(count - x) / 2 ** count)


s = input()
s2 = input()
c1 = abs(s.count('+') - s2.count('+'))
c2 = abs(s.count('-') - s2.count('-'))
c3 = s2.count('?')
x = 2 ** c3
cnt = 0
for i in range(x):
	s3 = bin(i)[2:]
	s3 = '0' * (c3 - len(s3)) + s3
	if s3.count('0') == c1 and s3.count('1') == c2:
		cnt += 1
if c1 == 0 and c2 == 0:
	print(1)
elif c3 == 0:
	print(0)
else:
	print(cnt / x)


from math import factorial, pow
s1 = list(input())
s2 = list(input())
S1 = {'+': 0, '-': 0}
S2 = {'+': 0, '-': 0, '?': 0}
for i in s1:
	S1[i] += 1
for i in s2:
	S2[i] += 1
if S1['+'] - S2['+'] >= 0 and S1['-'] - S2['-'] >= 0:
	pos = S1['+'] - S2['+']
	neg = S1['-'] - S2['-']
	ques = S2['?']
	res = factorial(pos + neg) / (factorial(pos) * factorial(neg)) / pow(2, ques)
	print('%.12f' % res)
else:
	print('%.12f' % 0)


def fact(num):
	if num <= 1:
		return 1
	else:
		return num * fact(num - 1)
s1 = input()
s2 = input()
s1_plus = s1.count('+')
s1_minus = s1.count('-')
s2_plus = s2.count('+')
s2_minus = s2.count('-')
s2_que = s2.count('?')
total = 2 ** s2_que
s1_sum = s1_plus - s1_minus
s2_sum_temp = s2_plus - s2_minus
easytemp = s2_sum_temp - s1_sum
if easytemp < 0:
	easytemp = -easytemp
if s2_que == 0 and easytemp == 0:
	answer = 1
elif s2_que == 0 and easytemp != 0:
	answer = 0
elif easytemp > s2_que:
	answer = 0
else:
	ptemp = (easytemp + s2_que) / 2
	ntemp = s2_que - ptemp
	answer = fact(s2_que) / (fact(ptemp) * fact(ntemp)) / total
print(answer)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def comb(n, b):
	if b > n - b:
		b = n - b
	r = 1
	for k in range(n, n - b, -1):
		r = r * k
	for k in range(1, b + 1):
		r //= k
	return r

def main():
	s = S()
	t = S()
	k = 0
	for c in s:
		if c == '+':
			k += 1
		else:
			k -= 1
	i = j = 0
	for c in t:
		if c == '?':
			j += 1
		elif c == '+':
			i += 1
		else:
			i -= 1
	d = abs(k - i)
	if d > j:
		return 0
	return comb(j, d + (j - d) // 2) / pow(2, j)
print(main())


def C(n, a):
	ans = 1
	for i in range(1, a + 1, 1):
		ans = ans * (n - i + 1) / i
	return ans
s1 = input()
s2 = input()
s1plus = s1.count('+')
s1minus = s1.count('-')
s2plus = s2.count('+')
s2minus = s2.count('-')
if s2plus > s1plus or s2minus > s1minus:
	print('0.000000000000')
else:
	a = s1plus - s2plus
	b = s1minus - s2minus
	print(0.5 ** (a + b) * C(a + b, a))


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
from math import factorial as fact
A = input()
B = input()
a = A.count('+') - B.count('+')
b = A.count('-') - B.count('-')
if a < 0 or b < 0:
	OPS(0)
else:
	ans = fact(a + b) / (fact(a) * fact(b)) / 2 ** (a + b)
	OPS(ans)


a = input()
b = input()
diff = 0
cnt = 0
for ch in a:
	if ch == '+':
		diff = diff + 1
	elif ch == '-':
		diff = diff - 1
for ch in b:
	if ch == '+':
		diff = diff - 1
	elif ch == '-':
		diff = diff + 1
	elif ch == '?':
		cnt = cnt + 1
ans = 0.0
for i in range(0, 1 << cnt):
	q = 0
	for j in range(0, cnt):
		if i & 1 << j:
			q = q + 1
		else:
			q = q - 1
	if q == abs(diff):
		ans = ans + 1
print('{:.13f}'.format(float(ans / (1 << cnt))))


import itertools
a = input()
b = input()
sa = 0
sb = 0
for i in range(len(a)):
	if a[i] == '+':
		sa += 1
	else:
		sa -= 1
	if b[i] == '+':
		sb += 1
	elif b[i] == '-':
		sb -= 1
q = b.count('?')
cnt = 0
pos = 0
for i in itertools.product([0, 1], repeat=q):
	cnt += 1
	sm = 0
	for j in i:
		if j == 0:
			sm -= 1
		else:
			sm += 1
	if sb + sm == sa:
		pos += 1
print(pos / cnt)


import math
from decimal import *
getcontext().prec = 12
a = input()
b = input()
sA = a.count('+') - a.count('-')
sB = b.count('+') - b.count('-')
p = b.count('?')
b = abs(sA - sB)
bul = False
if b == 0 and p == 0:
	print('1.000000000000')
elif b != 0 and p == 0:
	print('0.000000000000')
elif b > p:
	print(Decimal('0'))
elif b == p:
	x = 0.5 ** b
	bul = True
elif p % 2 == 0:
	a = p // 2 + b / 2
	b = p - a
	x = 0.5 ** p * math.factorial(p) / (math.factorial(a) * math.factorial(b))
	bul = True
else:
	a = p // 2 + 1 + b // 2
	b = p - a
	x = 0.5 ** p * math.factorial(p) / (math.factorial(a) * math.factorial(b))
	bul = True
if bul:
	x = str(x)
	y = len(x)
	zero = '0'
	while y < 14:
		x = x + '0'
		y = len(x)
	print(x)


s1 = input()
s2 = input()
x = 0
y = 0
for i in s1:
	if i == '+':
		x = x + 1
	else:
		x = x - 1
for i in s2:
	if i == '+':
		y = y + 1
	if i == '-':
		y = y - 1
import math

def ncr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
if '?' not in s2:
	if x == y:
		print(float(1))
	else:
		print(float(0))
else:
	n = s2.count('?')
	m = x - y
	if m == 0:
		if n % 2 == 0:
			print(ncr(n, n / 2) / 2 ** n)
		else:
			print(float(0))
	elif abs(m) > n:
		print(float(0))
	elif m % 2 == 0:
		if n % 2 == 1:
			print(float(0))
		else:
			print(ncr(n, n / 2 + m / 2) / 2 ** n)
	elif m % 2 == 1:
		if n % 2 == 0:
			print(float(0))
		else:
			print(ncr(n, n // 2 + m // 2 + 1) / 2 ** n)


from math import factorial
(s1, s2) = (input(), input())
pos = 0
for i in s1:
	if i == '+':
		pos += 1
	else:
		pos -= 1
(npos, tot, misc) = (0, 0, 0)
for i in s2:
	if i == '+':
		npos += 1
		tot += 1
	elif i == '-':
		npos -= 1
		tot += 1
	else:
		misc += 1
if npos == pos and tot == len(s2):
	print('%.12f' % 1)
else:
	arr = []
	(i, c) = (misc, 0)
	while i >= 0 and c <= misc:
		fac = int(factorial(misc) / (factorial(c) * factorial(misc - c)))
		for j in range(fac):
			arr.append(i + npos)
			if i > 0:
				arr.append(-i + npos)
		c += 1
		i -= 2
	co = arr.count(pos) / len(arr)
	print('%.12f' % co)


import math
import sys
from bisect import bisect_right, bisect_left, insort_right
from collections import Counter, defaultdict
from heapq import heappop, heappush
from itertools import accumulate
from sys import stdout
R = lambda : map(int, input().split())
t = input()
s = input()
k = t.count('+') - s.count('+')
n = s.count('?')
if k > n or k < 0:
	print('0.0')
else:
	print(math.factorial(n) / (math.factorial(k) * math.factorial(n - k)) / 2 ** n)


s = str(input())
x = s.count('+') - s.count('-')
t = str(input())
y = t.count('?')

def ncr(n, r):
	n1 = 1
	r1 = 1
	nr1 = 1
	for _ in range(n, 0, -1):
		n1 = n1 * _
	for _ in range(r, 0, -1):
		r1 = r1 * _
	for _ in range(n - r, 0, -1):
		nr1 = nr1 * _
	return n1 // (r1 * nr1)
if y == 0:
	if x == t.count('+') - t.count('-'):
		print('1.000000000000')
	else:
		print('0.000000000000')
else:
	z = t.count('+') - t.count('-')
	x = x - z
	if (x + y) % 2 != 0:
		print('0.000000000000')
	else:
		h = ncr(y, (x + y) // 2) / 2 ** t.count('?')
		h = str(h)
		if '.' not in str(h):
			print(h + '.' + '0' * 12)
		else:
			print(h + (12 - (len(h) - h.index('.'))) * '0')


from math import pow
import operator as op
from functools import reduce
s = input()
r = input()
x = 0
y = 0
z = 0

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom
for i in s:
	if i == '+':
		x += 1
	else:
		x -= 1
for j in r:
	if j == '+':
		y += 1
	elif j == '-':
		y -= 1
	else:
		z += 1
if z == 0 and x == y:
	print(1.0)
elif z == 0 and x != y:
	print(0.0)
else:
	diff = x - y
	a = (z + diff) / 2
	b = (z - diff) / 2
	if a >= 0 and b >= 0:
		f = pow(2, z)
		print(ncr(z, int(a)) / f)
	else:
		print(0.0)


from math import factorial

def C(m, n):
	return factorial(n) // (factorial(m) * factorial(n - m))
(command_1, command_2) = (input(), input())
num = command_2.count('?')
i = command_1.count('+') - command_1.count('-') - command_2.count('+') + command_2.count('-') + num
if i % 2 == 0 and 0 <= i // 2 <= num:
	print('%.9f' % (C(i // 2, num) / 2 ** num))
else:
	print('0.000000000')


import sys, math, bisect
from collections import Counter, defaultdict as dd

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
s1 = list(data())
s2 = list(data())
if s1.count('+') == s2.count('+') and s1.count('-') == s2.count('-'):
	print(1 / 1)
else:
	a = s2.count('?')
	plus = s1.count('+') - s2.count('+')
	minus = s1.count('-') - s2.count('-')
	if plus < 0 or minus < 0:
		print(0 / 1)
	else:
		r = math.factorial(a) / (math.factorial(plus) * math.factorial(a - plus))
		print(r / 2 ** a)


def func(y, c, i, z):
	if i == len(y):
		return c
	if y[i] == '?':
		z.append(func(y, c + 1, i + 1, z))
		z.append(func(y, c - 1, i + 1, z))
	if y[i] == '+':
		z.append(func(y, c + 1, i + 1, z))
	if y[i] == '-':
		z.append(func(y, c - 1, i + 1, z))
x = list(input())
y = input()
z = []
(c, i) = (0, 0)
a = func(y, c, i, z)
y = []
for i in z:
	if i != None:
		y.append(i)
print(y.count(x.count('+') - x.count('-')) / len(y))


import math
s1 = input()
s2 = input()
c1 = 0
c2 = 0
c3 = 0
for items in s1:
	if items == '+':
		c1 += 1
	if items == '-':
		c2 += 1
for items in s2:
	if items == '+':
		c1 -= 1
	if items == '-':
		c2 -= 1
	if items == '?':
		c3 += 1
if c2 < 0:
	print(0.0)
elif c2 > c3:
	print(0.0)
else:
	x = math.factorial(c1 + c2) // (math.factorial(c1) * math.factorial(c2))
	print(x / 2 ** (c1 + c2))


import math
s = input()
t = input()
if list(t).count('?') == 0:
	if list(t).count('+') == list(s).count('+') and list(t).count('-') == list(t).count('-'):
		print('1.0000000000')
		exit(0)
	elif list(t).count('+') != list(s).count('+') or list(t).count('-') != list(t).count('-'):
		print('0.0000000000')
		exit(0)
if list(t).count('?') != 0:
	total = 2 ** list(t).count('?')
	posi = list(s).count('+') - list(t).count('+')
	negi = list(s).count('-') - list(t).count('-')
	if posi < 0 or negi < 0:
		print('0.0000000000')
		exit(0)
	a = math.factorial(posi)
	b = math.factorial(negi)
	c = math.factorial(list(t).count('?'))
	total = total * a * b
	print('%.10f' % (c / total))


def geraCombinacoes(ordem, numero, qtdMais, inseridosMais):
	if numero == 0:
		if qtdMais == inseridosMais:
			global combinacoesValidas
			combinacoesValidas += 1
	elif qtdMais >= inseridosMais:
		geraCombinacoes(ordem + '+', numero - 1, qtdMais, inseridosMais + 1)
		geraCombinacoes(ordem + '-', numero - 1, qtdMais, inseridosMais)
original = input()
received = input()
originalPlus = 0
originalMinus = 0
receivedPlus = 0
receivedMinus = 0
receivedDoubt = 0
for i in range(len(original)):
	eo = original[i]
	er = received[i]
	if eo == '+':
		originalPlus += 1
	else:
		originalMinus += 1
	if er == '+':
		receivedPlus += 1
	elif er == '-':
		receivedMinus += 1
	else:
		receivedDoubt += 1
if originalPlus == 0 and receivedPlus > 0 or (originalMinus == 0 and receivedMinus > 0):
	print('{0:.12f}'.format(0))
elif originalPlus < receivedPlus or originalMinus < receivedMinus:
	print('{0:.12f}'.format(0))
else:
	combinacoesValidas = 0
	geraCombinacoes('', receivedDoubt, originalPlus - receivedPlus, 0)
	print('{0:.12f}'.format(combinacoesValidas / pow(2, receivedDoubt)))


import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom
a = input()
b = input()
a1 = a.count('+')
a2 = a.count('-')
b1 = b.count('+')
b2 = b.count('-')
b3 = b.count('?')
diff = a1 - a2 - (b1 - b2)
if abs(diff) > b3:
	print(float(0))
elif not diff % 2 == b3 % 2:
	print(float(0))
else:
	x = (b3 - diff) // 2
	print(ncr(b3, x) / 2 ** b3)


def fact(n):
	num = 2
	res = 1
	while num < n:
		res *= num
		num += 1
	return res
s1 = input()
s2 = input()
n = len(s1)
place = s1.count('+') - s1.count('-')
def_place = s2.count('+') - s2.count('-')
numundef = s2.count('?')
if abs(def_place - place) > numundef:
	print(0)
else:
	n2 = numundef * 2 + 1
	dp = [[0] * n2 for i in range(numundef + 1)]
	dp[0][def_place - place] = 1
	for i in range(1, numundef + 1):
		for j in range(n2):
			dp[i][(j + 1) % n2] += 0.5 * dp[i - 1][j]
			dp[i][j - 1] += 0.5 * dp[i - 1][j]
	print(dp[-1][0])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
s1 = input()
s2 = input()
s1p = s1n = 0
for ele in s1:
	s1p += int(ele == '+')
	s1n += int(ele == '-')
for ele in s2:
	s1p -= int(ele == '+')
	s1n -= int(ele == '-')

def ncr(n, r):
	num = 1
	den = 1
	for i in range(n, n - r, -1):
		num *= i
	for i in range(1, r + 1):
		den *= i
	return num / den
if s1p < 0 or s1n < 0:
	print(0.0)
else:
	print(ncr(s1p + s1n, s1p) / 2 ** (s1p + s1n))
endtime = time.time()


import sys
from queue import Queue

def solve_approx(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	romeo = f.readline().rstrip()
	juliet = f.readline().rstrip()
	final = romeo.count('+') - romeo.count('-')
	no_meets = 0
	q = Queue()
	q.put((0, 0))
	while not q.empty():
		(position, i) = q.get()
		if i == len(juliet):
			if position == final:
				no_meets += 1
		for j in range(i, len(juliet)):
			if juliet[j] == '?':
				q.put((position + 1, j + 1))
				q.put((position - 1, j + 1))
				break
			else:
				position += 1 if juliet[j] == '+' else -1
				if j + 1 == len(juliet):
					q.put((position, j + 1))
	return [f"{no_meets / 2 ** juliet.count('?')}"]

def main():
	for line in solve_approx():
		print(f'{line}')
main()


from math import factorial as f

def c(n, k):
	return f(n) // (f(k) * f(n - k))
a = input()
b = input()
first = [a.count(i) for i in '+-']
second = [b.count(i) for i in '+-']
n = b.count('?')
k = first[0] - second[0]
if k < 0:
	print(0)
elif n - k < 0:
	print(0)
else:
	print(c(n, k) / 2 ** n)


from math import *

def fact(n):
	if n == 0:
		return 1
	return fact(n - 1) * n
inp1 = input()
pos = 0
for i in inp1:
	if i == '+':
		pos += 1
	else:
		pos -= 1
inp2 = input()
pos2 = 0
cnt = 0
for i in inp2:
	if i == '+':
		pos2 += 1
	elif i == '-':
		pos2 -= 1
	else:
		cnt += 1
m = pos2 - pos
if (cnt + m) % 2 == 0 and abs(pos2 - pos) <= cnt:
	t = abs((cnt + m) // 2)
	ans = fact(cnt) / (fact(t) * fact(cnt - t))
	ans = ans / 2 ** cnt
	print(ans)
else:
	print(0)


from math import factorial
s = input().strip()
new = input().strip()
questions = 0
plus = s.count('+')
minus = s.count('-')
for i in new:
	if i == '+':
		plus -= 1
	elif i == '-':
		minus -= 1
	else:
		questions += 1
if plus < 0 or minus < 0:
	print(0)
else:
	num = factorial(questions) / (factorial(plus) * factorial(minus))
	den = 2 ** questions
	print('{0:.10f}'.format(num / den))


(t, D, d) = (0, {0: 1}, {'+': [1], '-': [-1], '?': [-1, 1]})
for si in input():
	t += d[si][0]
for pi in input():
	nd = {}
	for (x, p) in D.items():
		for dr in d[pi]:
			nd[x + dr] = nd.get(x + dr, 0) + p / len(d[pi])
	D = nd
print(D.get(t, 0))


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
s1 = input()
s2 = input()
s1Dict = defaultdict(int)
s2Dict = defaultdict(int)
for ch in s1:
	s1Dict[ch] += 1
for ch in s2:
	s2Dict[ch] += 1
if s1Dict['+'] == s2Dict['+'] and s1Dict['-'] == s2Dict['-']:
	print(1)
elif s1Dict['+'] < s2Dict['+'] or s1Dict['-'] < s2Dict['-']:
	print(0)
else:
	diffPlus = abs(s1Dict['+'] - s2Dict['+'])
	diffMinus = abs(s1Dict['-'] - s2Dict['-'])
	print(nCr(s2Dict['?'], diffPlus) / 2 ** s2Dict['?'])


s = input()
s2 = input()
d = [0] * 50
k = 25
for i in s:
	if i == '-':
		k -= 1
	else:
		k += 1
k2 = 25
dv = 0
for i in s2:
	if i == '-':
		k2 -= 1
	elif i == '+':
		k2 += 1
	else:
		dv += 1
d[k2] = 1
for i in range(dv):
	a = [k for k in d]
	for j in range(1, 49):
		a[j] = d[j - 1] + d[j + 1]
	for j in range(50):
		d[j] = a[j]
print(d[k] / sum(d))


from math import factorial
(s1, s2) = (input(), input())
a = s1.count('+') - s2.count('+')
b = s1.count('-') - s2.count('-')
if a < 0 or b < 0:
	print(0)
	exit(0)
ans = factorial(a + b) / factorial(a) / factorial(b)
ans /= 2 ** (a + b)
print('%.10f' % ans)


import sys
import math
import collections
inp = lambda : sys.stdin.readline()
s = inp()
t = inp()
p1 = s.count('+') - t.count('+')
p2 = s.count('-') - t.count('-')
k = t.count('?')
if k < p1 + p2 or p1 < 0 or p2 < 0:
	print(0)
else:
	ans = math.factorial(p1 + p2) // (math.factorial(p1) * math.factorial(p2))
	ans /= 2 ** k
	print(ans)


import math
a = list(input())
b = list(input())
total = 0
count = 0
ques = 0
k = len(a)
for i in range(0, k):
	if a[i] == '+':
		total = total + 1
	else:
		total = total - 1
	if b[i] == '+':
		count = count + 1
	elif b[i] == '-':
		count = count - 1
	elif b[i] == '?':
		ques = ques + 1
if total == count and ques == 0:
	print('1')
elif ques == 0 and total != count:
	print('0')
elif total > 0 and count + ques < total:
	print('0')
elif total < 0 and count - ques > total:
	print('0')
else:
	need = total - count
	plus = ques
	minus = 0
	k = 0
	while 1 > 0:
		if plus - minus == need:
			k = 1
			break
		minus = minus + 1
		plus = ques - minus
	if k == 0:
		print('0')
	else:
		one = math.factorial(ques) / (math.factorial(plus) * math.factorial(minus))
		two = pow(2, ques)
		print(int(one) / int(two))


def fac(n):
	if n == 1 or n == 0:
		return 1
	else:
		return n * fac(n - 1)

def wifi(a1, a2):
	p = 0
	m = 0
	for x in a1:
		if x == '+':
			p += 1
		else:
			m += 1
	p1 = 0
	m1 = 0
	q = 0
	for y in a2:
		if y == '+':
			p1 += 1
		elif y == '-':
			m1 += 1
		else:
			q += 1
	p_ = p - p1
	m_ = m - m1
	if p_ == 0 and m_ == 0 and (q == 0):
		return 1
	if p_ < 0 or m_ < 0:
		return 0
	else:
		return fac(q) // (fac(p_) * fac(m_)) / 2 ** q
a1 = input()
a2 = input()
print(wifi(a1, a2))


triangle = ['1', '1,1', '1,2,1', '1,3,3,1', '1,4,6,4,1', '1,5,10,10,5,1', '1,6,15,20,15,6,1', '1,7,21,35,35,21,7,1', '1,8,28,56,70,56,28,8,1', '1,9,36,84,126,126,84,36,9,1', '1,10,45,120,210,252,210,120,45,10,1']
tri = []
for x in triangle:
	aux = []
	aux += map(int, x.split(','))
	tri.append(aux)

def count(vet):
	res = {'+': 0, '-': 0, '?': 0}
	for x in vet:
		res[x] += 1
	return res
gab = count(input())
teste = count(input())
saldo_gab = gab['+'] - gab['-']
saldo_teste = teste['+'] - teste['-']
delta = abs(saldo_gab - saldo_teste)
idx = (teste['?'] - delta) // 2
if (teste['?'] - delta) % 2 != 0:
	prob = 0
elif teste['?'] < delta:
	prob = 0
elif teste['?'] == 0 and delta == 0:
	prob = 1
else:
	prob = tri[teste['?']][idx] / sum(tri[teste['?']])
print(prob)


def rec(v, s, bal):
	global c, div
	if v == len(s):
		div += 1
		if bal == ans:
			c += 1
	elif s[v] == '+':
		rec(v + 1, s, bal + 1)
	elif s[v] == '-':
		rec(v + 1, s, bal - 1)
	else:
		rec(v + 1, s, bal + 1)
		rec(v + 1, s, bal - 1)
a = input()
ans = a.count('+') - a.count('-')
b = input()
c = 0
div = 0
rec(0, b, 0)
print(c / div)


def factorial(n):
	if n == 1 or n == 0:
		return 1
	else:
		return n * factorial(n - 1)
strin = input()
strin2 = input()
count = 0
p1 = 0
n1 = 0
p2 = 0
n2 = 0
for i in range(len(strin)):
	if strin[i] == '+':
		p1 += 1
	elif strin[i] == '-':
		n1 += 1
	if strin2[i] == '+':
		p2 += 1
	elif strin2[i] == '-':
		n2 += 1
ans2 = 0
pro = p1 + n1 - p2 - n2
probability = 2 ** pro
if p1 - p2 == 0 and n1 - n2 == 0:
	ans2 = 1.0
elif p1 - p2 < 0 or n1 - n2 < 0:
	int(ans2) == 0.0
elif p1 - p2 > 0 or n1 - n2 > 0:
	ans2 = factorial(pro) / (factorial(p1 - p2) * factorial(n1 - n2)) / probability
print(ans2)


import math

def check(s1, s2):
	n = len(s1)
	result = float()
	s1countPos = s1.count('+')
	s1countNeg = s1.count('-')
	s2countPos = s2.count('+')
	s2countNeg = s2.count('-')
	s2countUnRecog = n - s2countPos - s2countNeg
	s1finalPlace = s1countPos - s1countNeg
	s2finalPlace = s2countPos - s2countNeg
	if s2countUnRecog == 0:
		if s1finalPlace == s2finalPlace:
			result += 1
		return result
	else:
		possiblities = 2 ** s2countUnRecog
		reqPos = s1countPos - s2countPos
		reqNeg = s1countNeg - s2countNeg
		if reqPos < 0 or reqNeg < 0 or reqPos + reqNeg != s2countUnRecog:
			return result
		else:
			reqPossibilities = math.factorial(s2countUnRecog) // (math.factorial(reqPos) * math.factorial(reqNeg))
			result += reqPossibilities / possiblities
			return result
s1 = input().rstrip()
s2 = input().rstrip()
print(check(s1, s2))


import math
d = input()
do = input()
tp = d.count('+')
tm = d.count('-')
top = do.count('+')
tom = do.count('-')
n = do.count('?')
rp = tp - top
rm = tm - tom
if n:
	if rp < 0 or rm < 0:
		print(f'{0.0:.9f}')
	else:
		fact = math.factorial(n) / (math.factorial(rp) * math.factorial(n - rp)) * 0.5 ** n
		print(f'{fact:.9f}')
elif tp == top and tm == tom:
	print(f'{1.0:.9f}')
else:
	print(f'{0.0:.9f}')


import collections

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
s1 = input()
s2 = input()
d1 = collections.Counter(s1)
d2 = collections.Counter(s2)
Net1 = d1['+'] - d1['-']
Net2 = d2['+'] - d2['-']
no_of_question_marks = d2['?']
length_of_path_to_travel = abs(Net1 - Net2)
if no_of_question_marks % 2 == 0:
	if length_of_path_to_travel % 2 == 0 and length_of_path_to_travel <= no_of_question_marks:
		x = length_of_path_to_travel
		y = (no_of_question_marks - length_of_path_to_travel) // 2
		sign1 = x + y
		sign2 = y
		print(fact(no_of_question_marks) / (fact(sign1) * fact(sign2)) / 2 ** no_of_question_marks)
	else:
		print(0)
elif length_of_path_to_travel % 2 != 0 and length_of_path_to_travel <= no_of_question_marks:
	x = length_of_path_to_travel
	y = (no_of_question_marks - length_of_path_to_travel) // 2
	sign1 = x + y
	sign2 = y
	print(fact(no_of_question_marks) / (fact(sign1) * fact(sign2)) / 2 ** no_of_question_marks)
else:
	print(0)


s1 = input()
s2 = input()
prob = [0.0 for _ in range(30)]
prob2 = [0.0 for _ in range(30)]
desired_pos = 15 + s1.count('+') - s1.count('-')
unknown = s2.count('?')
known_offset = s2.count('+') - s2.count('-')
prob[15 + known_offset] = 1.0
for _ in range(unknown):
	for idx in range(1, len(prob) - 1):
		prob2[idx] = 0.5 * (prob[idx - 1] + prob[idx + 1])
	(prob, prob2) = (prob2, prob)
print(prob[desired_pos])


s1 = input()
s2 = input()
final = 0
for i in s1:
	if i == '+':
		final += 1
	else:
		final -= 1
val = [0]
for i in s2:
	l = len(val)
	for j in range(l):
		if i == '+':
			val[j] += 1
		elif i == '-':
			val[j] -= 1
		else:
			val[j] -= 1
			val.append(val[j] + 2)
count = 0
for i in val:
	if i == final:
		count += 1
print(count / len(val))


s1 = input()
s2 = input()
x1 = 0
for i in s1:
	if i == '+':
		x1 += 1
	else:
		x1 -= 1
x2 = 0
v = 0
for i in s2:
	if i == '+':
		x2 += 1
	elif i == '-':
		x2 -= 1
	else:
		v += 1
dp = [[-1 for i in range(0, 12)] for j in range(0, 12)]

def cmb(n, r):
	if dp[n][r] != -1:
		return dp[n][r]
	elif n == r:
		dp[n][r] = 1
		return dp[n][r]
	elif n == 0:
		dp[n][r] = 0
		return dp[n][r]
	elif r == 0:
		dp[n][r] = 1
		return dp[n][r]
	else:
		dp[n][r] = cmb(n - 1, r) + cmb(n - 1, r - 1)
		return dp[n][r]
import math
target = abs(x1 - x2)
ans = 0
if target % 2 != v % 2 or target > v:
	ans = 0
else:
	ans = cmb(v, int((v - target) / 2)) / math.pow(2, v)
print(ans)


def contador_mais_menos(s):
	num_mais = 0
	num_menos = 0
	num_interrogacao = 0
	for c in s:
		if c == '+':
			num_mais += 1
		elif c == '-':
			num_menos += 1
		else:
			num_interrogacao += 1
	return (num_mais, num_menos, num_interrogacao)

def gen_bin_possib(n, arr, possibilidades, i, dif2):
	if i == n:
		(num_mais, num_menos, num_interrogacao) = contador_mais_menos(arr)
		possibilidades.append(num_mais - num_menos + dif2)
		return
	arr[i] = '+'
	gen_bin_possib(n, arr, possibilidades, i + 1, dif2)
	arr[i] = '-'
	gen_bin_possib(n, arr, possibilidades, i + 1, dif2)
s1 = input()
(num_mais1, num_menos1, num_interrogacao1) = contador_mais_menos(s1)
dif_s1 = num_mais1 - num_menos1
s2 = input()
(num_mais2, num_menos2, num_interrogacao2) = contador_mais_menos(s2)
dif_s2 = num_mais2 - num_menos2
ans = 0.0
if num_mais1 == num_mais2 and num_menos1 == num_menos2:
	ans = 1.0
else:
	n = num_interrogacao2
	arr = [None] * n
	possibilidades = []
	gen_bin_possib(n, arr, possibilidades, 0, dif_s2)
	for x in possibilidades:
		if x == dif_s1:
			ans += 1
	ans /= len(possibilidades)
print(ans)


s1 = input()
s2 = input()
pos = 0
for i in s1:
	if i == '+':
		pos += 1
	else:
		pos -= 1
num = 0
x = 0
for i in s2:
	if i == '?':
		num += 1
	elif i == '+':
		x += 1
	elif i == '-':
		x -= 1
sit = 0
for i in range(2 ** num):
	qaq = 0
	r = i
	while r > 0:
		if r % 2 == 1:
			qaq += 1
		r //= 2
	qaq = qaq - (num - qaq)
	if x + qaq == pos:
		sit += 1
print(sit / 2 ** num)


def nck(n, k):
	if k < 0 or k > n:
		return 0
	if k in (0, n):
		return 1
	return nck(n - 1, k - 1) + nck(n - 1, k)
A = str(input())
B = str(input())
(k, s) = (0, 0)
for c in A:
	if c == '+':
		k += 1
	else:
		k -= 1
for c in B:
	if c == '+':
		k -= 1
	elif c == '-':
		k += 1
	else:
		s += 1
if s + k & 1:
	print('0')
	exit()
p = s + k >> 1
num = nck(s, p)
dum = 1 << s
print('{:.15f}'.format(num / dum))


def f(correct, received):
	org = 0
	for c in correct:
		if c == '+':
			org += 1
		else:
			org -= 1
	cur = [0]
	for c in received:
		newp = []
		if c == '+':
			for pos in cur:
				newp.append(pos + 1)
		elif c == '-':
			for pos in cur:
				newp.append(pos - 1)
		elif c == '?':
			for pos in cur:
				newp.append(pos - 1)
				newp.append(pos + 1)
		cur = newp
	return cur.count(org) / float(len(cur))
assert f('+-+-', '+-??') == 0.5
assert f('+++', '??-') == 0
assert f('++-+-', '+-+-+') == 1.0
c = input()
s = input()
ans = f(c, s)
print(ans)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
s1 = cin()
s2 = cin()
ans = temp = n = 0
for (i, j) in zip(s1, s2):
	ans += (i == '+') + (i == '-') * -1
	temp += (j == '+') + (j == '-') * -1
	n += j == '?'
x = [0, temp]
for i in range(1, n + 1):
	for j in range(2 ** (i - 1), 2 ** i):
		x += (x[j] + 1, x[j] - 1)
count = 0
for val in x[2 ** n:]:
	count += val == ans
cout(str(count / 2 ** n))


def comb(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0
s1 = input()
s2 = input()
a = s1.count('+') - s1.count('-')
b = s2.count('+') - s2.count('-')
q = s2.count('?')
k = a - b
if q == 0 and k == 0:
	print(1.0)
elif q & 1 == k & 1 and -q <= k <= q:
	p = k + q >> 1
	print(comb(q, p) / 2 ** q)
else:
	print(0.0)


def w(n, o, x):
	if len(n) == x:
		o.append(n)
		return
	w(n + '-', o, x)
	w(n + '+', o, x)

def go():
	a = [i for i in input()]
	b = [i for i in input()]
	s_a = 0
	s_b = 0
	u = 0
	for i in a:
		if i == '-':
			s_a -= 1
		else:
			s_a += 1
	for i in b:
		if i == '-':
			s_b -= 1
		elif i == '+':
			s_b += 1
		else:
			u += 1
	if u == 0:
		if s_a == s_b:
			return float(1)
		return float(0)
	o = []
	w('', o, u)
	c = 0
	for i in range(len(o)):
		s_x = s_b
		for j in o[i]:
			if j == '-':
				s_x -= 1
			else:
				s_x += 1
		if s_x == s_a:
			c += 1
	return c / len(o)
print(go())


from math import factorial
entrada = list(str(input()))
entrada_err = list(str(input()))
net_pos = entrada.count('+') - entrada_err.count('+')
net_neg = entrada.count('-') - entrada_err.count('-')
integg = entrada_err.count('?')
if net_pos == 0 and net_neg == 0:
	print('1.0')
elif net_neg < 0 or net_pos < 0:
	print('0.0')
else:
	prob = factorial(integg) / factorial(integg - net_pos) / factorial(net_pos) * 0.5 ** integg
	print(prob)


def calc_factorial(doubt, plus1, sub):
	num = 1
	for i in range(1, doubt + 1):
		num *= i
		if i == doubt:
			doubt = num
		if i == sub:
			sub = num
		if i == plus1:
			plus1 = num
	if doubt == 0:
		doubt = 1
	if plus1 == 0:
		plus1 = 1
	if sub == 0:
		sub = 1
	return (doubt, plus1, sub)
s1 = input()
s2 = input()
plus1 = plus2 = 0
minus1 = minus2 = 0
doubt = 0
probability = 1
for i in range(len(s1)):
	if s1[i] == '+':
		plus1 += 1
	else:
		minus1 += 1
	if s2[i] == '+':
		plus2 += 1
	elif s2[i] == '-':
		minus2 += 1
	else:
		doubt += 1
if doubt == 0:
	sum1 = plus1 - minus1
	sum2 = plus2 - minus2
	if sum1 == sum2:
		print('1.000000')
	else:
		print('0.000000')
elif plus1 - plus2 > doubt or plus1 < plus2:
	print(0.0)
else:
	(doubt2, plus1, minus) = calc_factorial(doubt, plus1 - plus2, doubt - (plus1 - plus2))
	prob = doubt2 / (plus1 * minus) / 2 ** doubt
	if prob <= 0:
		print(0.0)
	else:
		print(prob)


expected = input()
given = input()
target = 0
for i in expected:
	if i == '+':
		target += 1
	if i == '-':
		target -= 1

def checkTarget(str, index, length, comp, target):
	if index == length and comp == target:
		return 1
	if index == length and comp != target:
		return 0
	elif str[index] == '+':
		return checkTarget(str, index + 1, length, comp + 1, target)
	elif str[index] == '-':
		return checkTarget(str, index + 1, length, comp - 1, target)
	else:
		return checkTarget(str, index + 1, length, comp + 1, target) + checkTarget(str, index + 1, length, comp - 1, target)
numerator = checkTarget(given, 0, len(given), 0, target)
denominator = 1 << given.count('?')
print('{0:.16f}'.format(numerator / denominator))


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
n = input()
f = input()
a = 0
for i in n:
	a += 1 if i == '+' else -1
b = 0
und = 0
for i in f:
	if i == '+':
		b += 1
	elif i == '-':
		b -= 1
	else:
		und += 1
d = abs(a - b)
if d > und or d % 2 != und % 2:
	print('%.12f' % 0)
else:
	print('%.9f' % (nCr(und, (und - d) // 2) / 2 ** und))


def rec(val, s, counter, indx, cur_sum):
	if indx >= len(s):
		if cur_sum not in counter:
			counter[cur_sum] = 0
		counter[cur_sum] += 1
	elif s[indx] == '+':
		rec(val, s, counter, indx + 1, cur_sum + 1)
	elif s[indx] == '-':
		rec(val, s, counter, indx + 1, cur_sum - 1)
	else:
		rec(val, s, counter, indx + 1, cur_sum + 1)
		rec(val, s, counter, indx + 1, cur_sum - 1)
counter = {}
val = sum((1 if ch == '+' else -1 for ch in input()))
rec(val, input(), counter, 0, 0)
print(0 if val not in counter else counter[val] / sum(counter.values()))


def factorial(n):
	result = 1
	for i in range(2, n + 1):
		result *= i
	return result
commands = input().strip()
received = input().strip()
n = len(commands)
positive = 0
negative = 0
count = 0
for i in range(n):
	if commands[i] == '+':
		positive += 1
	else:
		negative += 1
	if received[i] == '+':
		positive -= 1
	elif received[i] == '-':
		negative -= 1
	else:
		count += 1
cases = 2 ** count
probability = 0.0
if positive >= 0 and negative >= 0:
	probability = factorial(count) / (factorial(positive) * factorial(negative)) / cases
print('{0:.9f}'.format(probability))


from math import factorial
from typing import Tuple

def parse_input() -> Tuple[str, str]:
	return (input(), input())

def f(a: int, b: int) -> float:
	n = a + b
	return factorial(n) / factorial(a) / factorial(b) / 2 ** n

def solve(s1: str, s2: str) -> float:
	plus_count = s1.count('+') - s2.count('+')
	minus_count = s1.count('-') - s2.count('-')
	moves = s2.count('?')
	if plus_count < 0 or minus_count < 0:
		return 0.0
	if plus_count + minus_count != moves:
		return 0.0
	return f(plus_count, minus_count)
(s1, s2) = parse_input()
print(solve(s1, s2))


s = input()
t = input()
(a, b, c) = (0, 0, 0)
for item in s:
	if item == '+':
		a += 1
	else:
		a -= 1
for item in t:
	if item == '+':
		b += 1
	elif item == '-':
		b -= 1
	else:
		c += 1
if c < abs(a - b) or (c - abs(a - b)) % 2 == 1:
	print(0)
else:
	x = 0.5 ** c
	for i in range((c - abs(a - b)) // 2):
		x *= c - i
		x /= 1 + i
	print(x)


from itertools import permutations

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res *= i
	return res
s1 = input()
s2 = input()
np = 0
nm = 0
for i in range(len(s1)):
	if s1[i] == '+':
		np += 1
	elif s1[i] == '-':
		nm += 1
fc = np - nm
np = 0
nm = 0
nk = 0
for i in range(len(s2)):
	if s2[i] == '+':
		np += 1
	elif s2[i] == '-':
		nm += 1
	else:
		nk += 1
cc = np - nm
if abs(fc - cc) > nk:
	print(0)
elif fc == cc and nk == 0:
	print(1)
else:
	tm = 2 ** nk
	d = fc - cc
	for i in range(nk, -1, -1):
		if 2 * i - nk == d:
			r = i
			break
	rm = nCr(nk, r)
	print(rm / tm)


import math
f = math.factorial
inp = input()
zz = inp.count('+')
kk = inp.count('-')
out = input()
yy = out.count('+')
jj = out.count('-')
n = out.count('?')
r = zz - yy
if zz < yy or kk < jj:
	print(0)
else:
	print(f(n) / f(n - r) / f(r) * 0.5 ** n)


(MyList, Res) = ([0], 0)
First = input()
Second = input()
for i in range(len(First)):
	Temp = []
	Res += 1 if First[i] == '+' else -1
	if '?' not in First[i] + Second[i]:
		for P in MyList:
			Temp.append(P + 1 if Second[i] == '+' else P - 1)
	else:
		for P in MyList:
			Temp.append(P + 1)
			Temp.append(P - 1)
	MyList = Temp[:]
print(MyList.count(Res) / len(MyList))


from math import factorial as f
s1 = input()
s2 = input()
plus = s1.count('+') - s2.count('+')
minus = s1.count('-') - s2.count('-')
quest = s2.count('?')
if plus < 0 or minus < 0:
	print(0)
else:
	print(f(quest) / (f(plus) * f(minus)) / 2 ** quest)


def f(n):
	if n == 0:
		return 1
	return n * f(n - 1)
a = input()
b = input()
H = a.count('+')
T = a.count('-')
SUM = H - T
h = b.count('+')
t = b.count('-')
u = b.count('?')
_sum = h - t
tgt = SUM - _sum
ways = 0
for i in range(0, u + 1):
	j = u - i
	if i - j == tgt:
		ways += f(i + j) / f(i) / f(j)
print(ways / pow(2, u))


g = input()
c = input()
gc = 0
for i in g:
	gc += 1 if i == '+' else -1
l = []
if c[0] == '+':
	l.append([1])
elif c[0] == '-':
	l.append([-1])
else:
	l.append([1, -1])
for i in range(1, len(c)):
	if c[i] == '?':
		l.append(l[i - 1] * 2)
		for j in range(len(l[i]) // 2):
			l[i][j] += 1
		for j in range(len(l[i]) // 2, len(l[i])):
			l[i][j] -= 1
	else:
		inc = 1 if c[i] == '+' else -1
		l.append(l[i - 1])
		for j in range(len(l[i])):
			l[i][j] += inc
n = l[-1].count(gc)
print(n / len(l[-1]))


from math import factorial
s1 = input()
s2 = input()
p = 0
m = 0
blank = 0
for i in range(len(s1)):
	if s1[i] == '+':
		p += 1
	else:
		m += 1
	if s2[i] == '+':
		p -= 1
	elif s2[i] == '-':
		m -= 1
	else:
		blank += 1
if m < 0 or p < 0:
	print(0)
elif m == 0:
	print(0.5 ** p)
elif p == 0:
	print(0.5 ** m)
else:
	b = blank
	print(factorial(b) / factorial(p) / factorial(m) * 0.5 ** b)


s1 = input()
s2 = input()
s1_count_plus = 0
s2_count_plus = 0
s2_q = 0
for i in s1:
	if i == '+':
		s1_count_plus += 1
for i in s2:
	if i == '?':
		s2_q += 1
	elif i == '+':
		s2_count_plus += 1
p = []
for i in range(s2_q + 1):
	if i == 0:
		p.append(1)
	else:
		p.append(p[i - 1] * (s2_q + 1 - i) / i)
diff = s1_count_plus - s2_count_plus
if diff == 0 and s2_q == 0:
	print('{:.12f}'.format(1))
elif s2_q < diff or diff < 0:
	print('{:.12f}'.format(0))
elif s2_q == 1:
	print('{:.12f}'.format(0.5))
else:
	print('{:.12f}'.format(p[s1_count_plus - s2_count_plus] * 1.0 / 2 ** s2_q))


s1 = input()
s2 = input()

def solve(a, b):
	global target1
	global cnt
	if b == 0:
		if a == target1:
			cnt = cnt + 1
		return
	solve(a + 1, b - 1)
	solve(a - 1, b - 1)
target1 = 0
for s in s1:
	if s == '+':
		target1 = target1 + 1
	else:
		target1 = target1 - 1
target2 = 0
uncertainty = 0
for s in s2:
	if s == '+':
		target2 = target2 + 1
	elif s == '-':
		target2 = target2 - 1
	else:
		uncertainty = uncertainty + 1
cnt = 0
solve(target2, uncertainty)
print(format(1 / 2 ** uncertainty * cnt, '.20f'))


from math import factorial
v1 = input()
n = len(v1)
v2 = input()
p1 = sum((1 if x == '+' else -1 for x in v1))
p2 = [1 if x == '+' else -1 for x in v2 if x != '?']
rem = len(v2) - len(p2)
p2 = sum(p2)
p = 0
c = lambda n, m: factorial(n) / (factorial(m) * factorial(n - m))
for i in range(rem, -1, -1):
	if p2 + i - (rem - i) == p1:
		p = c(rem, i) / 2 ** rem
		break
print(p)


from math import factorial as f
ncr = lambda n, r: f(n) // f(n - r) // f(r)
s = input()
r = input()
og = 0
for i in s:
	if i == '+':
		og += 1
	else:
		og -= 1
rc = 0
qm = 0
for i in r:
	if i == '?':
		qm += 1
	elif i == '+':
		rc += 1
	else:
		rc -= 1
if qm:
	req = og - rc
	if abs(req) > qm or req & 1 ^ qm & 1:
		print(0)
	else:
		print(ncr(qm, qm + abs(req) >> 1) / (1 << qm))
elif og == rc:
	print(1)
else:
	print(0)


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)

def solve():
	dra = input()
	dre = input()
	dra_p = dra.count('+')
	dra_n = dra.count('-')
	dre_p = dre.count('+')
	dre_n = dre.count('-')
	dre_q = dre.count('?')
	if dre_q == 0:
		if dra_p - dra_n == dre_p - dre_n:
			print(1.0)
		else:
			print(0.0)
		return
	if dra_p < dre_p or dra_n < dre_n:
		print(0.0)
		return
	print(nCr(dre_q, dra_p - dre_p) / pow(2, dre_q))
solve()


import math
sone = list(input())
stwo = list(input())
sum1 = 0
sum2 = 0
m = 0
for i in range(len(sone)):
	if sone[i] == '+':
		sum1 = sum1 + 1
		m = m + 1
	else:
		sum1 = sum1 - 1
k = 0
for i in range(len(stwo)):
	if stwo[i] == '+':
		sum2 = sum2 + 1
		k = k
	elif stwo[i] == '-':
		sum2 = sum2 - 1
		k = k
	elif stwo[i] == '?':
		k = k + 1
n = 0
if k - abs(sum1 - sum2) < 0:
	print(float(0))
elif k - abs(sum1 - sum2) == 0:
	if k == 0:
		print(float(1))
	else:
		print(float(pow(0.5, k)))
else:
	n = k - abs(sum1 - sum2)
	n = abs(sum1 - sum2) + n / 2
	if abs(sum1 - sum2) == 0:
		print(float(math.factorial(k) / (math.factorial(k / 2) * math.factorial(k / 2)) * pow(0.5, k)))
	else:
		print(float(math.factorial(k) / (math.factorial(k - n) * math.factorial(n)) * pow(0.5, k)))


from sys import stdin, stdout
import cProfile, math
printHeap = str()
test = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline())

def get_tuple():
	return map(int, stdin.readline().split())

def get_str_list():
	return list(map(str, stdin.readline().split()))

def get_list():
	return list(map(int, stdin.readline().split()))
arguments = list()
results = list()

def clear_cache():
	global arguments, results
	(arguments, results) = (list(), list())

def cached_fn(fn, *args):
	global arguments, results
	if args in arguments:
		return results[arguments.index(args)]
	else:
		result = fn(*args)
		arguments.append(args)
		results.append(result)
		return result

def main():
	sent = str(stdin.readline())
	recieved = str(stdin.readline())
	(sp, sm, rp, rm, ru) = (sent.count('+'), sent.count('-'), recieved.count('+'), recieved.count('-'), recieved.count('?'))
	net = abs(sp - sm - rp + rm)
	if net <= ru:
		diff = ru - net
		if diff % 2 == 0:
			a = net + diff // 2
			result = math.factorial(ru) / (math.factorial(a) * math.factorial(ru - a)) / 2 ** ru
			print('%.12f' % result)
		else:
			print('0.000000000000')
	else:
		print('0.000000000000')
cProfile.run('main()') if test else main()


from math import factorial

def C(k, n):
	return factorial(n) // factorial(k) // factorial(n - k)
s1 = input()
s2 = input()
n1 = s1.count('+')
n2 = s2.count('+')
n3 = s2.count('?')
if n2 > n1:
	print(0)
else:
	try:
		print(C(n1 - n2, n3) / 2 ** n3)
	except:
		print(0)


def possibility(a, b):
	if a > b:
		temp = a
		a = b
		b = temp
	c = 1
	for i in range(b + 1, a + b + 1):
		c *= i
	for i in range(1, a):
		a *= i
	return c / a
s1 = input()
s2 = input()
one = [0, 0]
two = [0, 0]
question = 0
for i in range(0, len(s1)):
	if s1[i] == '+':
		one[0] += 1
	elif s1[i] == '-':
		one[1] += 1
	if s2[i] == '+':
		two[0] += 1
	elif s2[i] == '-':
		two[1] += 1
	else:
		question += 1
one[0] -= two[0]
one[1] -= two[1]
if one[0] < 0 or one[1] < 0:
	print(0)
elif one[0] == 0 or one[1] == 0:
	print(1 / pow(2, one[0] + one[1]))
else:
	print(possibility(one[0], one[1]) / pow(2, one[0] + one[1]))


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def main():
	s1 = I()
	s2 = I()
	cnt = 0
	for i in s1:
		if i == '+':
			cnt += 1
		else:
			cnt -= 1
	tmp = 0
	bit = 0
	for i in s2:
		if i == '+':
			tmp += 1
		elif i == '?':
			bit += 1
		else:
			tmp -= 1
	if cnt == tmp and bit == 0:
		print(1.0)
	elif cnt == tmp:
		if bit % 2:
			print(0.0)
		else:
			req = (bit + abs(cnt - tmp)) // 2
			x = ncr(bit, req) / (1 << bit)
			print(x)
	elif cnt > tmp:
		if tmp + bit < cnt:
			print(0.0)
		else:
			req = (bit + abs(cnt - tmp)) // 2
			x = ncr(bit, req) / (1 << bit)
			print(x)
	elif tmp - bit > cnt:
		print(0.0)
	else:
		req = (bit + abs(cnt - tmp)) // 2
		x = ncr(bit, req) / (1 << bit)
		print(x)
main()


import math

def find_nCr(n, r):
	return math.factorial(n) / (math.factorial(r) * math.factorial(n - r))
sent = input()
received = input()
final_pos = 0
current_pos = 0
uncertain = 0
for s in sent:
	if s == '+':
		final_pos += 1
	else:
		final_pos -= 1
for s in received:
	if s == '+':
		current_pos += 1
	elif s == '-':
		current_pos -= 1
	else:
		uncertain += 1
if uncertain == 0:
	if final_pos == current_pos:
		print(1)
	else:
		print(0)
else:
	positions = list(range(current_pos - uncertain, current_pos + uncertain + 2, 2))
	try:
		pos_index = positions.index(final_pos)
		a = find_nCr(uncertain, pos_index)
		b = math.pow(2, uncertain)
		print(a / b)
	except:
		pos_index = -1
		print(0)


from math import factorial

def ncr(n, r):
	return factorial(n) / factorial(n - r) / factorial(r)
sent = input()
received = input()
N = sent.count('+') - sent.count('-')
n = received.count('+') - received.count('-')
k = received.count('?')
if abs(N - n) > k or (N - n - k) % 2 == 1:
	print(0.0)
else:
	fraction = (k + abs(N - n)) / 2
	print(ncr(k, fraction) * 0.5 ** k)


(s, t) = (input(), input())
a = sum((1 if _ == '+' else -1 for _ in s))
c = 0

def dfs(t, idx, b):
	global c
	if idx == len(t):
		if b == a:
			c += 1
		return
	if t[idx] == '+':
		dfs(t, idx + 1, b + 1)
	elif t[idx] == '-':
		dfs(t, idx + 1, b - 1)
	else:
		dfs(t, idx + 1, b + 1)
		dfs(t, idx + 1, b - 1)
dfs(t, 0, 0)
d = t.count('?')
print('{:.9f}'.format(1.0 * c / 2 ** d))


def fact(n):
	i = 1
	for j in range(1, n + 1):
		i *= j
	return i
s1 = input()
s2 = input()
k = 0
ipos = 0
for i in s1:
	if i == '+':
		ipos += 1
	else:
		ipos -= 1
fpos = 0
for i in s2:
	if i == '+':
		fpos += 1
	elif i == '-':
		fpos -= 1
	else:
		k += 1
d = ipos - fpos
if k % 2 != d % 2 or abs(d) > k:
	print('0.00000000000')
else:
	n = (k + d) // 2
	m = (k - d) // 2
	ans = fact(k) / (fact(n) * fact(m) * 2 ** k)
	print(ans)


def fac(n):
	s = 1
	if n >= 1:
		for i in range(1, n + 1):
			s = s * i
		return s
	else:
		return 1
s = input()
t = input()
pos = s.count('+') - s.count('-')
pos2 = t.count('+') - t.count('-')
d = pos - pos2
x = t.count('?')
if abs(d) > x:
	print(0)
elif (x - d) % 2 != 0:
	print(0)
else:
	print(fac(x) / (fac((x - d) // 2) * fac((x + d) // 2) * pow(2, x)))


(k, t) = (input().count('+'), input())
(k, n) = (k - t.count('+'), t.count('?'))
if k < 0 or k > n:
	print(0)
else:
	p = q = 1
	for i in range(n, n - k, -1):
		p *= i
	for i in range(k, 1, -1):
		q *= i
	print(p / (q << n))


def fac(a):
	p = 1
	for i in range(1, a + 1):
		p *= i
	return p
s1 = input()
s2 = input()
ques = s2.count('?')
tp = 2 ** ques
cs1 = 0
cs2 = 0
for i in s1:
	if i == '+':
		cs1 += 1
	else:
		cs1 -= 1
for j in s2:
	if j == '+':
		cs2 += 1
	elif j == '-':
		cs2 -= 1
if ques == 0:
	if cs1 == cs2:
		print(1)
	else:
		print(0)
else:
	diff = cs1 - cs2
	di = abs(diff)
	if di <= ques:
		if (ques - abs(diff)) % 2 == 0:
			p = fac(ques) // (fac((ques - di) // 2) * fac((ques + di) // 2))
			print(p / tp)
		else:
			print(0)
	else:
		print(0.0)


def main():
	commands = list(input())
	wifi = list(input())
	possibilities = []

	def count(i, cnt, s):
		if len(s) == cnt:
			possibilities.append(i)
			return
		if s[cnt] == '+':
			count(i + 1, cnt + 1, s)
		elif s[cnt] == '-':
			count(i - 1, cnt + 1, s)
		else:
			count(i + 1, cnt + 1, s)
			count(i - 1, cnt + 1, s)
	endpoint = sum((1 if i == '+' else -1 for i in commands))
	count(0, 0, wifi)
	(total, chances) = (len(possibilities), sum((endpoint == i for i in possibilities)))
	print(chances / total)
main()


s1 = input()
s2 = input()
ans1 = 0
for i in range(len(s1)):
	if s1[i] == '+':
		ans1 += 1
	else:
		ans1 -= 1
q = 0
for i in range(len(s2)):
	if s2[i] == '+':
		ans1 -= 1
	elif s2[i] == '-':
		ans1 += 1
	else:
		q += 1
if q == 0:
	if ans1 == 0:
		print('{:.9f}'.format(1))
	else:
		print('{:.9f}'.format(0))
else:
	dp = [0] * (q + 1)
	dp[0] = 1
	i = 1
	while i < q + 1:
		dp[i] = dp[i - 1] * i
		i += 1
	if abs(ans1) > q:
		print('{:.9f}'.format(0))
	elif (q - ans1) % 2 != 0:
		print('{:.9f}'.format(0))
	elif (q + ans1) % 2 != 0:
		print('{:.9f}'.format(0))
	else:
		a = (q - ans1) // 2
		b = (q + ans1) // 2
		ans = float('{:.9f}'.format(dp[q] / (dp[a] * dp[b])))
		ans = float('{:.9f}'.format(ans / pow(2, q)))
		print('{:.9f}'.format(ans))


from math import factorial as fc

def per(a, b):
	return fc(a + b) / (fc(a) * fc(b))
import sys
s = input()
s1 = input()
x = s.count('+')
y = s.count('-')
x1 = s1.count('+')
y1 = s1.count('-')
p = x - y
p1 = x1 - y1
q = s1.count('?')
dif = p - p1
if q < abs(p1 - p) or dif > q:
	print(0.0)
	sys.exit()
m = abs(y - y1)
pl = abs(x - x1)
print(per(m, pl) / 2 ** (m + pl))


import math

def facts(n):
	ans = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	ans = sorted(ans)
	return ans

def nchar(s):
	pos = ord(s) - ord('a')
	if pos == 25:
		return 'a'
	else:
		return chr(ord('a') + pos + 1)
s1 = str(input())
s2 = str(input())
(p1, m1) = (s1.count('+'), s1.count('-'))
(p2, m2, un) = (s2.count('+'), s2.count('-'), s2.count('?'))
(good, bad) = (0, 0)
if un == 0:
	if p1 == p2 and m2 == m1:
		print(1)
	else:
		print(0)
else:
	for mask in range(2 << un):
		(tm, tp) = (0, 0)
		for x in range(un):
			if mask >> x & 1:
				tp += 1
			else:
				tm += 1
		if p2 + tp == p1 and m2 + tm == m1:
			good += 1
		else:
			bad += 1
	print(good / (good + bad))


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	first = list(input())
	second = list(input())
	c = 0
	for i in first:
		if i == '+':
			c += 1
		else:
			c -= 1
	c1 = 0
	for i in second:
		if i == '+':
			c1 += 1
		elif i == '-':
			c1 -= 1
	diff = c - c1
	ques = second.count('?')
	if abs(diff) > ques:
		print(0)
	else:
		diff = abs(diff)
		if ques == 0:
			if diff == 0:
				print(1)
			else:
				print(0)
			continue
		val = [1, -1]
		arr = [1, -1]
		while len(arr) < 2 ** ques:
			a = arr.pop(0)
			arr.append(a + 1)
			arr.append(a - 1)
		print(arr.count(diff) / len(arr))


def bit(mask, id):
	if mask >> id & 1 == 1:
		return True
	else:
		return False
ans = 0
s = input()
t = input()
size = len(s)
pos = p = a = 0
for i in range(0, size):
	if s[i] == '+':
		pos += 1
	elif s[i] == '-':
		pos -= 1
	if t[i] == '+':
		p += 1
	elif t[i] == '-':
		p -= 1
	else:
		a += 1
k = 1 << a
if p == pos and a == 0:
	print(1)
else:
	for i in range(0, k):
		p1 = p
		for j in range(0, a):
			if bit(i, j) == True:
				p1 += 1
			elif bit(i, j) == False:
				p1 -= 1
		if p1 == pos:
			ans += 1
	print(ans / k)


a = list()

def p(t, n):
	if n == 0:
		a.append(t)
		return
	p(t + '+', n - 1)
	p(t + '-', n - 1)
s1 = input()
s2 = input()
o = s1.count('+') - s1.count('-')
z = s2.count('+') - s2.count('-')
k = s2.count('?')
p('', k)
ans = 0
for i in a:
	y = i.count('+') - i.count('-')
	if z + y == o:
		ans += 1
print(ans / len(a) if len(a) else 1)


real = 0
for i in input():
	real += 1 if i == '+' else -1
ans = [1] + [0] * 20
possible = [0]
for i in input():
	if i == '+' or i == '-':
		newlist = [0] * 21
		for j in range(len(possible)):
			possible[j] += 1 if i == '+' else -1
			newlist[possible[j]] = ans[possible[j] + (1 if i == '-' else -1)]
		ans = newlist
		continue
	newlist = [0] * 21
	for j in possible:
		newlist[j - 1] += ans[j] * 0.5
		newlist[j + 1] += ans[j] * 0.5
	ans = newlist
	newposs = []
	for j in possible:
		if not j + 1 in newposs:
			newposs.append(j + 1)
		if not j - 1 in newposs:
			newposs.append(j - 1)
	possible = newposs
print(ans[real])


a = input()
b = input()
c = ''
d = ''
e = 0
ans = 0
if b.count('?') == 0:
	if b.count('+') - b.count('-') == a.count('+') - a.count('-'):
		print(1)
	else:
		print(0)
else:
	for i in range(2 ** b.count('?')):
		c = ''
		d = bin(i)[2:]
		e = 0
		if len(d) < b.count('?'):
			d = '0' * (b.count('?') - len(d)) + d
		for j in range(len(b)):
			if b[j] != '?':
				c += b[j]
			else:
				if d[e] == '0':
					c += '-'
				else:
					c += '+'
				e += 1
		if c.count('+') - c.count('-') == a.count('+') - a.count('-'):
			ans += 1
	print(ans / 2 ** b.count('?'))


sent = input()
rec = input()
realpos = 0
for x in sent:
	if x == '+':
		realpos += 1
	else:
		realpos -= 1
possible = []

def doit(pos, cur):
	if pos == len(rec):
		possible.append(cur)
		return
	x = rec[pos]
	if x == '+':
		doit(pos + 1, cur + 1)
	elif x == '-':
		doit(pos + 1, cur - 1)
	else:
		doit(pos + 1, cur + 1)
		doit(pos + 1, cur - 1)
doit(0, 0)
cnt = 0
for elem in possible:
	if elem == realpos:
		cnt += 1
print(cnt / len(possible))


s = input()
t = input()
t1 = 0
c = 0
for i in range(len(s)):
	if s[i] == '+':
		c += 1
for i in range(len(t)):
	if t[i] == '+':
		c -= 1
	elif t[i] == '?':
		t1 += 1
f = 1
if t1 == 0 and c != 0:
	print(float(0))
elif c < 0:
	print(float(0))
elif c > t1:
	print(float(0))
elif c == 0 and t == 0:
	print(float(1))
else:
	for i in range(min(t1 - c, c)):
		f = f * (t1 - i) / (i + 1)
	print(f / 2 ** t1)


import math

def main():
	x = input()
	y = input()
	goal = x.count('+') - y.count('+')
	options = y.count('?')
	if options == 0:
		if goal == options:
			print(1)
		else:
			print(0)
	elif goal > options:
		print(0)
	elif goal < 0:
		print(0)
	else:
		print(math.factorial(options) / math.factorial(goal) / math.factorial(options - goal) / 2 ** options)
main()


s1 = input()
s2 = input()
pls1 = 0
pls2 = 0
unk = 0
for i in range(len(s1)):
	if s1[i] == '+':
		pls1 += 1
	if s1[i] == '-':
		pls1 -= 1
	if s2[i] == '+':
		pls2 += 1
	if s2[i] == '-':
		pls2 -= 1
	if s2[i] == '?':
		unk += 1
binary = '1' * unk
good = 0
all_el = 0
import sys
if unk == 0:
	if pls1 == pls2:
		print(1)
		sys.exit(0)
	else:
		print(0)
		sys.exit(0)
for i in range(int(binary, 2) + 1):
	all_el += 1
	current = bin(i)
	current = current[2:]
	if len(current) != unk:
		current = current[::-1]
		for i in range(unk - len(current)):
			current += '0'
		current = current[::-1]
	current_sum = 0
	for i in range(len(current)):
		if current[i] == '1':
			current_sum += 1
		else:
			current_sum -= 1
	if current_sum + pls2 == pls1:
		good += 1
print(good / all_el)


def gen(a):
	global correct
	global all
	if len(a) == len(s_raw):
		now_sum = 0
		for el in a:
			if el == '+':
				now_sum += 1
			else:
				now_sum -= 1
		all += 1
		if now_sum == cor_sum:
			correct += 1
		return
	if s_raw[len(a)] == '?':
		gen(a + '+')
		gen(a + '-')
	else:
		gen(a + s_raw[len(a)])
s = input()
s_raw = input()
cor_sum = 0
correct = 0
all = 0
for el in s:
	if el == '+':
		cor_sum += 1
	else:
		cor_sum -= 1
gen('')
print(correct / all)


def calValue(s):
	if s in strings:
		return strings[s]
	else:
		count = 0
		for i in range(len(s)):
			if s[i] == '+':
				count += 1
			elif s[i] == '-':
				count -= 1
		strings[s] = count
		return count

def getProbability(s):
	half = 0.5
	if '?' in s:
		s1 = s.replace('?', '+', 1)
		probability1 = getProbability(s1)
		s2 = s.replace('?', '-', 1)
		probability2 = getProbability(s2)
		return half * (probability1 + probability2)
	else:
		val = calValue(s)
		if val == val1:
			return 1
		else:
			return 0
string1 = input()
string2 = input()
strings = {}
val1 = calValue(string1)
print('{0:.12f}'.format(getProbability(string2)))


def Bin(x):
	s = ''
	while x > 0:
		k = x % 2
		x //= 2
		if k == 0:
			s += '-'
		else:
			s += '+'
	return s

def F(s):
	x = 0
	for i in range(len(s)):
		if s[i] == '+':
			x += 1
		else:
			x -= 1
	return x
s1 = str(input())
s2 = str(input())
h = []
x = 0
k = 0
z = 0
x = F(s1)
for i in range(len(s2)):
	if s2[i] == '?':
		h += [i]
		k += 1
if k == 0:
	if F(s1) == F(s2):
		print('1.000000000')
	else:
		print('0.000000000')
else:
	for i in range(2 ** k, 2 ** (k + 1)):
		s = Bin(i)
		l = s2
		for i in range(len(s) - 1):
			l = l[:h[i]] + s[i] + l[h[i] + 1:]
			o = F(l)
		if o == x:
			z += 1
	print(z / 2 ** k)


from math import factorial
s1 = input()
s2 = input()
r1 = 0
r2 = 0
n = 0
for i in s1:
	if i == '+':
		r1 += 1
	else:
		r1 -= 1
for i in s2:
	if i == '+':
		r2 += 1
	elif i == '-':
		r2 -= 1
	else:
		n += 1
if n == 0:
	if r1 == r2:
		print(1)
	else:
		print(0)
elif abs(r1 - r2) > n:
	print(0)
else:
	pluses = (abs(r1 - r2) + n) / 2
	if int(pluses) != pluses:
		print(0)
	else:
		print(factorial(n) / factorial(pluses) / factorial(n - pluses) / 2 ** n)


import math
import bisect

def fact(n):
	if n == 0:
		return 1
	return n * fact(n - 1)

def main():
	s1 = input()
	s2 = input()
	(x1, x2) = (0, 0)
	(y1, y2) = (0, 0)
	z = 0
	for i in range(len(s1)):
		if s1[i] == '+':
			x1 += 1
		elif s1[i] == '-':
			x2 += 1
		if s2[i] == '+':
			y1 += 1
		elif s2[i] == '-':
			y2 += 1
		elif s2[i] == '?':
			z += 1
	d1 = x1 - y1
	d2 = x2 - y2
	if x1 < y1 or x2 < y2:
		print(0.0)
	elif d1 == 0 and d2 == 0:
		print(1.0)
	elif d1 == 0 or d2 == 0:
		print(1 / pow(2, z))
	else:
		t = fact(z) / (fact(d1) * fact(d2))
		print(t / pow(2, z))
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from collections import deque
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().split(' ')))

def solve():
	s = input()
	t = input()
	s_sum = t_sum = count_q = 0
	for i in s:
		s_sum += [1, -1][i == '-']
	for i in t:
		if i == '?':
			count_q += 1
		else:
			t_sum += [1, -1][i == '-']
	if not count_q:
		if s_sum == t_sum:
			print('1.00')
			return
		else:
			print('0.0000')
			return
	correct = 0
	for i in range(2 ** count_q):
		bits = bin(i)[2:].zfill(count_q)
		if s_sum == t_sum + bits.count('1') - bits.count('0'):
			correct += 1
	print(round(correct / 2 ** count_q, 9))
solve()


import math
s1 = input().strip()
s2 = input().strip()
ps1 = 0
ms1 = 0
ps2 = 0
ms2 = 0
qs2 = 0
for i in s1:
	if i == '+':
		ps1 += 1
	if i == '-':
		ms1 += 1
for i in s2:
	if i == '+':
		ps2 += 1
	if i == '-':
		ms2 += 1
	if i == '?':
		qs2 += 1
if ps2 <= ps1 and ms2 <= ms1:
	print(math.factorial(qs2) / math.factorial(ps1 - ps2) / math.factorial(ms1 - ms2) * 0.5 ** qs2)
else:
	print(0.0)


from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log, log2
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def def_value():
	return 0

def def_inf():
	return inf

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans
s = inp()
t = inp()
x0 = s.count('+')
x1 = s.count('-')
y0 = t.count('+')
y1 = t.count('-')
if y0 > x0 or y1 > x1:
	print(0)
else:
	k0 = x0 - y0
	k1 = x1 - y1
	ans = fact(k0 + k1) / (fact(k0) * fact(k1))
	ans /= 2 ** (k0 + k1)
	print(ans)


s1 = input()
s2 = input()
dest = s1.count('+') - s1.count('-')
center = s2.count('+') - s2.count('-')
distr = [0.0] * 10 + [1.0] + [0.0] * 10
for i in range(s2.count('?')):
	nextdistr = [0.0] * 21
	for j in range(1, 20):
		nextdistr[j - 1] += 0.5 * distr[j]
		nextdistr[j + 1] += 0.5 * distr[j]
	distr = nextdistr
print(distr[10 + dest - center])


def comb(n, k):
	(s, m) = (1, 1)
	for i in range(k):
		s *= n - i
		m *= i + 1
	return s // m
s1 = list(input())
s2 = list(input())
(p1, p2, m1, m2, u) = (0, 0, 0, 0, 0)
for i in range(len(s1)):
	if s1[i] == '+':
		p1 += 1
	if s1[i] == '-':
		m1 += 1
	if s2[i] == '+':
		p2 += 1
	if s2[i] == '-':
		m2 += 1
	if s2[i] == '?':
		u += 1
if u == 0:
	if p1 == p2 and m1 == m2:
		print('{:.12f}'.format(1))
	else:
		print('{:.12f}'.format(0))
elif p1 >= p2 and m1 >= m2:
	p = p1 - p2
	m = m1 - m2
	d = p + m
	s = comb(d, p) / 2 ** d
	c = '{:.12f}'.format(s)
	print(c)
else:
	print('{:.12f}'.format(0))


from math import factorial, pow

def wifi(s1, s2):
	(count1, count2, count3) = (0, 0, 0)
	for i in range(len(s1)):
		if s1[i] == '+':
			count1 += 1
		elif s1[i] == '-':
			count2 += 1
		if s2[i] == '+':
			count1 -= 1
		elif s2[i] == '-':
			count2 -= 1
		else:
			count3 += 1
	if count1 < 0 or count2 < 0:
		return '{:.9f}'.format(0)
	q = factorial(count1 + count2) / (factorial(count1) * factorial(count2))
	r = q / pow(2, count3)
	return r
t1 = input()
t2 = input()
print(wifi(t1, t2))


from collections import Counter

def solve():
	(s1, s2) = (input(), input())
	if '?' in s2:
		(c1, c2) = (dict(Counter(s1)), dict(Counter(s2)))
		for (symbol, count) in c2.items():
			if symbol in c1:
				c1[symbol] -= count
		final_pos = c1.get('+', 0) - c1.get('-', 0)
		q_n = c2['?']
		outcomes = [2 * bin(bitmask).count('1') - q_n == final_pos for bitmask in range(2 ** q_n)]
		print(outcomes.count(True) / len(outcomes))
	else:
		print(int(sorted(s1) == sorted(s2)))
solve()


actual = input()
processed = input()

def factorial(num: int):
	res = 1
	while num >= 1:
		res *= num
		num -= 1
	return res
actualPos = actual.count('+')
actualNeg = actual.count('-')
processedPos = processed.count('+')
processedNeg = processed.count('-')
if processedPos > actualPos or processedNeg > actualNeg:
	print(0)
elif processedPos == actualPos and processedNeg == actualNeg:
	print(1)
else:
	remainPos = actualPos - processedPos
	remainNeg = actualNeg - processedNeg
	print(factorial(remainPos + remainNeg) / (factorial(remainPos) * factorial(remainNeg)) / 2 ** (remainPos + remainNeg))


def fact(n):
	if n == 0:
		return 1
	return n * fact(n - 1)

def total_possibilities(n):
	return fact(n)

def correct_permutations(n, a, b):
	total = total_possibilities(n)
	xd1 = fact(a)
	xd2 = fact(b)
	return total_possibilities(n) / (fact(a) * fact(b))
correct = input()
received = input()
plus = {'correct': correct.count('+'), 'received': received.count('+')}
minus = {'correct': correct.count('-'), 'received': received.count('-')}
if plus['correct'] == plus['received'] and minus['correct'] == minus['received']:
	chance = 1
elif plus['received'] > plus['correct'] or minus['received'] > minus['correct']:
	chance = 0
else:
	needed_pluses = plus['correct'] - plus['received']
	needed_minuses = minus['correct'] - minus['received']
	questions = received.count('?')
	chance = correct_permutations(questions, needed_pluses, needed_minuses) / 2 ** questions
print('%.12f' % chance)


s1 = input()
s2 = input().replace('?', '')

def value(string):
	s = 0
	for char in string:
		if char == '+':
			s += 1
		else:
			s -= 1
	return s
k = len(s1) - len(s2)
n = value(s1) - value(s2) + k
if k == 0:
	if value(s1) == value(s2):
		print(1)
	else:
		print(0)
elif n < 0 or n > 2 * k or n % 2 == 1:
	print(0)
else:
	p = int(n / 2)

	def f(n):
		c = 1
		for i in range(2, n + 1):
			c *= i
		return c
	print(f(k) / (2 ** k * f(p) * f(k - p)))


from itertools import product
prob = 0
s = input()
s2 = input()
n = s2.count('?')
d = 0
d1 = 0
for i in s:
	if i == '-':
		d -= 1
	else:
		d += 1
for i in s2:
	if i == '-':
		d1 -= 1
	if i == '+':
		d1 += 1
for comb in product([-1, 1], repeat=n):
	if sum(list(comb)) == d - d1:
		prob += 1
print(prob / pow(2, n))


s1 = str(input())
s2 = str(input())

def fact(n):
	factorial = 1
	for i in range(1, n + 1):
		factorial = factorial * i
	return factorial
unknown = s2.count('?')
permutation = fact(unknown)
plusOnS1 = s1.count('+')
minusOnS1 = s1.count('-')
plusOnS2 = s2.count('+')
minusOnS2 = s2.count('-')
if plusOnS2 > plusOnS1 or minusOnS2 > minusOnS1:
	print(0)
elif unknown == 0:
	if plusOnS2 == plusOnS1 and minusOnS2 == minusOnS1:
		print(1)
	else:
		print(0)
else:
	neededPlus = plusOnS1 - plusOnS2
	neededMinus = minusOnS1 - minusOnS2
	if neededPlus == 0 or neededMinus == 0:
		var = 1
	else:
		numerator = fact(neededPlus) * fact(neededMinus)
		var = permutation // numerator
	print(var / pow(2, unknown))


real = sorted(input())
got = sorted(input())
result = 0
for i in real:
	if i == '+':
		result += 1
	else:
		result -= 1
qmarks = 0
gotres = 0
for i in got:
	if i == '+':
		gotres += 1
	elif i == '-':
		gotres -= 1
	elif i == '?':
		qmarks += 1
from itertools import product
vars = list(product(['+', '-'], repeat=qmarks))
correct = 0
prob = 0
if len(vars[0]) > 0:
	for i in vars:
		tmp = gotres
		for j in i:
			if j == '+':
				tmp += 1
			else:
				tmp -= 1
		if result == tmp:
			correct += 1
	prob = correct / len(vars)
else:
	prob = 0.0 if gotres != result else 1.0
print(prob)


__author__ = 'hamed1soleimani'
correct = input()
received = input()
final = 0
for ch in correct:
	if ch == '+':
		final += 1
	else:
		final -= 1
directions = [0]
for ch in received:
	if ch == '+':
		for i in range(len(directions)):
			directions[i] += 1
	elif ch == '-':
		for i in range(len(directions)):
			directions[i] -= 1
	else:
		temp = list()
		for d in directions:
			temp.append(d + 1)
			temp.append(d - 1)
		directions = temp
finished = 0
for d in directions:
	if d == final:
		finished += 1
out = str(finished / len(directions))
out += '0' * (14 - len(out))
print(out)


from collections import defaultdict
from sys import stdin, stdout
import math
s = input()
t = input()
val = 0
for i in s:
	if i == '+':
		val += 1
	else:
		val -= 1
tocheck = 0
count = 0
for i in t:
	if i == '+':
		tocheck += 1
	elif i == '-':
		tocheck -= 1
	else:
		count += 1

def fact(x):
	ans = 1
	for i in range(1, x + 1):
		ans *= i
	return ans

def ncr(x, y):
	if y > x:
		return 0
	else:
		return fact(x) / (fact(y) * fact(x - y))
diff = abs(val - tocheck)
val1 = (diff + count) // 2
val2 = count - val1
if val1 == 0:
	print('1.0')
else:
	print(ncr(count, val1) / 2 ** count)


import math
s = input()
p = input()
c = 1
ss = 0
ps = 0
k = 0
for i in range(len(s)):
	if p[i] == '?':
		c *= 2
		k += 1
	if s[i] == '+':
		ss += 1
	else:
		ss -= 1
	if p[i] == '+':
		ps += 1
	elif p[i] == '-':
		ps -= 1
y = math.fabs(ss - ps)
x = k - y
a = y + x / 2
b = k - a
if k < y:
	ans = 0.0
else:
	ans = math.factorial(a + b) / (math.factorial(a) * math.factorial(b))
	ans /= c
print('%.12f' % ans)


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
dict1 = {'+': 0, '-': 0, '?': 0}
for i in input():
	dict1[i] += 1
for i in input():
	if i == '?':
		dict1[i] += 1
	else:
		dict1[i] -= 1
if dict1['+'] < 0 or dict1['-'] < 0:
	print(0.0)
elif dict1['+'] == 0 and dict1['-'] == 0:
	print(1.0)
elif dict1['+'] and dict1['-']:
	ans = nCr(dict1['?'], dict1['+']) / 2 ** dict1['?']
	print('%.12f' % ans)
else:
	ans = 1 / 2 ** dict1['?']
	print('%.12f' % ans)


a = input()
b = input()
p = len(a)
s = 0
for i in range(p):
	if a[i] == '+':
		s += 1
	else:
		s -= 1
c = 0
for i in range(p):
	if b[i] == '+':
		s -= 1
	elif b[i] == '-':
		s += 1
	else:
		c += 1
z = []
v = c * -1
for i in range(c + 1):
	z.append(v)
	v += 2
if c == 0 and s == 0:
	print(1)
elif c == 0 and s != 0:
	print(0)
elif c != 0 and s not in z:
	print(0)
else:
	import math
	f = z.index(s)
	num = math.factorial(c) / (math.factorial(f) * math.factorial(c - f))
	den = 2 ** c
	print(num / den)


s1 = input()
s2 = input()
d1 = {'+': 0, '-': 0}
for i in range(len(s1)):
	d1[s1[i]] = d1[s1[i]] + 1
d2 = {'+': 0, '-': 0, '?': 0}
for i in range(len(s2)):
	d2[s2[i]] = d2[s2[i]] + 1
q1_count = d2['?']
q2_count = d1['-'] - d2['-']
q3_count = d1['+'] - d2['+']
if q2_count < 0:
	print(0)
	exit()
if q3_count < 0:
	print(0)
	exit()
if q1_count == 0:
	print(1)
	exit()
f1 = 1
for j in range(1, q1_count + 1):
	f1 = f1 * j
f2 = 1
for j in range(1, q2_count + 1):
	f2 = f2 * j
f3 = 1
for j in range(1, q1_count - q2_count + 1):
	f3 = f3 * j
print(f1 // (f2 * f3) / pow(2, q1_count))


s1 = input()
n = len(s1)
s2 = input()
m = len(s2)
if '?' not in s1 and '?' not in s2:
	sm1 = 0
	sm2 = 0
	for i in s1:
		if i == '+':
			sm1 += 1
		else:
			sm1 -= 1
	for i in s2:
		if i == '+':
			sm2 += 1
		else:
			sm2 -= 1
	print(1 if sm1 == sm2 else 0)
	exit()
sm1 = 0
for i in s1:
	if i == '+':
		sm1 += 1
	else:
		sm1 -= 1
make2 = [s2]
ans = []
while any(('?' in i for i in make2)):
	n = set()
	for i in make2:
		if '?' not in i:
			ans.append(i)
		for j in range(len(i)):
			if i[j] == '?':
				n.add(i[0:j] + '-' + i[j + 1:])
				n.add(i[0:j] + '+' + i[j + 1:])
	make2 = list(n)
make2 = [i for i in make2 if '?' not in make2]

def sum_now(s):
	sum = 0
	for i in s:
		if i == '+':
			sum += 1
		else:
			sum -= 1
	return sum
make2 = [sum_now(i) for i in make2]
print(sum((i == sm1 for i in make2)) / len(make2))


import itertools as it
(a, b) = (input(), input())
(ap, am) = (a.count('+'), a.count('-'))
(bp, bm, bq) = (b.count('+'), b.count('-'), b.count('?'))
m = am - bm
p = ap - bp
if am == bm and ap == bp:
	print(1.0)
elif bq < m + p or m < 0 or p < 0:
	print(0.0)
else:
	s = '-' * m + '+' * p
	l = len(set(it.permutations(s, bq)))
	print(l / 2 ** bq)


def find(target, doubts):
	if target % 2 != doubts % 2:
		return -1
	return int((doubts - target) / 2 + target)

def prob(p, total):
	if abs(p) > total:
		return 0
	x = 2 ** total
	k = 1
	m = 1
	for i in range(p):
		k = k * (total - i)
		m = m * (i + 1)
	r = int(k / m)
	return r / x
s1 = input()
s1c = 0
for i in s1:
	if i == '+':
		s1c += 1
	else:
		s1c -= 1
s2 = input()
s2c = 0
doubts = 0
for j in s2:
	if j == '+':
		s2c += 1
	elif j == '?':
		doubts += 1
	else:
		s2c -= 1
diff = s1c - s2c
lk = find(diff, doubts)
if lk != -1:
	print(prob(lk, doubts))
else:
	print(0)


fact = [0 for i in range(15)]
fact[0] = fact[1] = 1
for i in range(2, 15):
	fact[i] = fact[i - 1] * i
s1 = input()
s2 = input()
p = 0
m = 0
for i in s1:
	if i == '+':
		p += 1
m = len(s1) - p
p1 = 0
m1 = 0
q = 0
for i in s2:
	if i == '+':
		p1 += 1
	if i == '?':
		q += 1
m1 = len(s2) - p1 - q
p_req = p - p1
m_req = m - m1
if p_req < 0 or m_req < 0 or q != m_req + p_req:
	print('0.000000000000')
else:
	a = fact[q] / (fact[q - p_req] * fact[p_req])
	a = a / 2 ** q
	print(a * 1.0)


ins = input()
seq = input()
target_success = ins.count('+')
part_success = seq.count('+')
n = seq.count('?')
import math

def C(n, x):
	return math.factorial(n) / (math.factorial(n - x) * math.factorial(x))

def f(n, x):
	return C(n, x) * 0.5 ** x * (1 - 0.5) ** (n - x)
if abs(target_success - part_success) > n:
	p = 0.0
	print('{:.10f}'.format(p))
else:
	try:
		p = f(n, target_success - part_success)
		print('{:.10f}'.format(p))
	except:
		p = 0.0
		print('{:.10f}'.format(p))


def count_ways(num_unknown, difference):
	if num_unknown is 0:
		if difference is 0:
			return 1
		return 0
	c1 = count_ways(num_unknown - 1, difference + 1)
	c2 = count_ways(num_unknown - 1, difference - 1)
	return c1 + c2

def solution(s1, s2):
	s1_count = [1 if x == '+' else 0 for x in s1]
	num_pos1 = sum(s1_count)
	num_neg1 = len(s1) - num_pos1
	final_pos1 = num_pos1 - num_neg1
	s2_count = [1 if x == '+' else 0 for x in s2]
	num_pos2 = sum(s2_count)
	s2_count = [1 if x == '-' else 0 for x in s2]
	num_neg2 = sum(s2_count)
	final_pos2 = num_pos2 - num_neg2
	difference = final_pos1 - final_pos2
	num_unknown = len(s2) - num_pos2 - num_neg2
	num_ways = count_ways(num_unknown, difference)
	total_possibilites = 2 ** num_unknown
	prob = num_ways / total_possibilites
	return prob
s1 = list(input())
s2 = list(input())
print(solution(s1, s2))


def fact(n):
	if n <= 1:
		return 1
	else:
		return n * fact(n - 1)
s1 = input()
s2 = input()
p = 0
n = 0
for i in s1:
	if i == '+':
		p += 1
	else:
		n += 1
res1 = p - n
p = 0
n = 0
c = 0
for i in s2:
	if i == '+':
		p += 1
	elif i == '-':
		n += 1
	else:
		c += 1
res2 = p - n
dif = abs(res1 - res2)
if len(s1) == 1:
	if s1 == s2:
		print(1)
	elif s2 == '?':
		print(0.5)
	else:
		print(0.0)
elif dif > c:
	print(0.0)
elif dif > c:
	print(0.0)
elif dif == 0 and c == 0:
	print(1.0)
elif dif % 2 == 0 and c % 2 == 1 or (dif % 2 == 1 and c % 2 == 0):
	print(0.0)
else:
	r = fact(c)
	f = 2 ** c
	c = c - dif
	val = c // 2
	ans = r / (fact(val + dif) * fact(val))
	print(ans / f)


def combinatrics(n, r):
	if r == 1:
		return n
	if r == 0:
		return 1
	if r == n:
		return 1
	if r == n - 1:
		return n
	return combinatrics(n - 1, r - 1) + combinatrics(n - 1, r)
s1 = list(input())
s2 = list(input())
p1 = m1 = p2 = m2 = q = 0
for i in s1:
	if i == '+':
		p1 += 1
m1 = len(s1) - p1
for i in s2:
	if i == '+':
		p2 += 1
	elif i == '?':
		q += 1
	else:
		m2 += 1
if p2 > p1 or m2 > m1:
	print('%.12f' % 0)
else:
	n = combinatrics(q, p1 - p2)
	d = 1 << q
	print('%.12f' % (n / d))


a = input()
b = input()
c1 = 0
for i in a:
	if i == '+':
		c1 += 1
q = 0
for i in b:
	if i == '?':
		q += 1
	if i == '+':
		c1 -= 1
f = [0] * 20
f[0] = 1
f[1] = 1
for i in range(2, 20):
	f[i] = i * f[i - 1]
ncr = f[q] // (f[q - c1] * f[c1])
print('%.12f' % (ncr / (1 << q)))


real = list(input().strip())
messed = list(input().strip())
cntQ = messed.count('?')
(cntr, cntm) = (real.count('+') - real.count('-'), messed.count('+') - messed.count('-') + cntQ)
if cntQ == 0:
	if cntr == cntm:
		print('%.9f' % 1.0)
	else:
		print('%.9f' % 0.0)
else:
	(ansA, ansB) = (0, 0)
	for i in range(2 ** cntQ):
		a = []
		for ind in range(cntQ):
			a += ['-' if i & 1 << ind else '+']
		a += ['+'] * messed.count('+') + ['-'] * messed.count('-')
		cntA = a.count('+') - a.count('-')
		if cntA == cntr:
			ansA += 1
	print('%.9f' % (ansA / 2 ** cntQ))


from collections import Counter
from itertools import permutations
d = input()
m = input()
c = d.count('+') - d.count('-')
s = m.count('+') - m.count('-')
j = m.count('?')
(pre, t) = ('', set())
for i in range(1, j + 1):
	a = i * '+' + (j - i) * '-'
	b = a.count('+') - a.count('-')
	if b == c - s:
		pre = a
		break
for i in range(1, j + 1):
	a = i * '-' + (j - i) * '+'
	b = a.count('+') - a.count('-')
	if b == c - s:
		pre = a
		break
for i in permutations(pre):
	t.add(i)
if pre != '':
	print(len(t) / 2 ** j)
elif j == 0 and s == c:
	print(1)
else:
	print(0)


s1 = input()
s2 = input()
sum1 = 0
sum2 = 0
x = 0
for i in s1:
	if i == '+':
		sum1 += 1
	elif i == '-':
		sum1 -= 1
for i in s2:
	if i == '+':
		sum2 += 1
	if i == '-':
		sum2 -= 1
	if i == '?':
		x += 1
if x == 0:
	if sum1 == sum2:
		print(1.0)
	else:
		print(0.0)
else:
	TOT = 1 << x
	prb = 0
	for i in range(TOT):
		s2 = 0
		for j in range(x):
			f = 1 << j
			if f & i != 0:
				s2 += 1
			else:
				s2 -= 1
		if s2 + sum2 == sum1:
			prb += 1
	print(prb / TOT)


def ncr(n, r):
	if r == 0 or n == r:
		return 1
	if n < r:
		return 0
	a = 1
	for i in range(r + 1, n + 1):
		a *= i
	b = 1
	for i in range(1, n - r + 1):
		b *= i
	return a / b
s = input()
d = input()
pos = 0
for i in s:
	if i == '+':
		pos += 1
	else:
		pos -= 1
dpos = 0
ques = 0
for i in d:
	if i == '?':
		ques += 1
	elif i == '+':
		dpos += 1
	else:
		dpos -= 1
if ques == 0:
	if pos == dpos:
		print('{:.12f}'.format(1))
	else:
		print('{:.12f}'.format(0))
else:
	total = 2 ** ques
	diff = abs(pos - dpos)
	num = ncr(ques, (ques + diff) // 2)
	print('{:.12f}'.format(num / total))


def getLine():
	return list(map(int, input().split()))

def val(s, c):
	ssum = 0
	ssum += s.count('+')
	ssum -= s.count('-')
	return ssum

def val2(s, c):
	ssum = 0
	ssum += s.count('1')
	ssum -= s.count('0')
	ssum -= c - len(s)
	return ssum

def main():
	send = input()
	recv = input()
	needed_val = val(send, len(send))
	rval = val(recv, len(recv))
	if '?' not in recv:
		if needed_val == rval:
			print(1)
			return
		else:
			print(0)
			return
	ques = recv.count('?')
	fav = 0
	for i in range(2 ** ques):
		tmp = val2(bin(i)[2:], ques) + rval
		if tmp == needed_val:
			fav += 1
	print(fav / pow(2, ques))
main()


def func(index, result):
	if index == len(b):
		if result == target:
			poss.append(result)
		return
	if b[index] == '+':
		func(index + 1, result + 1)
	elif b[index] == '-':
		func(index + 1, result - 1)
	else:
		func(index + 1, result + 1)
		func(index + 1, result - 1)
a = input()
b = input()
target = 0
result = 0
count = []
poss = []
for i in a:
	if i == '+':
		target += 1
	else:
		target -= 1
total = 2 ** b.count('?')
func(0, 0)
print(len(poss) / total)


def fact(n):
	if n == 0:
		f = 1
	else:
		f = n * fact(n - 1)
	return f

def select(n, a):
	s = fact(n) / (fact(n - a) * fact(a))
	return s
s1 = input()
s2 = input()
p = s1.count('+')
n = s1.count('-')
e = p - n
u = s2.count('?')
p1 = s2.count('+')
n1 = s2.count('-')
e1 = p1 - n1
if u == 0:
	if e == e1:
		print(1 / 1)
	else:
		print(0 / 1)
else:
	d = e - e1
	if d <= u and d >= -u:
		tot = pow(2, u)
		if d % 2 == 0 and u % 2 == 0:
			if d == 0:
				a = u // 2
				t = select(u, a)
				print(t / tot)
			else:
				a1 = abs(d)
				a2 = (u - a1) // 2
				a = a1 + a2
				t = select(u, a)
				print(t / tot)
		elif d % 2 != 0 and u % 2 != 0:
			a1 = abs(d)
			a2 = (u - a1) // 2
			a = a1 + a2
			t = select(u, a)
			print(t / tot)
		else:
			print(0 / 1)
	else:
		print(0 / 1)


from sys import stdin, stdout, setrecursionlimit
import threading

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:
	val = [0]

	def DP(self, pos, s2, final_dir):
		if pos == -1:
			return 0
		if s2[pos] in ['+', '-']:
			for i in range(len(self.val)):
				self.val[i] += [-1, 1][s2[pos] == '+']
		else:
			val1 = self.val.copy()
			val2 = self.val.copy()
			for i in range(len(self.val)):
				val1[i] -= 1
				val2[i] += 1
			self.val = val1 + val2
		self.DP(pos - 1, s2, final_dir)
		return self.val.count(final_dir) / len(self.val)

	def solve(self):
		R = stdin.readline
		W = stdout.write
		s1 = R()
		s2 = R()
		final_dir = 0
		for i in range(len(s1) - 1):
			final_dir += [-1, 1][s1[i] == '+']
		W('%.15lf\n' % self.DP(len(s2) - 2, s2, final_dir))
		return 0

def main():
	s = SOLVE()
	s.solve()
Tail_Recursion_Optimization(10 ** 7, 2 ** 26)
threading.Thread(target=main).start()


s1 = input()
s2 = input()
dp = [[] for i in range(13)]
dp[0].append(0)
a = 0
for i in s1:
	if i == '+':
		a += 1
	elif i == '-':
		a -= 1
for i in range(1, len(s2) + 1):
	if s2[i - 1] == '+':
		for j in dp[i - 1]:
			dp[i].append(1 + j)
	if s2[i - 1] == '-':
		for j in dp[i - 1]:
			dp[i].append(j - 1)
	if s2[i - 1] == '?':
		for j in dp[i - 1]:
			dp[i].append(1 + j)
		for j in dp[i - 1]:
			dp[i].append(j - 1)
k = 0
for i in dp[len(s2)]:
	if i == a:
		k += 1
print('{:.12f}'.format(k / len(dp[len(s2)])))


in_cmd = input().strip()
rec_cmd = input().strip()

def count_chars(input):
	plus_minus_question = []
	num_plus = 0
	num_minus = 0
	num_mark = 0
	for char in input:
		if char == '+':
			num_plus += 1
		elif char == '-':
			num_minus += 1
		elif char == '?':
			num_mark += 1
	plus_minus_question.append(num_plus)
	plus_minus_question.append(num_minus)
	plus_minus_question.append(num_mark)
	return plus_minus_question
from math import factorial

def combination(n, r):
	return factorial(n) // factorial(n - r) // factorial(r)
(in_plus, in_minus, in_mark) = count_chars(in_cmd)
(out_plus, out_mins, out_mark) = count_chars(rec_cmd)
diff_plus = in_plus - out_plus
if out_mark < diff_plus or diff_plus < 0:
	print('%.12f' % 0)
else:
	probability = combination(out_mark, diff_plus)
	print('%.12f' % (probability / 2 ** out_mark))


import math as m
a = input()
b = input()
total_sum = 0
req_pos = 0
unreco = 0
for i in a:
	if i == '+':
		total_sum += 1
		req_pos += 1
	elif i == '-':
		total_sum -= 1
for i in b:
	if i == '+':
		total_sum -= 1
		req_pos -= 1
	elif i == '-':
		total_sum += 1
	else:
		unreco += 1
if total_sum == 0 and unreco == 0:
	print(1.0)
elif abs(total_sum) > unreco or req_pos < 0:
	print(0.0)
else:
	ans = m.factorial(unreco) / (m.factorial(req_pos) * m.factorial(unreco - req_pos) * 2 ** unreco)
	print(ans)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
import sys
sys.setrecursionlimit(10000000)
s1 = si()
s2 = si()
l = []
dst = 0
for i in s1:
	dst = dst + 1 if i == '+' else dst - 1

def recur(ind, sz, val):
	if sz == 0:
		l.append(val)
		return
	elif s2[ind] == '+':
		recur(ind + 1, sz - 1, val + 1)
	elif s2[ind] == '-':
		recur(ind + 1, sz - 1, val - 1)
	else:
		recur(ind + 1, sz - 1, val + 1)
		recur(ind + 1, sz - 1, val - 1)
recur(0, len(s2), 0)
c = 0
for i in l:
	if i == dst:
		c += 1
print('%.12f' % (c / len(l)))


(s, p) = (input(), input())
dir = {'+': [1], '-': [-1], '?': [-1, 1]}
intended = 0
for si in s:
	intended += dir[si][0]
D = {0: 1}
for pi in p:
	nd = {}
	for (pos, prob) in D.items():
		for dr in dir[pi]:
			nd[pos + dr] = nd.get(pos + dr, 0) + prob / len(dir[pi])
	D = nd
print(D.get(intended, 0))


def solve(i, som):
	if i == n_rec:
		if som + soma2 == soma1:
			return 1
		else:
			return 0
	if DP[i][som] != -1:
		return DP[i][som]
	DP[i][som] = solve(i + 1, som + 1) + solve(i + 1, som - 1)
	return DP[i][som]
s1 = input()
s2 = input()
soma1 = 0
soma2 = 0
n_rec = 0
for c in s1:
	if c == '+':
		soma1 += 1
	else:
		soma1 -= 1
for c in s2:
	if c == '+':
		soma2 += 1
	elif c == '-':
		soma2 -= 1
	else:
		n_rec += 1
DP = [[-1] * (n_rec * 2 + 1) for i in range(n_rec)]
ans = solve(0, 0)
if ans == 0:
	if soma1 == soma2:
		print('1.000000000000')
	else:
		print('0.000000000000')
else:
	print('%.12f' % (ans / 2 ** n_rec))


import math
a = input()
b = input()
legitdis = 0
for x in range(0, len(a)):
	if a[x] == '+':
		legitdis = legitdis + 1
	else:
		legitdis = legitdis - 1
nlegdis = 0
numq = 0
for y in range(0, len(a)):
	if b[y] == '+':
		nlegdis = nlegdis + 1
	elif b[y] == '-':
		nlegdis = nlegdis - 1
	else:
		numq = numq + 1
if numq == 0:
	if legitdis == nlegdis:
		print('1')
	else:
		print('0')
else:
	difference = legitdis - nlegdis
	difference = math.fabs(difference)
	nm = (numq - difference) / 2
	if nm < 0:
		print('0')
	elif nm % 1 != 0:
		print('0')
	else:
		print(str(math.factorial(numq) / (math.factorial(nm) * math.factorial(numq - nm) * 2 ** numq)))


class Simulation:

	def __init__(self):
		(self.reached, self.attempts) = (0, 0)

def attempt(simulation, sent, received, desired, index, position):
	if index == len(sent):
		simulation.reached += position == desired
		simulation.attempts += 1
		return
	if received[index] != '-':
		attempt(simulation, sent, received, desired, index + 1, position + 1)
	if received[index] != '+':
		attempt(simulation, sent, received, desired, index + 1, position - 1)

def simulateMovement(sent, received):
	assert len(sent) == len(received)
	sim = Simulation()
	desired = sent.count('+') - sent.count('-')
	attempt(sim, sent, received, desired, 0, 0)
	return sim
(sent, received) = (input(), input())
simulation = simulateMovement(sent, received)
print(simulation.reached / simulation.attempts)


from math import factorial
a = input()
b = input()
(plus, minus, ques) = ('+', '-', '?')
ops1 = {plus: 0, minus: 0}
ops2 = {plus: 0, minus: 0, ques: 0}
for (ai, bi) in zip(a, b):
	ops1[ai] += 1
	ops2[bi] += 1
final_pos = ops1[plus] - ops1[minus]
initial_pos = ops2[plus] - ops2[minus]
diff = final_pos - initial_pos
abs_diff = abs(diff)
if abs_diff > ops2[ques]:
	print(0.0)
elif (ops2[ques] - abs_diff) % 2 != 0:
	print(0.0)
else:
	total = 2 ** ops2[ques]
	one_type = (ops2[ques] - abs_diff) // 2
	other_type = abs_diff + one_type
	numerator = factorial(ops2[ques]) / (factorial(one_type) * factorial(other_type))
	print(numerator / total)


def fac(x):
	if x == 0 or x == 1:
		return 1
	return x * fac(x - 1)
(str1, str2) = (input(), input())
(p1, s1, p2, s2, result) = (str1.count('+'), str1.count('-'), str2.count('+'), str2.count('-'), 0)
if p2 <= p1 and s2 <= s1:
	s = p1 + s1 - p2 - s2
	result = 0.5 ** s * fac(s) / fac(p1 - p2) / fac(s - (p1 - p2))
print('{0:.10f}'.format(result))


def myC(n, k):
	C = [0 for i in range(k + 1)]
	C[0] = 1
	for i in range(1, n + 1):
		j = min(i, k)
		while j > 0:
			C[j] = C[j] + C[j - 1]
			j -= 1
	return C[k]
a = input()
b = input()
count1 = 0
for i in range(len(a)):
	if a[i] == '+':
		count1 += 1
	else:
		count1 -= 1
count2 = 0
count3 = 0
for i in range(len(b)):
	if b[i] == '+':
		count2 += 1
	elif b[i] == '-':
		count2 -= 1
	else:
		count3 += 1
if count1 - count2 >= -1 * count3 and count1 - count2 <= count3:
	if (count3 - abs(count1 - count2)) % 2 == 0:
		check = abs(count1 - count2) + (count3 - abs(count1 - count2)) // 2
		answer = myC(count3, check) / pow(2, count3)
	else:
		answer = 0
else:
	answer = 0
print('{:.12f}'.format(answer))


m_1 = input()
m_2 = input()

def f(x, y):
	if x == '+':
		return y + 1
	if x == '-':
		return y - 1
n = len(m_1)
s = 0
for i in range(n):
	s = f(m_1[i], s)
s_1 = 0
d = [0]
for i in range(n):
	if m_2[i] != '?':
		s_1 = f(m_2[i], s_1)
	else:
		d *= 2
		for j in range(int(len(d) / 2)):
			d[j] += 1
		for k in range(int(len(d) / 2), len(d)):
			d[k] -= 1
haha = abs(s - s_1)
g = 0
if d == [0]:
	if haha == 0:
		print('%.12f' % 1)
	else:
		print('%.12f' % 0)
else:
	for m in range(len(d)):
		if haha == d[m]:
			g += 1
	print('%.12f' % (g / len(d)))


def main():
	str1 = input()
	str2 = input()
	poz_real = 0
	for i in range(len(str1)):
		if str1[i] == '+':
			poz_real += 1
		else:
			poz_real -= 1
	poz = [0]
	lent = 1
	for i in range(len(str2)):
		if str2[i] == '+':
			for j in range(len(poz)):
				poz[j] += 1
		if str2[i] == '-':
			for j in range(len(poz)):
				poz[j] -= 1
		if str2[i] == '?':
			for j in range(len(poz) - int(lent), len(poz)):
				poz.append(poz[j] - 1)
				poz.append(poz[j] + 1)
			lent *= 2
	count_sovp = 0
	was = []
	for i in range(len(poz) - int(lent), len(poz)):
		if poz[i] == poz_real:
			count_sovp += 1
	print(float(count_sovp / lent))
main()


aux = {'+': 1, '-': -1, '?': 0}
str1 = list(input())
str2 = list(input())
(s1, s2) = (0, 0)
n = 0
cnt = 0
for c in str1:
	s1 = s1 + aux[c]
for c in str2:
	if c == '?':
		n += 1
	else:
		s2 = s2 + aux[c]

def rec(i, result):
	global s1, n, cnt
	if i == n:
		if result == s1:
			cnt += 1
		return
	rec(i + 1, result + 1)
	rec(i + 1, result - 1)
rec(0, s2)
print(cnt / 2 ** n)


import math
a = input()
b = input()
c = int(0)
d = int(0)
q = int(0)
for i in range(len(a)):
	if a[i] == '+':
		c += 1
	elif a[i] == '-':
		c -= 1
for i in range(len(b)):
	if b[i] == '+':
		d += 1
	elif b[i] == '-':
		d -= 1
	else:
		q += 1
if c == d:
	print(math.factorial(q) / (math.factorial(q / 2) * math.factorial(q / 2)) / 2 ** q)
else:
	mx = d + q
	mn = d - q
	if c > mx or c < mn:
		print(0.0)
	else:
		ans = c - d
		if ans > 0:
			print(math.factorial(q) / (math.factorial((q - ans) / 2 + ans) * math.factorial((q - ans) / 2)) / 2 ** q)
		else:
			print(math.factorial(q) / (math.factorial((q - ans) / 2) * math.factorial((q - ans) / 2 + ans)) / 2 ** q)


drazil = input()
dor = input()

def path(dr, do, i, pos1, pos2, p):
	if i == len(dr):
		if pos1 == pos2:
			return p
		else:
			return 0.0
	pos1 += 1 if dr[i] == '+' else -1
	if do[i] == '?':
		return path(dr, do, i + 1, pos1, pos2 + 1, p * 0.5) + path(dr, do, i + 1, pos1, pos2 - 1, p * 0.5)
	else:
		pos2 += 1 if do[i] == '+' else -1
		return path(dr, do, i + 1, pos1, pos2, p)
print(path(drazil, dor, 0, 0, 0, 1.0))


s = input()
t = input()
unk = 0
acp = 0
cp = 0
for i in range(0, len(s)):
	if t[i] == '?':
		unk += 1
	elif t[i] == '+':
		acp += 1
	else:
		acp -= 1
	if s[i] == '+':
		cp += 1
	else:
		cp -= 1
ans = 0
if cp - unk > acp or cp + unk < acp:
	print('%0.11f' % 0)
elif unk == 0:
	if cp == acp:
		print('%0.11f' % 1)
	else:
		print('%0.11f' % 0)
else:
	ct = cp - acp
	if (ct + unk) % 2 != 0:
		print('%0.11f' % 0)
	else:
		cnt = (ct + unk) // 2
		ncr = 1
		for i in range(0, cnt):
			ncr *= unk - i
			ncr //= i + 1
		ans = ncr
		ans /= 2 ** unk
		print('%0.11f' % ans)


from math import factorial as f
s1 = input()
s2 = input()
plus1 = s1.count('+')
minu1 = s1.count('-')
plus2 = s2.count('+')
minu2 = s2.count('-')
que2 = s2.count('?')
for i in range(0, que2 + 1):
	if plus1 == plus2 + i and minu1 == minu2 + (que2 - i):
		print(f(que2) / (f(i) * f(que2 - i)) * (1 / 2) ** que2)
		exit(0)
print(0.0)


from itertools import product
s1 = input()
s2 = input()
c1 = c2 = 0
q = 0
for i in range(len(s1)):
	if s1[i] == '+':
		c1 += 1
	else:
		c1 -= 1
	if s2[i] == '+':
		c2 += 1
	elif s2[i] == '-':
		c2 -= 1
	else:
		q += 1
if c1 == c2 and q == 0:
	print(1)
else:
	need = c1 - c2
	count = 0
	for _set in product(list('+-'), repeat=q):
		res = ''.join(_set)
		if res.count('+') - res.count('-') == need:
			count += 1
	print(count / 2 ** q)


from math import factorial
real = input()
fake = input()
x_real = 0
x_fake = 0
n = len(real)
for i in range(n):
	if real[i] == '+':
		x_real += 1
	else:
		x_real -= 1
c = 0
for i in range(n):
	if fake[i] == '+':
		x_fake += 1
	elif fake[i] == '-':
		x_fake -= 1
	else:
		c += 1
if c == 0:
	print(int(x_fake == x_real))
else:
	x = x_real - x_fake
	if x == c:
		print(1 / 2 ** c)
	else:
		a = (x + c) // 2
		if (x + c) % 2 != 0 or c <= a or a < 0 or (c < 0):
			print(0)
		else:
			print(factorial(c) / (factorial(c - a) * factorial(a)) / 2 ** c)


from collections import Counter

def solve():
	(s1, s2) = (input(), input())
	if '?' in s2:
		(c1, c2) = (dict(Counter(s1)), dict(Counter(s2)))
		for (k, v) in c2.items():
			if k in c1:
				c1[k] -= v
		needed = c1.get('+', 0) - c1.get('-', 0)
		q = c2['?']
		possible = [2 * bin(i).count('1') - q == needed for i in range(2 ** q)]
		print(possible.count(True) / len(possible))
	else:
		print(int(sorted(s1) == sorted(s2)))
solve()


trueAns = sum([1 if x == '+' else -1 for x in input()])
s = input()
unknown = len([x for x in s if x == '?'])
ans = 0
for mask in range(1 << unknown):
	j = 0
	result = 0
	for x in s:
		if x == '?':
			if mask & 1 << j:
				result += 1
			else:
				result -= 1
			j += 1
		elif x == '+':
			result += 1
		else:
			result -= 1
	if result == trueAns:
		ans += 1
print(ans / (1 << unknown))


import math
from sys import stdin, stdout
mod = 1000000007
size = int(100)
fact = [0] * size
fact[0] = 1
for i in range(1, size):
	fact[i] = i * fact[i - 1]

def ncr(n, r, fact):
	npr = fact[n] / fact[n - r]
	return npr / fact[r]
s = list(stdin.readline())
s.pop()
r = list(stdin.readline())
r.pop()
flag = False
for i in range(len(s)):
	if r[i] == '?':
		flag = True
		break
if flag == False:
	count1 = 0
	for i in range(len(s)):
		if s[i] == '+':
			count1 += 1
	count2 = 0
	for i in range(len(r)):
		if r[i] == '+':
			count2 += 1
	p = float(0)
	if count1 == count2:
		p = float(1)
	stdout.write(f'{p}\n')
else:
	n = 0
	rr = 0
	for i in range(len(s)):
		if s[i] == '+':
			rr += 1
	for i in range(len(r)):
		if r[i] == '+':
			rr -= 1
		if r[i] == '?':
			n += 1
	if rr < 0 or rr > n:
		p = float(0)
		stdout.write(f'{p}\n')
	else:
		p = ncr(n, rr, fact) / math.pow(2, n)
		stdout.write(f'{p}\n')


import math, sys

def rec(have, i):
	global res, b
	if i == len(b):
		res[have] += 1
		return
	if b[i] == '-':
		rec(have - 1, i + 1)
	elif b[i] == '+':
		rec(have + 1, i + 1)
	else:
		rec(have - 1, i + 1)
		rec(have + 1, i + 1)
a = [x for x in input()]
need = 0
for i in range(len(a)):
	if a[i] == '+':
		need += 1
	else:
		need -= 1
b = [x for x in input()]
res = [0 for i in range(100)]
rec(0, 0)
print(res[need] / sum(res))


def binary(n, k):
	n1 = 2 ** n
	c = 0
	count = 0
	for i in range(n1):
		summa = str(bin(c)).count('1')
		if summa == k:
			count += 1
		c += 1
	return count / n1
s1 = input()
s2 = input()
s1p = s1.count('+')
s1m = s1.count('-')
s2p = s2.count('+')
s2m = s2.count('-')
s2v = s2.count('?')
pos1 = s1p - s1m
pos2 = s2p - s2m
razn = abs(s1p - s1m - (s2p - s2m))
k = (s2v - razn) / 2 + razn
if s1p == s2p and s1m == s2m:
	print('%.12f' % 1)
elif razn > s2v:
	print('%.12f' % 0)
else:
	print('%.12f' % binary(s2v, k))


def delete(s, pos):
	n = len(s)
	s = list(s)
	i = pos
	while i < n - 1:
		s[i] = s[i + 1]
		i += 1
	n -= 1
	return ''.join(s[:n])

def pos(s):
	posx = 0
	for x in s:
		if x == '+':
			posx += 1
		else:
			posx -= 1
	return posx

def gen(s, m, posA):
	if len(s) == m:
		if pos(s) == posA:
			ans.append(1)
		else:
			ans.append(0)
		return
	gen(s + '+', m, posA)
	gen(s + '-', m, posA)
actual = input()
recived = input()
posA = pos(actual)
dels = []
(i, n) = (0, len(recived))
while i < n:
	if recived[i] not in '+-':
		recived = delete(recived, i)
		n -= 1
		continue
	i += 1
if len(recived) == len(actual):
	if pos(recived) == posA:
		print(1)
	else:
		print(0)
else:
	ans = []
	gen(recived, len(actual), posA)
	print(sum(ans) / len(ans))


from decimal import *
getcontext().prec = 100
(s1, s2) = (list(input()), list(input()))
s1.sort()
s2.sort()

def evaluate(s):
	c = 0
	for i in s:
		if i == '+':
			c += 1
		if i == '-':
			c -= 1
	return c
score = evaluate(s1)
count = s2.count('?')
s2 = s2[:len(s2) - count]
import itertools
(c1, c2) = (0, 0)
for t in itertools.product(['+', '-'], repeat=count):
	c2 += 1
	if evaluate(s2 + list(t)) == score:
		c1 += 1
print(Decimal(c1) / Decimal(c2))


from math import factorial as fac

def com(a, b):
	s1 = fac(a)
	s2 = fac(b)
	s3 = fac(a - b)
	return s1 / (s2 * s3)

def mul(a):
	g = 1
	for i in range(1, a + 1):
		g = g * 2
	return g
s1 = input()
s2 = input()
ans1 = 0
ans2 = 0
c = 0
for i in range(0, len(s1)):
	if s1[i] == '+':
		ans1 = ans1 + 1
	else:
		ans1 = ans1 - 1
for i in range(0, len(s2)):
	if s2[i] == '+':
		ans2 = ans2 + 1
	if s2[i] == '-':
		ans2 = ans2 - 1
	if s2[i] == '?':
		c = c + 1
res = 0.0
if c == 0 and ans1 != ans2:
	print('{0:.10f}'.format(res))
else:
	diff = abs(ans1 - ans2)
	if c < diff:
		res = 0.0
		print('{0:.10f}'.format(res))
	elif (c - diff) % 2 == 0:
		f1 = com(c, diff + (c - diff) / 2)
		f2 = mul(c)
		res = f1 / f2
		print('{0:.10f}'.format(res))
	else:
		res = 0.0
		print('{0:.10f}'.format(res))


sent = input()
recieved = input()
sum = 0
for c in sent:
	if c == '+':
		sum += 1
	else:
		sum += -1
have = 0
unknown = 0
for c in recieved:
	if c == '+':
		have += 1
	if c == '-':
		have += -1
	if c == '?':
		unknown += 1
stop = 1 << unknown
reached = 0
for bitSet in range(0, stop):
	additional = 0
	mask = bitSet
	used = 0
	while mask:
		if mask % 2:
			additional += 1
		else:
			additional += -1
		used += 1
		mask >>= 1
	if additional + have + (unknown - used) * -1 == sum:
		reached += 1
print(reached / stop)


def replace(s):
	unsure = sum = 0
	for ele in s:
		if ele == '+':
			sum += 1
		elif ele == '-':
			sum -= 1
		elif ele == '?':
			unsure += 1
	return (sum, unsure)

def permu(low, up):
	prob_base = 0.5 ** low
	up = min(up, low - up)
	temp_up = up
	small = big = 1
	while temp_up >= 1:
		big *= low
		low -= 1
		temp_up -= 1
	while up >= 1:
		small *= up
		up -= 1
	return big / small * prob_base
(origin_sum, _) = replace(input())
(receive_sum, unsure) = replace(input())
need = origin_sum - receive_sum
res = None
if abs(need) > unsure:
	res = 0
elif (unsure - abs(need)) % 2 == 1:
	res = 0
elif unsure == 0:
	res = 1
else:
	res = permu(unsure, (unsure - abs(need)) // 2)
print(res)


s = input()
s1 = input()
import math
splus = s.count('+')
sminus = s.count('-')
n1 = splus + sminus
s1plus = s1.count('+')
s1minus = s1.count('-')
s1q = s1.count('?')
if s1q > 0:
	ans = 0
	x = splus - s1plus
	y = sminus - s1minus
	if x < 0 or y < 0:
		print('{0:.9f}'.format(ans))
	else:
		base = pow(2, s1q)
		deno = math.factorial(x + y) // (math.factorial(x) * math.factorial(y))
		ans = deno / base
		print('{0:.9f}'.format(ans))
else:
	ans = 1
	if splus == s1plus and s1minus == sminus:
		ans = 1
		print('{0:.9f}'.format(ans))
	else:
		ans = 0
		print('{0:.9f}'.format(ans))


import sys
import collections
import math
import functools
import itertools
import bisect
import operator
import heapq
import random
true = True
false = False
null = None
tcid = 0
tcmax = 99999999

def compute(val, func):
	return func(val)

def seq(lo, hi, step=1):
	return range(lo, hi + 1, step)

def sround(val, nd):
	return f'{val:.{nd}f}'

def ceil(a, b):
	ans = a // b
	if a % b != 0:
		ans += 1
	return ans

def perr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def line():
	ln = sys.stdin.readline().strip()
	if ln == '':
		sys.exit()
	return ln

def lines(n):
	return [line() for i in range(n)]

def split(ln=None):
	return (ln or line()).split()

def num(str=None):
	str = str or line()
	return float(str) if '.' in str else int(str)

def nums(o=None):
	if o is not None:
		if isinstance(o, int):
			o = lines(o)
		elif isinstance(o, str):
			o = split(o)
	return list(map(num, o or split()))

def mainloop(tcid=1):
	ss = 12
	sz = 25
	aa = ss
	for cc in line():
		if cc == '+':
			aa += 1
		else:
			aa -= 1
	bb = [0] * sz
	bb[ss] = 1
	for cc in line():
		dd = [0] * sz
		for ii in range(1, sz):
			if cc != '+':
				dd[ii - 1] += bb[ii]
			if cc != '-':
				dd[ii] += bb[ii - 1]
		bb = dd
	hi = bb[aa]
	lo = sum(bb)
	print(hi / lo)
while tcid < tcmax:
	tcid += 1
	mainloop(tcid)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		s1 = input()
		s2 = input()
		n = len(s1)
		(pos1, pos2) = (0, 0)
		qns = 0
		for (e1, e2) in zip(s1, s2):
			if e1 == '+':
				pos1 += 1
			else:
				pos1 -= 1
			if e2 == '+':
				pos2 += 1
			elif e2 == '-':
				pos2 -= 1
			else:
				qns += 1
		fact = [1]
		for i in range(1, 11):
			fact.append(fact[-1] * i)
		diff = abs(pos1 - pos2)
		if diff > qns:
			print(0)
		else:
			r = qns + diff
			if r & 1:
				print(0)
			r = r // 2
			num = fact[qns] // (fact[r] * fact[qns - r])
			den = 2 ** qns
			print(num / den)
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


correct = []
for x in input():
	if x == '+':
		correct.append(1)
	elif x == '-':
		correct.append(-1)
	else:
		correct.append(0)
got = []
for x in input():
	if x == '+':
		got.append(1)
	elif x == '-':
		got.append(-1)
	else:
		got.append(0)
expected = sum(correct)
maxindex = len(got)
success = 0
failure = 0
choices = 0

def decide(index, sum):
	global success, maxindex, failure, choices
	if index == maxindex:
		if sum == expected:
			success += 1
			return
		else:
			failure += 1
			return
	val = got[index]
	if val is 1:
		decide(index + 1, sum + 1)
	elif val is -1:
		decide(index + 1, sum - 1)
	else:
		choices += 2
		decide(index + 1, sum + 1)
		decide(index + 1, sum - 1)
decide(0, 0)
print('%.12f' % (success / (success + failure)))


from sys import stdin
from collections import defaultdict
s1 = stdin.readline().rstrip()
s2 = stdin.readline().rstrip()
count = defaultdict(int)
s1_pos = 0
for c in s1:
	if c == '+':
		s1_pos += 1
	else:
		s1_pos -= 1

def gen_pos(arr, cur, state):
	if cur == len(arr):
		count[state] += 1
		return
	if arr[cur] == '?':
		gen_pos(arr, cur + 1, state + 1)
		gen_pos(arr, cur + 1, state - 1)
	elif arr[cur] == '+':
		gen_pos(arr, cur + 1, state + 1)
	else:
		gen_pos(arr, cur + 1, state - 1)
gen_pos(s2, 0, 0)
total = 0
for cur in count.values():
	total += cur
print(count[s1_pos] / total)


class Comando:

	def __init__(self, string):
		self.menos = string.count('-')
		self.mais = string.count('+')
		self.interrogacao = string.count('?')

	def get_posicao_final(self):
		return self.mais - self.menos

def fat(n):
	if n <= 0:
		return 1
	else:
		return n * fat(n - 1)
s1 = Comando(input())
s2 = Comando(input())
diferenca = abs(s1.get_posicao_final() - s2.get_posicao_final())
if diferenca <= s2.interrogacao and (s2.interrogacao - diferenca) % 2 == 0:
	x = (s2.interrogacao - diferenca) // 2
	ans = fat(s2.interrogacao) / (fat(diferenca + x) * fat(x))
	total = 2 ** s2.interrogacao
	print('{:0.12f}'.format(ans / total))
else:
	print('0.000000000000')


s1 = input()
s2 = input()
c1 = c2 = cq = res = tot = 0
for a in s1:
	if a == '+':
		c1 += 1
	else:
		c1 -= 1
for a in s2:
	if a == '+':
		c2 += 1
	elif a == '?':
		cq += 1
	else:
		c2 -= 1

def rec():
	global cq, c2
	if cq == 0:
		global tot, res
		if c2 == c1:
			res += 1
		tot += 1
		return
	cq -= 1
	c2 -= 1
	rec()
	c2 += 2
	rec()
	c2 -= 1
	cq += 1
if cq < abs(c1 - c2):
	print('0.0000000000000')
elif c1 == c2 and cq == 0:
	print('1.0000000000000')
else:
	rec()
	print(f'{res / tot:.10f}')


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	s1 = sin()
	s2 = sin()
	c1 = Counter(s1)
	c2 = Counter(s2)
	if c1 == c2:
		print('%.12f' % 1)
	elif '?' in c2:
		if '+' not in c1:
			c1['+'] = 0
		if '-' not in c1:
			c1['-'] = 0
		if '+' not in c2:
			c2['+'] = 0
		if '-' not in c2:
			c2['-'] = 0
		if c1['+'] < c2['+']:
			print('%.12f' % 0)
			sys.exit(0)
		if c1['-'] < c2['-']:
			print('%.12f' % 0)
			sys.exit(0)
		plus = c1['+'] - c2['+']
		minus = c1['-'] - c2['-']
		x = c2['?']
		ans = math.factorial(x) / (math.factorial(plus) * math.factorial(minus))
		print('%.12f' % (ans / 2 ** x))
	else:
		print('%.12f' % 0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def permute(n):
	p = 1
	for x in range(1, n + 1):
		p *= x
	return p
s1 = input()
s2 = input()
(p1, p2, m1, m2, q) = (0, 0, 0, 0, 0)
for i in range(len(s1)):
	if s1[i] == '+':
		p1 += 1
	else:
		m1 += 1
	if s2[i] == '+':
		p2 += 1
	elif s2[i] == '-':
		m2 += 1
	else:
		q += 1
if p2 > p1 or m2 > m1:
	print(0.0)
elif q == 0:
	if p2 - m2 == p1 - m1:
		print(1.0)
	else:
		print(0.0)
else:
	print(permute(q) / (pow(2, q) * permute(p1 - p2) * permute(m1 - m2)))


def backtrack(a, i, pos):
	global res
	if i == len(a):
		res.append(pos)
		return
	elif a[i] == '+':
		backtrack(a, i + 1, pos + 1)
	elif a[i] == '-':
		backtrack(a, i + 1, pos - 1)
	else:
		backtrack(a, i + 1, pos + 1)
		backtrack(a, i + 1, pos - 1)
s1 = list(input().strip())
s2 = list(input().strip())
res = []
backtrack(s2, 0, 0)
c = 0
for i in range(0, len(s1)):
	if s1[i] == '-':
		c -= 1
	else:
		c += 1
print(res.count(c) / len(res))


s1 = input()
s2 = input()
soma1 = 0
soma2 = [0]
for i in range(len(s1)):
	if s1[i] == '+':
		soma1 += 1
	else:
		soma1 -= 1
j = 1
for i in range(len(s2)):
	if s2[i] == '+':
		for k in range(j):
			soma2[k] += 1
	elif s2[i] == '-':
		for k in range(j):
			soma2[k] -= 1
	else:
		for k in range(j):
			soma2.append(soma2[k] + 1)
			soma2[k] -= 1
		j = j * 2
resp = 0
for i in range(len(soma2)):
	if soma2[i] == soma1:
		resp += 1
print('%.13f' % (resp / len(soma2)))


def C(n, m):
	if n < m:
		return 0
	t = 1
	(n, m) = (min(n, m), max(n, m))
	for i in range(n):
		t *= m - i
	p = 1
	for i in range(1, n + 1):
		p *= i
	return t // p
s = input()
n = s.count('+') - s.count('-')
n1 = s.count('+')
n2 = s.count('-')
s = input()
m = s.count('+') - s.count('-')
U = s.count('?')
Q = abs(s.count('+') - n1)
Q1 = abs(s.count('-') - n2)
H = 2 ** U
print('%.12f' % min(C(U, Q) / H, C(U, Q1) / H))


import math

def sum_String(s):
	res = 0
	for i in s:
		if i == '+':
			res += 1
		if i == '-':
			res -= 1
	return res

def facto(n):
	if n == 0:
		return 1
	s = 1
	for i in range(1, n + 1):
		s *= i
	return s

def combi(n, m):
	denominator = facto(m) * facto(n - m)
	numerator = facto(n)
	return int(numerator / denominator)
s1 = input()
total_1 = sum_String(s1)
s2 = input()
total_2 = sum_String(s2)
tmp_2 = 0
for i in s2:
	if i == '?':
		tmp_2 += 1
if tmp_2 == 0:
	if total_2 == total_1:
		print('1.000000000000')
		exit()
	else:
		print('0.000000000000')
		exit()
tmp_1 = total_1 - total_2
m = int((tmp_1 + tmp_2) / 2)
n = tmp_2
res = combi(n, m) / pow(2, n)
print(format(res, '.12f'))


s1 = input()
s2 = input()
n = len(s1)
target = 0
for i in s1:
	if i == '+':
		target += 1
	else:
		target -= 1

def go(pos, delta):
	if pos == n:
		return float(delta == target)
	if s2[pos] != '?':
		if s2[pos] == '+':
			return go(pos + 1, delta + 1)
		else:
			return go(pos + 1, delta - 1)
	else:
		return 0.5 * go(pos + 1, delta + 1) + 0.5 * go(pos + 1, delta - 1)
print('{0:.12f}'.format(go(0, 0)))


repo = {1: {1: 0.5}, 2: {2: 0.25, 0: 0.5}, 3: {3: 0.125, 1: 0.375}, 4: {4: 0.0625, 2: 0.25, 0: 0.375}, 5: {5: 0.03125, 3: 0.15625, 1: 0.3125}, 6: {6: 0.015625, 4: 0.09375, 2: 0.234375, 0: 0.3125}, 7: {7: 0.0078125, 5: 0.0546875, 3: 0.1640625, 1: 0.2734375}, 8: {8: 0.00390625, 6: 0.03125, 4: 0.109375, 2: 0.21875, 0: 0.2734375}, 9: {9: 0.001953125, 7: 0.017578125, 5: 0.0703125, 3: 0.1640625, 1: 0.24609375}, 10: {10: 0.0009765625, 8: 0.009765625, 6: 0.0439453125, 4: 0.1171875, 2: 0.205078125, 0: 0.24609375}}

def signalToValue(str):
	value = 0
	for i in str:
		if i == '+':
			value += 1
		elif i == '-':
			value -= 1
	return value
s = input()
t = input()
p = s.count('+') - t.count('+')
m = s.count('-') - t.count('-')
q = t.count('?')
if p < 0 or m < 0:
	print(0)
elif q == 0:
	print(1)
else:
	print(repo[q][abs(signalToValue(s) - signalToValue(t))])


I = input
s = I()
d = {0: 1}
for i in I():
	t = {}
	if i == '?':
		for k in d:
			t[k - 1] = t.get(k - 1, 0) + d[k] / 2
			t[k + 1] = t.get(k + 1, 0) + d[k] / 2
	else:
		l = 1 - 2 * (i == '-')
		for k in d:
			t[k + l] = d[k]
	d = t
print(d.get(s.count('+') * 2 - len(s), 0))


from collections import Counter
import math
i1 = list(input())
i2 = list(input())
a = Counter(i1)
b = Counter(i2)
c = b - a
d = a - b
c1 = list(c.elements())
d1 = list(d.elements())
count = 0
for i in c1:
	if i == '?':
		count = count + 1
if count != len(d1):
	print(0)
else:
	x = len(c1)
	that = 0
	for i in d1:
		if i == '+':
			that = that + 1
	out = math.factorial(x) / (math.factorial(that) * math.factorial(x - that))
	print(out / math.pow(2, x))


def C(m, n):
	if m == n:
		return 1
	elif m == 0:
		return 1
	else:
		return C(m - 1, n - 1) + C(m, n - 1)
(command_1, command_2) = (input(), input())
correct_pos = command_1.count('+') - command_1.count('-')
temp_pos = command_2.count('+') - command_2.count('-')
num = command_2.count('?')
possibility = {}
for i in range(num + 1):
	possibility[2 * i + -num + temp_pos] = C(i, num) / 2 ** num
print('%.9f' % (0 if correct_pos not in possibility else possibility[correct_pos]))


from collections import Counter
c1 = Counter(input())
c2 = Counter(input())
pos = c1['+'] - c1['-']
p = c2['+'] - c2['-']

def solve(n, p):
	if n == 0:
		if p == pos:
			res = 1
		else:
			res = 0
	else:
		res = solve(n - 1, p + 1) + solve(n - 1, p - 1)
	return res
if c2['?'] == 0:
	if pos == p:
		print(1)
	else:
		print(0)
else:
	print(solve(c2['?'], p) / 2 ** c2['?'])


s = input()
p = input()
intended = 0
d = {0: 1}
for i in range(len(s)):
	sdir = 1 if s[i] == '+' else -1
	intended += sdir
	nd = {}
	if p[i] == '?':
		for (key, value) in d.items():
			nd[key + 1] = nd.get(key + 1, 0) + value / 2
			nd[key - 1] = nd.get(key - 1, 0) + value / 2
	else:
		pdir = 1 if p[i] == '+' else -1
		for (key, value) in d.items():
			nd[key + pdir] = nd.get(key + pdir, 0) + value
	d = nd
print(d.get(intended, 0))


import math
s1 = input()
s2 = input()
(plus, minus) = (s1.count('+'), s1.count('-'))
pre_plus = s2.count('+')
pre_minus = s2.count('-')
(req_plus, req_minus) = (plus - pre_plus, minus - pre_minus)
if req_minus < 0 or req_plus < 0:
	print('%.12f' % 0)
else:
	unknowns = len(s1) - (pre_minus + pre_plus)
	if unknowns == 0:
		print('%.12f' % 1)
	else:
		den = pow(2, unknowns)
		num = math.factorial(unknowns) / (math.factorial(req_plus) * math.factorial(req_minus))
		ans = num / den
		print('%.12f' % ans)


def solve(l, r):
	cnt_l = [0, 0]
	cnt_r = [0, 0]
	for c in l:
		cnt_l[0 if c == '+' else 1] += 1
	for c in r:
		if c == '?':
			continue
		cnt_r[0 if c == '+' else 1] += 1
	(plus, neg) = (cnt_l[0] - cnt_r[0], cnt_l[1] - cnt_r[1])
	if plus < 0 or neg < 0:
		return 0.0
	if plus == neg and neg == 0:
		return 1.0
	m = min(plus, neg)
	total = plus + neg
	divisor = 1
	for i in range(total):
		divisor *= total - i
	a = 1
	for i in range(m):
		a *= m - i
	b = 1
	for i in range(total - m):
		b *= total - m - i
	divisor /= a * b
	return divisor / 2 ** total
l = input()
r = input()
print(solve(l, r))


def fall(i, val):
	global ans, cnt
	if i == len(sa):
		if val == pos:
			ans += 1
		cnt += 1
		return
	if sa[i] == '+':
		fall(i + 1, val + 1)
	elif sa[i] == '-':
		fall(i + 1, val - 1)
	else:
		fall(i + 1, val + 1)
		fall(i + 1, val - 1)
s = input()
sa = input()
le = len(sa)
pos = 0
ans = 0
cnt = 0
for i in s:
	if i == '+':
		pos += 1
	else:
		pos -= 1
fall(0, 0)
print(ans / cnt)


a = input()
b = input()
plusa = a.count('+')
minusa = a.count('-')
plusb = b.count('+')
minusb = b.count('-')
qb = b.count('?')
if (plusa < plusb or minusa < minusb) and qb == 0:
	print('0.000000000000')
elif plusa == plusb and minusa == minusb:
	print('1.000000000000')
elif qb > 0:
	totalprob = 2 ** qb
	count = 0
	needplus = plusa - plusb
	needminus = minusa - minusb
	for i in range(totalprob):
		bina = bin(i)
		bina = bina[2:]
		bv = '0' * (qb - len(bina)) + bina
		minus = bv.count('0')
		plus = bv.count('1')
		if needplus == plus and needminus == minus:
			count += 1
	ans = count / totalprob
	print('{:.12f}'.format(ans))


import sys
real = list(sys.stdin.readline().strip())
img = list(sys.stdin.readline().strip())
count = 0
s_count = 0
c = 0
sol = 0

def conb(c, arr, s=''):
	if c == 0:
		arr.append(s)
	else:
		conb(c - 1, arr, s + '+')
		conb(c - 1, arr, s + '-')
k = []
for i in real:
	count += 1 if i == '+' else -1
for i in img:
	s_count += 1 if i == '+' else 0
	s_count += -1 if i == '-' else 0
	c += 1 if i == '?' else 0
if c == 0 and s_count == count:
	print('{:.12f}'.format(1))
else:
	conb(c, k)
	l = len(k)
	for i in k:
		sudo = s_count
		for j in i:
			sudo += 1 if j == '+' else -1
		if sudo == count:
			sol += 1
	print('{:.12f}'.format(sol / l))


def call(goal, i):
	if i == len(s2):
		l.append(goal)
		return
	if s2[i] == '+':
		call(goal + 1, i + 1)
	elif s2[i] == '-':
		call(goal - 1, i + 1)
	else:
		call(goal + 1, i + 1)
		call(goal - 1, i + 1)
(s1, s2) = (input() for i in range(2))
aim = 0
l = []
for i in s1:
	if i == '+':
		aim += 1
	else:
		aim -= 1
call(0, 0)
if len(l) == 0:
	print(0)
else:
	ans = l.count(aim) / len(l)
	print(ans)


ori = input()
sup = input()
real = ori.count('+') - ori.count('-')
pos = sup.count('+') - sup.count('-')
indef = sup.count('?')
dif = real - pos
bueno = 0
total = 0

def brute(dif, indef):
	global bueno, total
	if indef == 0:
		total += 1
		if dif == 0:
			bueno += 1
	else:
		brute(dif - 1, indef - 1)
		brute(dif + 1, indef - 1)
brute(dif, indef)
if indef == 0:
	if dif == 0:
		print(1)
	else:
		print(0)
else:
	print(bueno / total)


from sys import stdin, stdout, stderr
import time, math
from collections import defaultdict as dd, Counter

def pn(ob):
	stdout.write(str(ob))

def inp():
	return stdin.readline()
mod = 10 ** 9 + 7

def main():
	drazil = Counter(inp().strip())
	dreamoon = Counter(inp().strip())
	if dreamoon['+'] > drazil['+'] or dreamoon['-'] > drazil['-']:
		print(0.0)
	else:
		req_plus = math.factorial(drazil['+'] - dreamoon['+'])
		req_minus = math.factorial(drazil['-'] - dreamoon['-'])
		moves = dreamoon['?']
		n = math.factorial(moves)
		res = n / (req_plus * req_minus)
		res /= pow(2.0, moves)
		print(res)
main()


s1 = input()
s2 = input()
(Final_pos, Pos, Move) = (0, 0, 0)
for i in range(len(s1)):
	if s1[i] == '+':
		Final_pos += 1
	else:
		Final_pos -= 1
	if s2[i] == '?':
		Move += 1
	elif s2[i] == '+':
		Pos += 1
	else:
		Pos -= 1

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans

def C(m, n):
	return fact(n) / fact(m) / fact(n - m)
dis = abs(Final_pos - Pos)
if dis > Move or (Move - dis) % 2 != 0:
	print('%.12f' % 0)
else:
	print('%.12f' % (C((Move + dis) // 2, Move) / 2 ** Move))


def factorial(n):
	r = 1
	for i in range(2, n + 1):
		r *= i
	return r

def n_choose_k(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))

def solve(diff, u):
	pluses = u + 1
	n = 2 ** u
	for i in range(unknown, -unknown - 1, -2):
		pluses -= 1
		if diff == i:
			k = n_choose_k(u, pluses)
			return k / n
	return 0
s1 = input()
s2 = input()
k = 0
correct_p = 0
pred_p = 0
unknown = 0
for c in s1:
	correct_p += 1 if c == '+' else -1
for c in s2:
	if c in '+-':
		pred_p += 1 if c == '+' else -1
	else:
		unknown += 1
p = 1 if unknown == 0 and correct_p == pred_p else solve(correct_p - pred_p, unknown)
print('{0:.9f}'.format(p))


from math import factorial

def calc_arrangement(n, m):
	return factorial(n) / factorial(n - m)

def calc_combination(n, m):
	return calc_arrangement(n, m) / factorial(m)
str1 = list(input())
str2 = list(input())
n = 0
diff = 0
for i in range(len(str1)):
	if str1[i] == '+':
		diff += 1
	else:
		diff -= 1
	if str2[i] == '+':
		diff -= 1
	elif str2[i] == '-':
		diff += 1
	else:
		n += 1
if n == 0:
	if diff == 0:
		print(1.0)
	else:
		print(0.0)
elif n < abs(diff):
	print(0.0)
else:
	res = calc_combination(n, (n - diff) / 2) * 0.5 ** n
	print(res)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)

def nCr(n, r):
	if r == 1:
		return n
	if n == r:
		return 1
	r = max(r, n - r)
	ans = 1
	for i in range(r + 1, n + 1):
		ans *= i
	for i in range(1, n - r + 1):
		ans //= i
	return ans
s1 = input()
s2 = input()
p1 = s1.count('+') - s1.count('-')
p2 = s2.count('+') - s2.count('-')
avail = s2.count('?')
diff = abs(p1 - p2)
if diff > avail or avail - diff & 1:
	print('0.0')
else:
	val = diff + (avail - diff) // 2
	print(nCr(avail, val) / 2 ** avail)


import math
a = input()
b = input()
ap = 0
am = 0
aq = 0
for i in a:
	if i == '+':
		ap = ap + 1
	else:
		am = am + 1
for i in b:
	if i == '+':
		ap -= 1
	elif i == '-':
		am -= 1
	else:
		aq += 1
if ap < 0:
	ap = 0
if aq >= ap and aq >= am:
	a = math.factorial(aq)
	aa = math.factorial(ap)
	aa = aa * math.factorial(aq - ap)
	aa = a / aa
	print(aa * 0.5 ** ap * 0.5 ** (aq - ap))
else:
	print('0.0000000')


a = input()
b = input()
diff = a.count('+') - a.count('-')
diff = diff - b.count('+') + b.count('-')
cnt = b.count('?')
ans = 0.0
for i in range(0, 1 << cnt):
	q = 0
	for j in range(0, cnt):
		if i & 1 << j:
			q = q + 1
		else:
			q = q - 1
	if q == abs(diff):
		ans = ans + 1
print('{:.13f}'.format(ans / (1 << cnt)))


sent = input()
received = input()
(sent_count_plus, sent_count_minus, received_count_plus, received_count_minus) = (0, 0, 0, 0)
unrecognized_count = 0
for char in sent:
	if char == '+':
		sent_count_plus += 1
	else:
		sent_count_minus += 1
for char in received:
	if char == '+':
		received_count_plus += 1
	elif char == '-':
		received_count_minus += 1
	else:
		unrecognized_count += 1
(needed_plus, needed_minus) = (sent_count_plus - received_count_plus, sent_count_minus - received_count_minus)
if needed_plus < 0 or needed_minus < 0:
	print(0.0)
else:
	denominator = 2 ** unrecognized_count
	c = 1
	for i in range(unrecognized_count, unrecognized_count - needed_plus, -1):
		c *= i
	for i in range(needed_plus):
		c /= i + 1
	print(c / denominator)


s1 = input()
s2 = input()
e = 0
for i in s1:
	if i == '+':
		e += 1
	else:
		e -= 1
maxn = 15
c = [[0 for i in range(maxn)] for j in range(maxn)]
c[0][0] = 1
for i in range(1, maxn):
	for j in range(maxn):
		c[i][j] = c[i - 1][j]
		if j > 0:
			c[i][j] += c[i - 1][j - 1]
e2 = 0
q = 0
for i in s2:
	if i == '+':
		e2 += 1
	elif i == '-':
		e2 -= 1
	else:
		q += 1
cnk = c[q][(q + abs(e2 - e)) // 2]
print('%0.20f' % (cnk / pow(2, q)))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]
spf_sieve()

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
a = input().strip()
b = input().strip()
f = 0
for i in a:
	if i == '+':
		f += 1
	else:
		f -= 1
x = 0
q = 0
for i in b:
	if i == '+':
		x += 1
	elif i == '-':
		x -= 1
	else:
		q += 1
d = abs(f - x)
(pos, neg) = (0, 0)
pos += d
pos += (q - d) / 2
neg + +(q - d) / 2
if pos >= 0 and neg >= 0 and (pos == int(pos)) and (neg == int(neg)) and (pos <= q):
	num = nCr(q, int(pos))
	den = 2 ** q
	print(num / den)
else:
	print(0)


from collections import Counter

def binom(n, k):
	if k > n // 2:
		k = n - k
	if k == 1:
		return n
	if k == 0:
		return 1
	return binom(n - 1, k) + binom(n - 1, k - 1)
orig = input()
get = input()
orig = Counter(orig)
get = Counter(get)
must = orig['+'] - orig['-']
now = get['+'] - get['-']
x = get['?']
y = must - now
if y < 0:
	y = -y
if (x + y) % 2 != 0:
	print(0.0)
else:
	n = (x + y) // 2
	if x < n:
		print(0.0)
	else:
		print(binom(x, n) / 2 ** x)


s1 = input().strip()
s2 = input().strip()
a = 0
for i in s1:
	if i == '+':
		a += 1
	else:
		a -= 1
b = 0
nb = 0
for i in s2:
	if i == '+':
		b += 1
	elif i == '-':
		b -= 1
	else:
		nb += 1
delta = abs(a - b)
if delta > nb:
	print(0)
else:
	A = (delta + nb) // 2
	B = nb - A
	C = min(A, B)
	ans = 1
	for i in range(C):
		ans = ans * (nb - i) // (i + 1)
	print(ans / 2 ** nb)


C = lambda n, k: n * C(n - 1, k - 1) // k if k else 1
(s1, s2) = (input(), input())
questions = s2.count('?')
d = abs(s1.count('+') + s2.count('-') - s1.count('-') - s2.count('+'))
if d > questions or (d + questions) % 2:
	print(0)
elif questions == 0:
	print(1)
else:
	print(C(questions, (questions - d) // 2) / 2 ** questions)


import sys

def binomialCoefficient(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res
s1 = input()
s2 = input()
count1 = 0
count2 = 0
count3 = 0
for i in s1:
	if i == '+':
		count1 += 1
	elif i == '-':
		count1 -= 1
for i in s2:
	if i == '+':
		count2 += 1
	elif i == '-':
		count2 -= 1
	else:
		count3 += 1
if count1 == count2 and count3 == 0:
	res = 1.0
	sys.stdout.write('%.12f\n' % res)
else:
	z = abs(count1 - count2)
	if z > count3:
		res = 0.0
		sys.stdout.write('%.12f\n' % res)
	else:
		x = (count3 - z) // 2
		a = binomialCoefficient(count3, x)
		c = 2 ** count3
		res = a / c
		sys.stdout.write('%.12f\n' % res)


def dfs(n, s):
	global ans, fpos, cpos, total
	if n == 0:
		total += 1
		if s == abs(fpos - cpos):
			ans += 1
		return
	dfs(n - 1, s + 1)
	dfs(n - 1, s - 1)
(ans, total) = (0, 0)
(a, b) = [input().strip() for i in range(2)]
(cpos, fpos, tc) = (0, 0, 0)
for i in a:
	if i == '+':
		fpos += 1
	else:
		fpos -= 1
for i in b:
	if i == '+':
		cpos += 1
	elif i == '-':
		cpos -= 1
	else:
		tc += 1
if tc == 0:
	if cpos == fpos:
		ans = 1.0
	else:
		ans = 0.0
elif abs(fpos - cpos) > tc:
	ans = 0.0
else:
	dfs(tc, 0)
	ans = ans / (1 << tc)
print(ans)


s1 = input()
s2 = input()
pos1 = s1.count('+') - s1.count('-')
pos2 = s2.count('+') - s2.count('-')
d = abs(pos1 - pos2)
n = s2.count('?')
if d % 2 != n % 2 or d > n:
	print('0.000000000000')
else:
	l = (n + 1) * 2 + 1
	a = [0 for _ in range(l)]
	a[n + 1] = 1
	for _ in range(n):
		a = [(a[i - 1] + a[i + 1]) / 2 if 0 < i < l - 1 else 0 for i in range(l)]
	print(round(a[n + 1 + d], 12))


def fac(n):
	if n <= 1:
		return 1
	else:
		return n * fac(n - 1)

def nCr(n, r):
	if n >= r:
		f = fac
		return f(n) / f(r) / f(n - r)
	else:
		return 0
s1 = input()
s2 = input()
f1 = s1.count('+')
b1 = s1.count('-')
f2 = s2.count('+')
b2 = s2.count('-')
u2 = s2.count('?')
fin = f1 - b1
cur = f2 - b2
mov = fin - cur
if abs(mov) > u2:
	print(0.0)
elif u2 == 0:
	if fin == cur:
		print(1.0)
	else:
		print(0.0)
else:
	prob = nCr(u2, (mov + u2) / 2) / 2 ** u2
	print(prob)


s = input()
trgt = 0
for c in s:
	trgt += 1 if c == '+' else -1
cmd = input()
queue = [[0, 0]]
dests = []
while queue:
	nextqueue = []
	for (pos, cmdi) in queue:
		if cmdi == len(cmd):
			dests.append(pos)
			continue
		nextcmd = cmd[cmdi]
		if nextcmd == '+':
			nextqueue.append([pos + 1, cmdi + 1])
		elif nextcmd == '-':
			nextqueue.append([pos - 1, cmdi + 1])
		else:
			nextqueue.append([pos + 1, cmdi + 1])
			nextqueue.append([pos - 1, cmdi + 1])
	queue = nextqueue
occurs = 0
for x in dests:
	if x == trgt:
		occurs += 1
print(occurs / len(dests))


from math import factorial

def probability(drazil_path, actual_path):
	drazil_end_point = calc_end_point(drazil_path)
	actual_end_point = calc_end_point(actual_path)
	count_q = actual_path.count('?')
	if count_q == 0:
		return float(drazil_end_point == actual_end_point)
	n_options = 2 ** count_q
	n_good_options = calc_successful_options(drazil_end_point, actual_end_point, count_q)
	return n_good_options / n_options

def calc_end_point(path):
	return sum([(1 if sign == '+' else -1) * (0.5 if sign in ['+', '-'] else 0) for sign in path])

def calc_successful_options(drazil_end_point, actual_end_point, count_q):
	diff = abs(drazil_end_point - actual_end_point)
	number_of_dominant_sign = diff // 0.5
	if number_of_dominant_sign > count_q or (count_q - number_of_dominant_sign) % 2 != 0:
		return 0
	opt1 = number_of_dominant_sign + (count_q - number_of_dominant_sign) / 2
	opt2 = count_q - opt1
	return factorial(count_q) / (factorial(opt1) * factorial(opt2))
drazil_path = input()
actual_path = input()
print(probability(drazil_path, actual_path))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def calc(t, i, pos, ans):
	if i == len(t):
		if pos == ans:
			return 1
		else:
			return 0
	if t[i] == '?':
		return calc(t, i + 1, pos + 1, ans) + calc(t, i + 1, pos - 1, ans)
	elif t[i] == '+':
		return calc(t, i + 1, pos + 1, ans)
	else:
		return calc(t, i + 1, pos - 1, ans)

def main():
	try:
		l = list(input())
		ans = 0
		for x in range(len(l)):
			if l[x] == '+':
				ans += 1
			else:
				ans -= 1
		t = list(input())
		count = calc(t, 0, 0, ans)
		z = 2 ** t.count('?')
		print(count / z)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


from sys import stdin
(cntot, cntall) = (None, None)

def solve_aux(s, n, c, t):
	global cntot, cntall
	if n == len(s):
		cntall += 1
		if c == t:
			cntot += 1
	elif s[n] == '+':
		solve_aux(s, n + 1, c + 1, t)
	elif s[n] == '-':
		solve_aux(s, n + 1, c - 1, t)
	else:
		solve_aux(s, n + 1, c + 1, t)
		solve_aux(s, n + 1, c - 1, t)

def solve(s1, s2):
	global cntot, cntall
	target = 0
	for c in s1:
		if c == '+':
			target += 1
		else:
			target -= 1
	(cntot, cntall) = (0, 0)
	solve_aux(s2, 0, 0, target)
	return cntot / cntall

def main():
	s1 = stdin.readline().strip()
	s2 = stdin.readline().strip()
	print('{0:.11f}'.format(solve(s1, s2)))
main()


from math import factorial

def resolve(string_a, string_b):
	string_a_plus = string_a.count('+')
	string_a_minus = string_a.count('-')
	sum_string_a = string_a_plus - string_a_minus
	string_b_plus = string_b.count('+')
	string_b_minus = string_b.count('-')
	quant_int = len(string_b) - (string_b_plus + string_b_minus)
	sum_string_b = string_b_plus - string_b_minus
	diff = sum_string_a - sum_string_b
	quant_plus = (quant_int - abs(diff)) / 2
	if quant_int >= abs(diff) and quant_plus - int(quant_plus) == 0:
		quant_plus = int(quant_plus)
		quant_possibilidades = 2 ** quant_int
		quant_valid = factorial(quant_int) / (factorial(quant_int - quant_plus) * factorial(quant_plus))
		razao = quant_valid / quant_possibilidades
		return '{:.12f}'.format(razao)
	else:
		return '{:.12f}'.format(0)
string_a = input()
string_b = input()
print(resolve(string_a, string_b))


r = input()
ur = input()
rp = r.count('+')
rn = r.count('-')
urp = ur.count('+')
urn = ur.count('-')
x = rp - urp
n = rp + rn - (urp + urn)
if rp < urp or rn < urn:
	print(0)
else:
	p = 1
	q = 1
	for i in range(n, n - x, -1):
		p *= i
	for j in range(1, x + 1):
		q *= j
	y = p / q
	z = 1 << n
	print('{0:.12f}'.format(y / z))


(MAX_N, MAX_P) = (10, 30)
mem = [[-1] * (1 + MAX_P) for _ in range(1 + MAX_N)]

def solve(i, p):
	if mem[i][p] != -1:
		return mem[i][p]
	if i == len(b):
		if p == fp:
			return 1
		else:
			return 0
	if b[i] == '+':
		mem[i][p] = solve(i + 1, p + 1)
	elif b[i] == '-':
		mem[i][p] = solve(i + 1, p - 1)
	else:
		mem[i][p] = solve(i + 1, p + 1) + solve(i + 1, p - 1)
	return mem[i][p]
a = input()
b = input()
fp = a.count('+') - a.count('-')
q = b.count('?')
print(solve(0, 0) / 2 ** q)


def calculate(s):
	count = 0
	for ch in s:
		if ch == '+':
			count += 1
		elif ch == '-':
			count -= 1
	return count

def new_str(s, comb):
	ch_no = 1
	new_s = ''
	for ch in s:
		if ch == '?':
			ch_ap = '-' if ch_no & comb > 0 else '+'
			ch_no *= 2
			new_s += ch_ap
		else:
			new_s += ch
	return new_s
s1 = input()
s2 = input()
val_s1 = calculate(s1)
if '?' in s2:
	max_val_s2 = calculate(s2.replace('?', '+'))
	min_val_s2 = calculate(s2.replace('?', '-'))
	if max_val_s2 < val_s1 or min_val_s2 > val_s1:
		print(0.0)
	else:
		q_count = s2.count('?')
		all_combination = 2 ** q_count
		if max_val_s2 == val_s1 or min_val_s2 == val_s1:
			print(1 / all_combination)
		else:
			pos_res_count = 0
			for i in range(1, all_combination - 1):
				val = calculate(new_str(s2, i))
				if val == val_s1:
					pos_res_count += 1
			print(pos_res_count / all_combination)
else:
	val_s2 = calculate(s2)
	if val_s1 == val_s2:
		print(1.0)
	else:
		print(0.0)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def getString(mask, n):
	ans = []
	for i in range(n):
		if 1 << i & mask:
			ans.append('+')
		else:
			ans.append('-')
	return ans

def makePossibleString(string, possibility):
	arr = [x for x in string]
	for x in range(len(arr)):
		if arr[x] == '?':
			arr[x] = possibility.pop()
	return ''.join(arr)
s1 = input()
s2 = input()
plus = s1.count('+')
maskLength = 0
for x in range(len(s2)):
	if s2[x] == '?':
		maskLength += 1
if not maskLength:
	if plus == s2.count('+'):
		print(1)
	else:
		print(0)
else:
	favourable = 0
	mask = (1 << maskLength) - 1
	while mask >= 0:
		possibility = getString(mask, maskLength)
		temp = makePossibleString(s2, possibility)
		if temp.count('+') == plus:
			favourable += 1
		mask -= 1
	print(favourable / (1 << maskLength))


from math import factorial as f
s1 = input()
s2 = input()
x1 = s1.count('+')
y1 = len(s1) - x1
x2 = s2.count('+')
y2 = s2.count('-')
r = len(s2) - x2 - y2
x = x1 - x2
y = y1 - y2
if r == 0 and x == 0 and (y == 0):
	print(1)
elif r == 0 and (x != 0 or y != 0):
	print(0)
elif r != 0 and (x < 0 or y < 0):
	print(0)
else:
	nu = f(r) / (f(r - x) * f(x))
	d = 2 ** r
	print(nu / d)


import math

def calc(n, i):
	(num1, num2) = (1, 1)
	for j in range(i):
		num1 *= n - j
		num2 *= j + 1
	return num1 / num2
str1 = input()
str2 = input()
(value1, value2, cnt) = (0, 0, 0)
prob = {}
for char in str1:
	if char == '+':
		value1 += 1
	elif char == '-':
		value1 -= 1
for char in str2:
	if char == '+':
		value2 += 1
	elif char == '-':
		value2 -= 1
	elif char == '?':
		cnt += 1
value = value1 - value2
for i in range(len(str1) // 2 + 1):
	prob[(cnt - i) * -1 + i] = calc(cnt, i)
	prob[((cnt - i) * -1 + i) * -1] = calc(cnt, i)
if cnt == 0 and value == 0:
	print(1.0)
elif cnt == 0 and value != 0:
	print(0.0)
elif value in prob:
	print(prob[value] / math.pow(2, cnt))
else:
	print(0.0)


from functools import reduce
from collections import Counter

def nchoosek(n, k):
	if n - k + 1 <= 1:
		return 1
	a = reduce(lambda x, y: x * y, range(1, n + 1))
	b = reduce(lambda x, y: x * y, range(1, k + 1))
	c = reduce(lambda x, y: x * y, range(1, n - k + 1))
	return a / b / c
x = input()
y = input()
x_c = Counter(x)
y_c = Counter(y)
if x_c == y_c:
	print('1.000000000000')
else:
	diff = abs(x_c['+'] - x_c['-'] - (y_c['+'] - y_c['-']))
	q = 2 ** y_c['?']
	if y_c['?'] < diff:
		print('0.000000000000')
	else:
		p = nchoosek(y_c['?'], max(x_c['+'] - y_c['+'], x_c['-'] - y_c['-']))
		print('%.9f' % (p / q))


def factorial(n):
	i = 1
	for j in range(1, n + 1):
		i *= j
	return i

def choose(n, r):
	return int(factorial(n) / factorial(r) / factorial(n - r))
l = list(input())
exp = 0
for i in range(len(l)):
	if l[i] == '+':
		exp += 1
	else:
		exp -= 1
l1 = list(input())
dis = 0
unrec = 0
for i in range(len(l1)):
	if l1[i] == '+':
		dis += 1
	elif l1[i] == '-':
		dis -= 1
	else:
		unrec += 1
if abs(exp - dis) > unrec:
	print(0)
elif unrec == 0:
	print(1)
else:
	print(choose(unrec, abs(exp - dis) + int((unrec - abs(exp - dis)) / 2)) / 2 ** unrec)


def factorial(n):
	if n == 0:
		return 1
	j = 1
	for i in range(1, n + 1):
		j *= i
	return j
a = input()
b = input()
n = len(b)
val = 0
m = 0
e = 0
for i in range(n):
	if a[i] == '+':
		val += 1
	if a[i] == '-':
		val -= 1
	if b[i] == '+':
		m += 1
	if b[i] == '-':
		m -= 1
	if b[i] == '?':
		e += 1
if e == 0:
	if val != m:
		print(0)
	else:
		print(1)
else:
	r = abs(val - m)
	if r <= e:
		if (e - r) % 2 == 0:
			k = (e - r) // 2
			p = (e + r) // 2
			num = factorial(e) / (factorial(p) * factorial(k))
			den = 2 ** e
			print(num / den)
		else:
			print(0)
	else:
		print(0)


def f(noofque):
	prev = [0] * (2 * noofque + 1)
	prev[noofque] = 1
	curr = [0] * len(prev)
	for i in range(noofque):
		for j in range(len(prev)):
			if j == 0:
				curr[j] = prev[1]
			elif j == len(prev) - 1:
				curr[j] = prev[j - 1]
			else:
				curr[j] = prev[j - 1] + prev[j + 1]
		prev = curr + []
	return prev
sent = input()
received = input()
final = sent.count('+') - sent.count('-')
currfinal = received.count('+') - received.count('-')
noofque = received.count('?')
if noofque:
	if final >= currfinal - noofque and final <= currfinal + noofque:
		arr = f(noofque)
		print(arr[final - currfinal + noofque] / 2 ** noofque)
	else:
		print('0.000000000000')
elif final == currfinal:
	print('1.000000000000')
else:
	print('0.000000000000')


s1 = input().strip()
s2 = input().strip()
l1 = [0] * 2
l2 = [0] * 3
f = [1] * 11
f[0] = 1
for x in range(1, 11):
	f[x] = f[x - 1] * x
for x in s1:
	if x == '+':
		l1[0] += 1
	else:
		l1[1] += 1
for x in s2:
	if x == '+':
		l2[0] += 1
	elif x == '-':
		l2[1] += 1
	else:
		l2[2] += 1
reqp = l1[0] - l2[0]
reqn = l1[1] - l2[1]
if reqp > l2[2] or reqn > l2[2]:
	prob = 0
else:
	prob = f[l2[2]] // f[reqp] // f[reqn] / pow(2, l2[2])
print('%.12f' % prob)


from itertools import permutations
s = input()
d = input()
cnt1 = s.count('+') - s.count('-')
cnt2 = d.count('+') - d.count('-')
cnt3 = d.count('?')
e = set()
c = ''
for i in range(1, cnt3 + 1):
	a = i * '+' + (cnt3 - i) * '-'
	b = a.count('+') - a.count('-')
	if cnt2 + b == cnt1 and len(a) == cnt3:
		c = a
for i in range(1, cnt3 + 1):
	a = i * '-' + (cnt3 - i) * '+'
	b = a.count('+') - a.count('-')
	if cnt2 + b == cnt1 and len(a) == cnt3:
		c = a
for i in permutations(c):
	if i not in e:
		e.add(i)
if cnt1 == cnt2 and cnt3 == 0:
	print(1)
elif not e or not c:
	print(0)
else:
	print(len(e) / 2 ** cnt3)


fact = [1] * 11
fact[0] = 1
fact[1] = 1
for i in range(2, 11):
	fact[i] = fact[i - 1] * i
s1 = input()
s2 = input()
final = 0
for i in s1:
	if i == '+':
		final += 1
	else:
		final -= 1
inside = 0
for i in s2:
	if i == '+':
		inside += 1
	elif i == '-':
		inside -= 1
toBeOvercome = final - inside
if True:
	unrecognized = s2.count('?')
	if unrecognized == 0:
		if toBeOvercome == 0:
			print('%.12f' % (1 / 1))
		else:
			print('%.12f' % (0 / 1))
	else:
		totalPoss = pow(2, unrecognized)
		s = 0
		for i in range(0, unrecognized + 1):
			for j in range(0, unrecognized + 1):
				if i == 0 and j == 0:
					continue
				if i + j > unrecognized:
					break
				elif i - j == toBeOvercome and i + j == unrecognized:
					s += fact[unrecognized] // fact[i] // fact[unrecognized - i]
		print('%.12f' % (s / totalPoss))


import math

def cm(n, r):
	i = n - r
	C = math.factorial(n) / (math.factorial(i) * math.factorial(r))
	return C
s1 = input()
s2 = input()
d1 = {}
d2 = {}
d1['+'] = 0
d1['-'] = 0
d2['+'] = 0
d2['-'] = 0
d2['?'] = 0
r = 0
ans = -1
for c in s1:
	d1[c] += 1
for c in s2:
	d2[c] += 1
np = d1['+'] - d2['+']
nn = d1['-'] - d2['-']
if np < 0 or nn < 0:
	ans = 0
else:
	n = d2['?']
	r = min(np, nn)
	ans = cm(n, r)
	ans = round(float(ans) / float(math.pow(2, n)), 9)
print(ans)


import math

def combine(n, m):
	ret = 1
	for i in range(m + 1, n + 1):
		ret *= i
	for i in range(1, n - m + 1):
		ret /= i
	return ret
send = input()
recv = input()
dst = 0
for c in send:
	if c is '+':
		dst += 1
	else:
		dst -= 1
cur = 0
cnt = 0
for c in recv:
	if c is '+':
		cur += 1
	elif c is '-':
		cur -= 1
	else:
		cnt += 1
mov = dst - cur
ans = 1.0
if abs(mov) > cnt or (mov + cnt) % 2 != 0:
	ans = 0.0
else:
	positive = (mov + cnt) // 2
	ans = combine(cnt, positive) / math.pow(2, cnt)
print(ans)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	s1 = input()
	s2 = input()
	plus = s1.count('+') - s2.count('+')
	minus = s1.count('-') - s2.count('-')
	q = s2.count('?')
	if q == 0 and plus != 0 and (minus != 0):
		print('{:.12f}'.format(0))
		return
	(sum1, sum2) = (0, 0)
	print('{:.12f}'.format(fact(plus + minus) // (fact(plus) * fact(minus)) / 2 ** q))
for _ in range(1):
	solve()


def f(n):
	out = 1
	for i in range(1, n + 1):
		out *= i
	return out

def c(n, r):
	return f(n) / (f(n - r) * f(r))
s1 = input()
s2 = input()
pc1 = s1.count('+')
mc1 = s1.count('-')
pc2 = s2.count('+')
mc2 = s2.count('-')
qc = s2.count('?')
if qc == 0:
	if pc1 == pc2 and mc1 == mc2:
		print(1.0)
	else:
		print(0.0)
else:
	pd = pc1 - pc2
	md = mc1 - mc2
	if pd < 0 or md < 0:
		print(0.0)
	else:
		print(c(qc, pd) / 2 ** qc)


import math
s = input()
t = input()
(p1, p2, m1, m2, q) = (0, 0, 0, 0, 0)
for i in s:
	if i == '+':
		p1 += 1
	else:
		m1 += 1
for i in t:
	if i == '+':
		p2 += 1
	elif i == '-':
		m2 += 1
	else:
		q += 1
(dp, dm) = (p1 - p2, m1 - m2)
if dp < 0 or dm < 0:
	print(0.0)
else:
	ans = math.factorial(q) / (math.factorial(dp) * math.factorial(dm)) / math.pow(2, q)
	print(ans)


def fact(n):
	t = 1
	for i in range(1, n + 1):
		t *= i
	return t
a = input()
b = input()
d = a.count('+') + a.count('-') * -1
k = b.count('?')
t = b.count('+') + b.count('-') * -1
if k == 0:
	if d == t:
		print(1.0)
	else:
		print(0.0)
else:
	yes = 0
	for i in range(k + 1):
		f = (k - i) * -1 + i
		if f + t == d:
			prob = fact(k) / (fact(i) * fact(k - i)) * 0.5 ** k
			yes = 1
			print(prob)
			break
	if yes == 0:
		print(0.0)


def func(a2, lol, des, index, l):
	if index == l:
		lol.append(des)
		return
	if a2[index] == '+':
		des += 1
		func(a2, lol, des, index + 1, l)
		return
	elif a2[index] == '-':
		des -= 1
		func(a2, lol, des, index + 1, l)
		return
	else:
		des += 1
		func(a2, lol, des, index + 1, l)
		des -= 2
		func(a2, lol, des, index + 1, l)
		return
a1 = input()
a2 = input()
des = 0
for i in a1:
	if i == '+':
		des += 1
	else:
		des -= 1
lol = []
func(a2, lol, 0, 0, len(a2))
print(lol.count(des) / len(lol))


import itertools
kol1 = {'+': 0, '-': 0, '?': 0}
kol2 = {'+': 0, '-': 0, '?': 0}
s1 = input()
s2 = input()
for s in s1:
	kol1[s] += 1
for s in s2:
	kol2[s] += 1
if kol1['+'] == kol2['+'] and kol1['-'] == kol2['-']:
	print('1.0')
	exit()
mod1 = kol1['+'] - kol1['-']
mod2 = kol2['+'] - kol2['-']
mod3 = abs(mod2 - mod1)
if mod3 > kol2['?']:
	print(0.0)
	exit()
list_comb = [1, -1]
sum_pos = 0
col = 0
for comb in itertools.product(list_comb, repeat=kol2['?']):
	if sum(comb) == mod3:
		sum_pos += 1
	col += 1
print(sum_pos / col)


from math import factorial
s1 = input()
s2 = input()
finPos = 0
for c in s1:
	if c == '+':
		finPos += 1
	else:
		finPos -= 1
stPos = 0
for c in s2:
	if c == '+':
		stPos += 1
	elif c == '-':
		stPos -= 1
n = s2.count('?')
diff = abs(finPos - stPos)
if diff > n:
	print(0)
elif n & 1 != diff & 1:
	print(0)
else:
	i = 0
	for i in range(n // 2, n):
		if i * 2 - n == diff:
			break
	if i * 2 - n != diff:
		i += 1
	print(factorial(n) / (factorial(n - i) * factorial(i)) / (1 << n))


s1 = input()
s2 = input()
ptr = 0
for i in s1:
	if i == '+':
		ptr += 1
	else:
		ptr -= 1

def func(s, initial):
	if len(s) == 0:
		if initial == ptr:
			return 1
		else:
			return 0
	if s[0] == '+':
		return func(s[1:], initial + 1)
	elif s[0] == '-':
		return func(s[1:], initial - 1)
	return (func(s[1:], initial + 1) + func(s[1:], initial - 1)) * 0.5
print(func(s2, 0))


from math import factorial as f
n = input()
s = input()
quest = s.count('?')
plusn = n.count('+')
plus = s.count('+')
try:
	comb = f(quest) / (f(plusn - plus) * f(quest - (plusn - plus)))
	print('%.12f' % (comb / 2 ** quest))
except:
	print('%.12f' % 0)


import math
a = str(input())
b = str(input())
posa = a.count('+') - a.count('-')
posb = b.count('+') - b.count('-')
q = b.count('?')
dist = posa - posb
ones = (abs(dist) + q) / 2
if q < abs(dist) or (dist + q) % 2:
	ans = 0
else:
	ans = float(math.factorial(q) / (math.factorial(ones) * math.factorial(q - ones)))
	ans /= pow(2, q)
print(f'{ans:.9f}')


a = input().replace('', ' ').split()
b = input().replace('', ' ').split()
p = 0
c = 0
o = a.copy()
for i in a:
	if i in b:
		o.remove(i)
		b.remove(i)
s = o.count('+') - o.count('-')
if len(b) == 0:
	print(1)
	exit()
if '-' in b or '+' in b:
	exit(print(0))
for i in range(2 ** len(o)):
	z = bin(i)[2:]
	s1 = 0
	z = '0' * (len(o) - len(z)) + z
	for i in z:
		if i == '0':
			s1 += 1
		else:
			s1 -= 1
	if s != s1:
		c += 1
if c == 0:
	print('0.000000')
else:
	print(1 - c / 2 ** len(o))


import math
s = input()
s2 = input()
plus_of_the_first_line = s.count('+')
minus_of_the_first_line = s.count('-')
plus_of_the_second_line = s2.count('+')
minus_of_the_second_line = s2.count('-')
if plus_of_the_first_line == plus_of_the_second_line and minus_of_the_first_line == minus_of_the_second_line:
	print(1)
elif plus_of_the_first_line < plus_of_the_second_line or minus_of_the_first_line < minus_of_the_second_line:
	print(0)
else:
	num_of_questions = s2.count('?')
	diff = plus_of_the_first_line - plus_of_the_second_line
	combination = math.factorial(num_of_questions) // (math.factorial(diff) * math.factorial(num_of_questions - diff))
	print(combination / pow(2, num_of_questions))


from math import factorial
s1 = input()
s2 = input()
(cnt_plus_1, cnt_plus_2) = (0, 0)
(cnt_minus_1, cnt_minus_2) = (0, 0)
cnt_question = 0
for i in range(len(s1)):
	if s1[i] == '+':
		cnt_plus_1 += 1
	if s1[i] == '-':
		cnt_minus_1 += 1
	if s2[i] == '+':
		cnt_plus_2 += 1
	if s2[i] == '-':
		cnt_minus_2 += 1
	if s2[i] == '?':
		cnt_question += 1
if cnt_question == 0:
	if cnt_plus_1 == cnt_plus_2:
		print('{:.9f}'.format(1.0))
	else:
		print('{:.9f}'.format(0.0))
elif cnt_plus_2 + cnt_question < cnt_plus_1 or cnt_plus_2 > cnt_plus_1:
	print('{:.9f}'.format(0.0))
else:
	dP = cnt_plus_1 - cnt_plus_2
	dM = cnt_question - dP
	if dM == 0 or dP == 0:
		print('{:0.9f}'.format(1 / 2 ** cnt_question))
	else:
		CP = factorial(cnt_question) / (factorial(dP) * factorial(cnt_question - dP))
		print(CP * 0.5 ** dP * (1 - 0.5) ** (cnt_question - dP))


line1 = str(input())
line2 = str(input())
truePosition = 0
fakePosition = 0
questionMarks = 0
for i in range(len(line1)):
	if line1[i] == '+':
		truePosition += 1
	if line1[i] == '-':
		truePosition -= 1
	if line2[i] == '+':
		fakePosition += 1
	if line2[i] == '-':
		fakePosition -= 1
	if line2[i] == '?':
		questionMarks += 1
distanceToMove = abs(truePosition - fakePosition)

def factorial(x):
	if x == 0:
		return 1
	else:
		return x * factorial(x - 1)

def probToMove(dist, questionMarks):
	if dist > questionMarks:
		return float(0)
	reducedDist = questionMarks - dist
	if reducedDist % 2 != 0:
		return float(0)
	dist = reducedDist // 2 + dist
	headsFlips = 1
	headsOrders = factorial(questionMarks) / (factorial(dist) * factorial(questionMarks - dist))
	totalPossibilities = 2 ** questionMarks
	return headsFlips * headsOrders / totalPossibilities
print(probToMove(distanceToMove, questionMarks))


from math import factorial

def arr(q, w):
	nu = factorial(q)
	de = factorial(w)
	de = factorial(q - w) * de
	return nu / de
a = input()
b = input()
s = 0
d = 0
a = list(a)
for c in a:
	if c == '+':
		s = s + 1
	else:
		s = s - 1
p = 0
b = list(b)
for c in b:
	if c == '+':
		d = d + 1
	elif c == '-':
		d = d - 1
	else:
		p = p + 1
re = abs(s - d)
p1 = p
if re > p1:
	ans = 0.0
else:
	if re != 0:
		while True:
			if p != re:
				p = p - 2
			else:
				break
			if p < re:
				ans = 0.0
				break
	if re == 0:
		re = p // 2
		np = re
	else:
		np = (p1 - p) // 2 + re
	now = arr(p1, np)
	ans = pow(0.5, p1)
	ans = ans * now
print('{0:.16f}'.format(ans))


from math import factorial
a = list(input())
b = list(input())
p = a.count('+') - b.count('+')
m = a.count('-') - b.count('-')
if m < 0 or p < 0:
	print(0)
	exit(0)
i = factorial(p + m) / (factorial(p) * factorial(m))
print(i / 2 ** (p + m))


import math
send = input()
rcv = input()
d = {}
d['+'] = 0
d['-'] = 0
for i in range(len(send)):
	d[send[i]] = d[send[i]] + 1
flag = 1
c = 0
for i in range(len(rcv)):
	if rcv[i] in d:
		if d[rcv[i]] == 0:
			flag = 0
		else:
			d[rcv[i]] = d[rcv[i]] - 1
tot = d['+'] + d['-']
totComb = 2 ** tot
n = tot
r = d['+']
npr = math.factorial(n) / math.factorial(n - r)
reqComb = npr / math.factorial(r)
if flag == 0:
	print('0.00000000')
else:
	print(float(reqComb) / totComb)


from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
fact = [1]
for i in range(1, 11):
	fact.append(i * fact[i - 1])

def ncr(n, r):
	return fact[n] // (fact[r] * fact[n - r])

def main():
	s1 = si()
	s2 = si()
	k = 0
	c = 0
	for i in s1:
		if i == '+':
			k += 1
		else:
			k -= 1
	for i in s2:
		if i == '?':
			c += 1
		elif i == '+':
			k -= 1
		else:
			k += 1
	k = abs(k)
	if c == k and c == 0:
		print('1.0000000000000')
	elif k > c:
		print('0.0000000000000000')
	else:
		m = pow(2, c)
		n1 = 0
		for i in range(c):
			x = i
			y = c - i
			if abs(x - y) == k:
				n1 += ncr(c, i)
				break
		n1 /= m
		print('%0.12f' % n1)
main()


from math import factorial as f
s1 = input()
s2 = input()
final = 0
for i in range(len(s1)):
	if s1[i] == '+':
		final += 1
	else:
		final -= 1
unknown = 0
for i in range(len(s2)):
	if s2[i] == '?':
		unknown += 1
	elif s2[i] == '+':
		final -= 1
	else:
		final += 1
if unknown == 0:
	if final == 0:
		print(1)
		exit()
	else:
		print(0)
		exit()
if abs(final) > abs(unknown):
	print(0)
	exit()
if (unknown + final) % 2 != 0:
	print(0)
	exit()
plus = (unknown + final) / 2
minus = unknown - plus
x = f(unknown) / (f(plus) * f(minus))
y = 2 ** unknown
print(x / y)


s1 = input()
s2 = input()
vals = {'+': [1], '-': [-1], '?': [1, -1]}
dest = sum([1 for x in s1 if x == '+']) - sum([1 for y in s1 if y == '-'])
lis = vals[s2[0]]
for c in s2[1:]:
	tmp = [x + y for x in lis for y in vals[c]]
	lis = tmp
freq = sum([1 for x in lis if x == dest])
print('%.12f' % (freq / len(lis)))


s = []
s.append(input())
s.append(input())
ep = s[0].count('+') - s[0].count('-')
b = s[1].count('+') - s[1].count('-')
uc = s[1].count('?')
p = []
for i in range(int(2 ** uc)):
	bi = '{:0{}b}'.format(i, uc)
	p.append(b + bi.count('1') - bi.count('0'))
c = 0
for e in p:
	if e == ep:
		c += 1
print('{:.12f}'.format(0.5 ** uc * c if uc > 0 else 1.0 if ep == b else 0.0))


def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
s = input()
t = input()
a = s.count('+')
b = s.count('-')
c = t.count('?')
d = t.count('+')
e = t.count('-')
facts = [1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800]
if c == 0:
	if a == d and e == b:
		print('1.0')
	else:
		print('0.0')
elif e > b or d > a:
	print('0.0')
else:
	r_p = min(a - d, b - e)
	r = nCr(c, r_p) / 2 ** c
	print(r)


def verifica(valorAtual, nInter, pos):
	global ans
	v1 = valorAtual + 1
	v2 = valorAtual - 1
	nInter -= 1
	if (v1 == pos or v2 == pos) and nInter == 0:
		ans += 1
		return True
	if nInter == 0:
		return False
	e1 = verifica(v1, nInter, pos)
	e2 = verifica(v2, nInter, pos)
	if e1 or e2:
		return True
	return False
original = input()
received = input()
pos = 0
for e in original:
	if e == '+':
		pos += 1
	else:
		pos -= 1
pos2 = 0
nIntr = 0
for e in received:
	if e == '+':
		pos2 += 1
	elif e == '-':
		pos2 -= 1
	elif e == '?':
		nIntr += 1
ans = 0
if nIntr == 0:
	if pos == pos2:
		print('%.12f' % 1)
	else:
		print('%.12f' % 0)
elif verifica(pos2, nIntr, pos):
	ansFinal = 0.5 ** nIntr * ans
	print('%.12f' % ansFinal)
else:
	print('%.12f' % 0)


def val(s):
	count = 0
	for c in s:
		if c == '+':
			count += 1
		else:
			count -= 1
	return count
s1 = input()
s2 = input()
v = val(s1)
p = []
n = len(s2)
m = 0
for i in range(n):
	if s2[i] == '?':
		m += 1
		p.append(i)
count = 0
for i in range(1 << m):
	s3 = list(s2)
	for j in range(m):
		if i & 1 << j:
			s3[p[j]] = '+'
		else:
			s3[p[j]] = '-'
	if val(s3) == v:
		count += 1
print(f'{count / (1 << m):.9f}')


from math import factorial as fac

def ncr(n, r):
	res = fac(n) / (fac(n - r) * fac(r))
	return res
s1 = input()
s2 = input()
plusSent = 0
minusSent = 0
plusRe = 0
minusRe = 0
qNum = 0
for i in range(len(s1)):
	if s1[i] == '+':
		plusSent += 1
	if s2[i] == '+':
		plusRe += 1
	elif s2[i] == '?':
		qNum += 1
minusSent = len(s1) - plusSent
minusRe = len(s2) - plusRe - qNum
plusNeed = plusSent - plusRe
minusNeed = minusSent - minusRe
res = float(0)
if minusNeed >= 0 and plusNeed >= 0:
	res = ncr(qNum, plusNeed) * 0.5 ** qNum
elif minusNeed == 0 and plusNeed == 0:
	res = 1
elif minusNeed < 0 or plusNeed < 0:
	res = 0
print(res)


import sys, collections
input = sys.stdin.readline

def dfs(i, y):
	if i == len(b):
		ans.append(y)
		return
	if b[i] == '+':
		dfs(i + 1, y + 1)
	elif b[i] == '-':
		dfs(i + 1, y - 1)
	else:
		dfs(i + 1, y + 1)
		dfs(i + 1, y - 1)
a = list(map(str, input().rstrip()))
b = list(map(str, input().rstrip()))
ans = []
asum = 0
for x in a:
	if x == '+':
		asum += 1
	else:
		asum -= 1
dfs(0, 0)
print(ans.count(asum) / len(ans))


intended = 0
ops = input()
for op in ops:
	if op == '+':
		intended += 1
	else:
		intended -= 1
p = {0: 1}
ops = input()
for op in ops:
	q = {}
	if op == '+':
		for (poz, prob) in p.items():
			q[poz + 1] = prob
	elif op == '-':
		for (poz, prob) in p.items():
			q[poz - 1] = prob
	else:
		for (poz, prob) in p.items():
			q[poz - 1] = 0
			q[poz + 1] = 0
		for (poz, prob) in p.items():
			q[poz - 1] += prob / 2
			q[poz + 1] += prob / 2
	p = q
print(p.get(intended, 0))


from math import factorial as f
import atexit
import io
import sys
from collections import deque
sys.setrecursionlimit(123456)
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	s1 = input()
	s2 = input()
	plus1 = s1.count('+')
	minu1 = s1.count('-')
	plus2 = s2.count('+')
	minu2 = s2.count('-')
	que2 = s2.count('?')
	for i in range(0, que2 + 1):
		if plus1 == plus2 + i and minu1 == minu2 + (que2 - i):
			print(f(que2) / (f(i) * f(que2 - i)) * (1 / 2) ** que2)
			exit(0)
	print(0.0)
main()


def comb(N, k):
	if k > N or N < 0 or k < 0:
		return 0
	(N, k) = map(int, (N, k))
	top = N
	val = 1
	while top > N - k:
		val *= top
		top -= 1
	n = 1
	while n < k + 1:
		val /= n
		n += 1
	return val
s = input()
p = 0
m = 0
for c in s:
	if c == '+':
		p += 1
	else:
		m += 1
s = input()
u = 0
for c in s:
	if c == '+':
		p -= 1
	elif c == '-':
		pass
	else:
		u += 1
print(comb(u, p) / 2 ** u)


t = input()
y = input()
sent = []
rec = []
lg = len(t)
for i in range(lg):
	sent.append(t[i])
	rec.append(y[i])
poz_sent = 10
poz_prob = [0.0 for i in range(-10, 11)]
poz_prob[poz_sent] = 1

def move(x, pp):
	prob = [0.0 for i in range(-10, 11)]
	for j in range(0, 21):
		if pp[j] > 0:
			prob[j + x] += pp[j]
	return prob

def prob_move(pp):
	prob = [0.0 for i in range(-10, 11)]
	for j in range(0, 21):
		if pp[j] > 0:
			prob[j + 1] += pp[j] * 0.5
			prob[j - 1] += pp[j] * 0.5
	return prob
for i in range(lg):
	if sent[i] == '+':
		poz_sent += 1
	else:
		poz_sent -= 1
	if rec[i] == '+':
		poz_prob = move(1, poz_prob)
	elif rec[i] == '-':
		poz_prob = move(-1, poz_prob)
	else:
		poz_prob = prob_move(poz_prob)
print(poz_prob[poz_sent])


import math
s1 = list(input())
s2 = list(input())
a = s1.count('+')
b = s1.count('-')
c = s2.count('+')
d = s2.count('-')
e = s2.count('?')
if e == 0 and (a == c and b == d):
	print(1)
elif a < c or b < d:
	print(0)
else:
	w = math.factorial(e)
	x = math.factorial(a - c)
	y = math.factorial(e - (a - c))
	print(w / (x * y) * 0.5 ** (a - c) * 0.5 ** (b - d))


s1 = input()
s2 = input()
objetivo = s1.count('+') - s1.count('-')
inicio = s2.count('+') - s2.count('-')
incognitos = s2.count('?')
distancia = objetivo - inicio

def factorial(n):
	total = 1
	for i in range(int(n)):
		total *= i + 1
	return total
if abs(distancia) > incognitos or distancia % 2 != incognitos % 2:
	print(0)
else:
	mas = (distancia + incognitos) / 2
	menos = (incognitos - distancia) / 2
	print(factorial(incognitos) / (factorial(mas) * factorial(menos)) / 2 ** incognitos)


import math
a = list(input())
b = list(input())
c = a.count('+') - b.count('+')
d = a.count('-') - b.count('-')
if d < 0 or c < 0:
	print(0)
	exit(0)
f = math.factorial(c + d) / (math.factorial(c) * math.factorial(d))
print(f * 0.5 ** (c + d))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] <= val:
			ans = mid + 1
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def odd(n, ans, s):
	if n % 2 != 0 or n in s:
		return ans
	else:
		s.add(n)
		return odd(n // 2, ans + 1, s)

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)
s1 = str(stdin.readline())
s2 = str(stdin.readline())
c1 = 0
c2 = 0
c11 = 0
c12 = 0
c13 = 0
for i in range(len(s1)):
	if s1[i:i + 1] == '+':
		c1 += 1
	elif s1[i:i + 1] == '-':
		c2 += 1
	if s2[i:i + 1] == '+':
		c11 += 1
	elif s2[i:i + 1] == '-':
		c12 += 1
	elif s2[i:i + 1] == '?':
		c13 += 1
if c13 == 0:
	if c11 == c1 and c12 == c2:
		print(len(s1) / len(s1))
	else:
		print(0 / len(s1))
elif c11 > c1 or c12 > c2:
	print(0 / len(s1))
else:
	v1 = c1 - c11
	v2 = c2 - c12
	vv1 = fact(v1)
	vv2 = fact(v2)
	vv3 = fact(v1 + v2)
	ans1 = vv3 / (vv1 * vv2)
	print(ans1 / 2 ** c13)


import sys
input = sys.stdin.readline
p = input().rstrip()
t = input().rstrip()
from collections import Counter
from math import factorial
counts = Counter(p)
cur = Counter(t)

def nCk(n, k):
	return factorial(n) / (factorial(k) * factorial(n - k))

def valid(counts, cur):
	return cur['+'] <= counts['+'] and cur['-'] <= counts['-']
	q = cur['?'] if '?' in cur else 0
	if cur['1'] <= counts['1'] and cur['2'] <= counts['2']:
		return counts['1'] - cur['1'] + counts['2'] - cur['2'] == q
	else:
		return False
if not valid(counts, cur):
	print(float(0))
elif cur['?'] == 0:
	print(float(1) if counts == cur else float(0))
else:
	print(float(nCk(cur['?'], counts['-'] - cur['-']) / 2 ** cur['?']))


from math import log2
s1 = input()
s2 = input()
n = len(s1)
dp = [[0] * (n + 1) for i in range(n + 1)]
dp[0][0] = 1
direction = {'+': [0, 1], '-': [1, 0]}
for row in range(n):
	for col in range(n):
		index = row + col
		if dp[row][col] != 0 and index < n:
			if s2[index] == '+':
				dp[row][col + 1] += dp[row][col]
			elif s2[index] == '-':
				dp[row + 1][col] += dp[row][col]
			else:
				dp[row + 1][col] += dp[row][col] / 2
				dp[row][col + 1] += dp[row][col] / 2
frow = 0
fcol = 0
for c in s1:
	frow += int(c == '-')
	fcol += int(c == '+')
print(dp[frow][fcol])


s1 = input()
s2 = input()
fp = 0
pp = 0
c = 0
for i in range(len(s1)):
	if s1[i] == '+':
		fp += 1
	elif s1[i] == '-':
		fp -= 1
	else:
		c += 1
	if s2[i] == '+':
		fp -= 1
	elif s2[i] == '-':
		fp += 1
	else:
		c += 1
fp = (abs(fp) + c) // 2
if fp > c:
	print('0.000000000')
	exit(0)
prob = 1
for i in range(1, fp + 1):
	prob *= (c - i + 1) / i
while c > 0:
	c -= 1
	prob /= 2
print(prob)


def main():
	from sys import stdin, stdout
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	apc = 0
	anc = 0
	bpc = 0
	bnc = 0
	bqc = 0
	for i in a:
		if i == '+':
			apc += 1
		elif i == '-':
			anc += 1
	for i in b:
		if i == '+':
			bpc += 1
		elif i == '-':
			bnc += 1
		else:
			bqc += 1
	if apc == bpc and anc == bnc and (bqc == 0):
		p = 1
	elif bpc > apc or bnc > anc or len(a) != len(b):
		p = 0
	else:
		denom = 1 << bqc
		numer = 1
		maxim = max(apc - bpc, anc - bnc)
		minim = min(apc - bpc, anc - bnc)
		while bqc > maxim:
			numer *= bqc
			bqc -= 1
		if minim > 1:
			k = minim
			while minim >= 2:
				k *= minim - 1
				minim -= 1
			numer /= k
		p = numer / denom
	stdout.write('{:.12f}'.format(p))
main()


s = list(input().strip())
t = list(input().strip())
n = len(s)
unknowns = []
for i in range(n):
	if t[i] == '?':
		unknowns.append(i)
s_position = s.count('+') - s.count('-')
t_position = t.count('+') - t.count('-')
ways = 0
total = 0
unknown_count = len(unknowns)
for i in range(1 << unknown_count):
	unknown_position = 0
	for j in range(unknown_count):
		if i & 1 << j > 0:
			unknown_position += 1
		else:
			unknown_position -= 1
	if s_position == t_position + unknown_position:
		ways += 1
	total += 1
if total == 0:
	if s_position == t_position:
		ways = 1
		total = 1
	else:
		ways = 0
		total = 1
probability = '%0.10f' % (ways / total)
print(probability)


import math
a = input()
b = input()
x1 = a.count('+')
y1 = a.count('-')
x2 = b.count('+')
y2 = b.count('-')
l = b.count('?')
if l == 0 and (x1 == x2 and y1 == y2):
	print(float(1))
elif x1 > x2 + l or y1 > y2 + l:
	print(float(0))
else:
	w = math.factorial(l)
	m = math.factorial(x1 - x2)
	n = math.factorial(l - (x1 - x2))
	print(w / (m * n) / 2 ** (x1 + y1 - x2 - y2))


import itertools
ind = {'+': 1, '-': -1}

def map_func(a):
	ind2 = ind
	return ind2.get(a, a)
li = sum(map(lambda a: 1 if a == '+' else -1, input()))
li2 = list(map(map_func, input()))
try:
	index = li2.index('?')
	ans_li21 = list(filter(lambda x: x != '?', li2))
	ans_li2 = sum(ans_li21)
	iterations = len(li2) - len(ans_li21)
	liz = [ans_li2]
	li2 = []
	for i in range(iterations):
		while liz:
			num = liz.pop()
			li2.extend((num + 1, num - 1))
		liz = li2
		li2 = []
	print('{:.12f}'.format(len(list(filter(lambda x: x == li, liz))) / len(liz)))
except ValueError:
	if sum(li2) == li:
		print('{:.12f}'.format(float(1)))
	else:
		print('{:.12f}'.format(0.0))


def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
a = input()
b = input()
c1 = 0
c2 = 0
c3 = 0
for i in a:
	if i == '+':
		c1 += 1
	elif i == '-':
		c1 -= 1
for i in b:
	if i == '+':
		c2 += 1
	elif i == '?':
		c3 += 1
	elif i == '-':
		c2 -= 1
cx = c1 - c2
p = (cx + c3) // 2
p1 = c3 - p
if p < 0 or p1 < 0:
	print('0.00000000000')
else:
	print(nCr(c3, p) / 2 ** c3)


def walk(s):
	res = 0
	for c in s:
		if c == '+':
			res += 1
		else:
			res -= 1
	return res
base = input()
got = input()
tr = walk(base)
ans = 0
n = got.count('?')
for i in range(1 << n):
	idx = 0
	new_got = []
	for j in range(len(got)):
		if got[j] == '?':
			new_got.append('+' if 1 << idx & i else '-')
			idx += 1
		else:
			new_got.append(got[j])
	ans += walk(new_got) == tr
print('{:.15f}'.format(ans / (1 << n)))


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
s1 = list(input())
s2 = list(input())
v = s2.count('?')
ans = 0
for i in range(2 ** v):
	b = bin(i)[2:].zfill(v)
	t = s2.copy()
	k = 0
	for j in range(len(s2)):
		if t[j] == '?':
			t[j] = int(b[k]) * '+' + (1 - int(b[k])) * '-'
			k += 1
	if s1.count('+') == t.count('+') and s1.count('-') == t.count('-'):
		ans += 1
print(ans / 2 ** v)


(pd, pr) = (0, 0)
interro = 0
dem = input()
rec = input()
for k in dem:
	if k == '+':
		pd += 1
for k in rec:
	if k == '+':
		pr += 1
	if k == '?':
		interro += 1
posdem = pd
posree = pr

def bin(n, k):
	if k == 0:
		return 1
	elif n == 0:
		return 0
	else:
		return bin(n - 1, k) + bin(n - 1, k - 1)
res = bin(interro, posdem - posree) * (1 / 2) ** interro
print('{0:.9f}'.format(res))


def C(n, m):
	v1 = 1
	v2 = 1
	for i in range(n, m):
		v1 = v1 * i
		v2 = v2 * (m - i)
	v1 = v1 * m
	v1 = v1 / n
	return v1 / v2
s1 = input()
s2 = input()
num11 = s1.count('+')
num12 = s1.count('-')
num21 = s2.count('+')
num22 = s2.count('-')
num23 = s2.count('?')
if num11 < num21 or num12 < num22:
	print('%.9f' % 0)
elif num11 == num21 and num12 == num22:
	print('%.9f' % 1)
else:
	d1 = num11 - num21
	d2 = num12 - num22
	n = 1
	p = 1
	if d1 == 0:
		print('%.9f' % (C(d2, num23) * 0.5 ** d2))
	elif d2 == 0:
		print('%.9f' % (C(d1, num23) * 0.5 ** d1))
	else:
		print('%.9f' % (0.5 ** d1 * C(d1, num23) * 0.5 ** d2))


import math

def main():
	s1 = input()
	s2 = input()
	d1 = s1.count('+') - s1.count('-')
	d2 = s2.count('+') - s2.count('-')
	d = d1 - d2
	n = s2.count('?')
	if (n + d) % 2 != 0:
		return 0.0
	k = (n + d) // 2
	if k < 0 or k > n:
		return 0.0
	c = math.factorial(n) // (math.factorial(k) * math.factorial(n - k))
	return c / 2 ** n
print(main())


import math

def C(n, m):
	return math.factorial(n) / math.factorial(m) / math.factorial(n - m)
ins = input()
ges = input()
(dst, hpn, qst) = (0, 0, 0)
for i in range(len(ins)):
	dst += 44 - ord(ins[i])
	if ges[i] != '?':
		hpn += 44 - ord(ges[i])
	else:
		qst += 1
if abs(dst - hpn) > qst or (abs(dst - hpn) + qst) % 2 != 0:
	print(0)
else:
	print('%.9f' % (C(qst, (abs(dst - hpn) + qst) // 2) / 2 ** qst))


import math
s1 = input()
s2 = input()
cs1 = 0
cs2 = 0
cs2i = 0
for x in range(int(len(s1))):
	if s1[x] == '+':
		cs1 = cs1 + 1
	if s2[x] == '+':
		cs2 = cs2 + 1
	if s1[x] == '-':
		cs1 = cs1 - 1
	if s2[x] == '-':
		cs2 = cs2 - 1
	if s2[x] == '?':
		cs2i = cs2i + 1
dist = abs(cs1 - cs2)
if dist > cs2i:
	print('%.12f' % 0)
else:
	resp = pow(0.5, cs2i) * math.factorial(cs2i) / (math.factorial((cs2i - dist) / 2 + dist) * math.factorial((cs2i - dist) / 2))
	print('%.12f' % resp)


import math
s1 = input()
s2 = input()
if s2.count('?') == 0:
	if s1.count('+') == s2.count('+') and s1.count('-') == s2.count('-'):
		p = 1
	else:
		p = 0
elif s1.count('+') < s2.count('+') != 0 or s1.count('-') == 0 < s2.count('-') != 0:
	p = 0
else:
	pl = s1.count('+') - s2.count('+')
	mi = s1.count('-') - s2.count('-')
	p = math.factorial(pl + mi) / math.factorial(pl) / math.factorial(mi) / 2 ** (pl + mi)
print('%1.9f' % p)


def fac(n):
	ret = 1
	for i in range(2, n):
		ret *= i
	return ret

def C(n, k):
	return fac(n) // fac(k) // fac(n - k)

def transform(s):
	res = 0
	for c in s:
		if c == '0':
			res += 1
		else:
			res -= 1
	return res
s1 = input().strip()
s2 = input().strip()
dx = sum([1 if c == '+' else -1 for c in s1])
u = 0
dx2 = 0
for c in s2:
	if c == '?':
		u += 1
	else:
		dx2 += 1 if c == '+' else -1
if u == 0:
	if dx == dx2:
		print(1)
	else:
		print(0)
elif abs(dx - dx2) > u:
	print(0)
else:
	d = abs(dx - dx2)
	well = 0
	for i in range(1 << u):
		if transform(bin(i)[2:].rjust(u, '0')) == d:
			well += 1
	print(well / (1 << u))


def fac(n):
	return 1 if n < 2 else fac(n - 1) * n
s1 = input()
s2 = input()
pos = sum((1 if c == '+' else -1 for c in s1))
posact = sum((1 if c == '+' else -1 for c in s2 if c != '?'))
numq = sum((1 for c in s2 if c == '?'))
diff = abs(pos - posact)
if diff > numq or (numq - diff) % 2 == 1:
	print(0.0)
	exit(0)
fixed = diff + (numq - diff) // 2
print(fac(numq) / fac(fixed) / fac(numq - fixed) / 2 ** numq)


import math
desired_input = input()
recieved_input = input()
desired_score = desired_input.count('+') - desired_input.count('-')
recieved_score = recieved_input.count('+') - recieved_input.count('-')
somethings = recieved_input.count('?')
num_plus_needed = (desired_score - recieved_score - somethings) / -2
if num_plus_needed > somethings or num_plus_needed < 0:
	print(0)
else:
	num_combinations = math.factorial(somethings) / (math.factorial(somethings - num_plus_needed) * math.factorial(num_plus_needed))
	total_combinations = math.pow(2, somethings)
	print(num_combinations / total_combinations)


d = input()
f = input()
c1 = d.count('+')
c2 = d.count('-')
c3 = f.count('+')
c4 = f.count('-')
c5 = f.count('?')

def fun(g, o, k):
	fact = 1
	fact1 = 1
	fact2 = 1
	for i in range(1, k + 1):
		fact = fact * i
	for i in range(1, g + 1):
		fact1 = fact1 * i
	for i in range(1, o + 1):
		fact2 = fact2 * i
	p = fact / (fact1 * fact2)
	return p
if c1 - c3 >= 0 and c2 - c4 >= 0:
	if c5 == c1 - c3 + c2 - c4:
		k = 2 ** c5
		p = fun(c1 - c3, c2 - c4, c5)
		l = p / k
		print(l)
	else:
		print(0)
else:
	print(0)


caminos = []
acciones = [1, -1]

def encontrar_caminos(camino_original, camino_actual, idx_actual):
	if idx_actual == len(camino_original):
		global caminos
		caminos.append(camino_actual.copy())
	elif camino_original[idx_actual] == 0:
		global acciones
		for accion in acciones:
			camino_actual[idx_actual] = accion
			encontrar_caminos(camino_original, camino_actual, idx_actual + 1)
	else:
		encontrar_caminos(camino_original, camino_actual, idx_actual + 1)

def str2num(camino_str):
	camino = []
	for char in camino_str:
		if char == '+':
			camino.append(1)
		elif char == '-':
			camino.append(-1)
		else:
			camino.append(0)
	return camino
camino_deseado = input()
camino_recibido = input()
camino_deseado = str2num(camino_deseado)
camino_recibido = str2num(camino_recibido)
encontrar_caminos(camino_recibido, camino_recibido.copy(), 0)
final_deseado = sum(camino_deseado)
finales_posibles = 0
for camino in caminos:
	if sum(camino) == final_deseado:
		finales_posibles += 1
print(finales_posibles / len(caminos))


(original, received) = (input(), input())
dest = original.count('+') - original.count('-')
known = received.count('+') - received.count('-')
unknown = received.count('?')
opts = [0] * 21
for i in range(2 ** unknown):
	v = 0
	for _ in range(unknown):
		v += 1 if i & 1 else -1
		i >>= 1
	opts[v + known] += 1
print(opts[dest] / 2 ** unknown)


import math

def factorial(num):
	if num == 1:
		return num
	else:
		return num * factorial(num - 1)
s1 = input()
s2 = input()
ans = 0
for i in range(0, len(s1)):
	if s1[i] == '+':
		ans += 1
	else:
		ans -= 1
t = 0
qm = 0
for i in range(0, len(s2)):
	if s2[i] == '+':
		t += 1
	elif s2[i] == '-':
		t -= 1
	else:
		qm += 1
if qm == 0:
	if ans == t:
		print(1.0)
	else:
		print(0.0)
else:
	k = ans - t
	if abs(k) == qm:
		na = 1 / pow(2, qm)
		print(na)
	elif abs(k) > qm:
		print(0.0)
	elif k % 2 == 0 and qm % 2 == 1:
		print(0.0)
	elif k % 2 == 1 and qm % 2 == 0:
		print(0.0)
	else:
		a = abs((qm + k) / 2)
		b = abs((qm - k) / 2)
		nu = factorial(qm) / (factorial(a) * factorial(b))
		ans = nu / pow(2, qm)
		print(ans)


a = input()
import math
b = input()
x = a.count('+')
y = a.count('-')
z = b.count('+')
r = b.count('-')
l = b.count('?')
if l == 0 and (x == z and y == r):
	print(1)
elif x > z + l or y > r + l:
	print(0)
else:
	w = math.factorial(l)
	m = math.factorial(x - z)
	n = math.factorial(l - (x - z))
	print(w / (m * n) * 0.5 ** (x - z) * 0.5 ** (y - r))


fact = [0] * 12
fact[0] = 1
fact[1] = 1
for i in range(2, 12):
	fact[i] = i * fact[i - 1]
s1 = input()
s2 = input()
np = s1.count('+') - s2.count('+')
nm = s1.count('-') - s2.count('-')
nims = s2.count('?')
if np < 0 or nm < 0:
	print(0)
else:
	print(fact[nims] / (fact[np] * fact[nm]) / 2 ** nims)


s1 = input()
s2 = input()

def f(x):
	if x == 0:
		return 1
	return x * f(x - 1)
p = s1.count('+') - s2.count('+')
m = s1.count('-') - s2.count('-')
q = s2.count('?')
if p < 0 or m < 0:
	print(0)
else:
	print(f(q) / f(p) / f(m) / 2 ** q)


def rec(su, k):
	global co
	if k == n:
		if su == x:
			co += 1
		return
	elif t[k] == '+':
		rec(su + 1, k + 1)
	elif t[k] == '-':
		rec(su - 1, k + 1)
	else:
		rec(su + 1, k + 1)
		rec(su - 1, k + 1)
s = input()
t = input()
x = 0
n = len(s)
for i in range(n):
	if s[i] == '+':
		x += 1
	else:
		x -= 1
c = 0
for i in range(n):
	if t[i] == '?':
		c += 1
global co
co = 0
rec(0, 0)
print(co / 2 ** c)


from math import factorial as f

def ncr(n, r):
	if n < r:
		return 0
	return f(n) // (f(n - r) * f(r))
s1 = input()
s2 = input()
cnt1 = cnt2 = cnt3 = 0
for i in s1:
	if i == '+':
		cnt1 += 1
	else:
		cnt1 -= 1
for i in s2:
	if i == '+':
		cnt2 += 1
	elif i == '-':
		cnt2 -= 1
	else:
		cnt3 += 1
nd = abs(cnt2 - cnt1)
x = (nd + cnt3) / 2
if x != int(x):
	print(0)
else:
	print(ncr(cnt3, x) / (1 << cnt3))


import math
from math import factorial

def combination(n, r):
	return float(factorial(n)) / float(factorial(r)) / float(factorial(n - r))
a = input()
ap = a.count('+')
am = a.count('-')
b = input()
bp = b.count('+')
bm = b.count('-')
n = b.count('?')
x = float(ap - bp)
y = float(am - bm)
if x < 0 or y < 0 or x + y != n:
	print(0.0)
else:
	print(combination(n, x) / (1 << n))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
r = input()
s = input()
p1 = 0
for i in r:
	if i == '+':
		p1 += 1
	else:
		p1 -= 1
am = 0
p2 = 0
for i in s:
	if i == '+':
		p2 += 1
	elif i == '-':
		p2 -= 1
	else:
		am += 1
tot = pow(2, am)
fav = 0
for i in range(am + 1):
	copy = p2
	copy += i
	copy -= am - i
	if copy == p1:
		f = math.factorial(am) // math.factorial(am - i) // math.factorial(i)
		fav += f
r = fav / tot
print(r)


from math import factorial as fact
s = input()
t = input()
pos = s.count('+') - t.count('+')
neg = s.count('-') - t.count('-')
que = t.count('?')
if pos < 0 or neg < 0:
	print(0)
else:
	print(fact(que) / (fact(pos) * fact(neg)) / 2 ** que)


import math

def nCr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
real = list(input())
expect = list(input())
real_pluses = len(list(filter(lambda x: x == '+', real)))
real_minuses = len(list(filter(lambda x: x == '-', real)))
fake_pluses = len(list(filter(lambda x: x == '+', expect)))
fake_minuses = len(list(filter(lambda x: x == '-', expect)))
fake_questions = len(list(filter(lambda x: x == '?', expect)))
if fake_pluses > real_pluses or fake_minuses > real_minuses:
	print(0.0)
else:
	probability = pow(1 / 2, fake_questions)
	combinatoriks = nCr(fake_questions, real_pluses - fake_pluses)
	result = probability * combinatoriks
	print(result)


from math import fabs

def f(a):
	if not a:
		return 1
	else:
		return a * f(a - 1)
a = input()
b = input()
c = int(fabs(a.count('+') - a.count('-') - (b.count('+') - b.count('-'))))
d = b.count('?')
if d < c:
	print(0)
else:
	print(f(d) / f((c + d) // 2) / f((d - c) // 2) / 2 ** d)


from math import factorial
n1 = input()
n2 = input()
n1p = 0
n1m = 0
for i in n1:
	if i == '+':
		n1p += 1
	else:
		n1m += 1
n2p = 0
n2m = 0
n2s = 0
for i in n2:
	if i == '+':
		n2p += 1
	elif i == '-':
		n2m += 1
	else:
		n2s += 1
if n2s != 0:
	if n2p <= n1p and n2m <= n1m:
		print(str(factorial(n2s) / (factorial(n2s - (n1p - n2p)) * factorial(n1p - n2p)) / 2 ** n2s) + '0000000000')
	else:
		print('0.000000000000')
elif n2p == n1p and n2m == n1m:
	print('1.00000000000000')
else:
	print('0.0000000000000')


a = input()
b = input()
x = 0
y = 0
z = 0
for i in range(len(a)):
	if a[i] == '+':
		x += 1
	else:
		y += 1
	if b[i] == '+':
		x -= 1
	elif b[i] == '-':
		y -= 1
	else:
		z += 1
if x < 0 or y < 0:
	print(0)
elif x == 0 and y == 0:
	print(1)
elif x == 0 or y == 0:
	print(1 / 2 ** z)
else:
	import math
	a = math.factorial(x)
	b = math.factorial(y)
	c = math.factorial(z)
	d = 2 ** z
	print(c / (a * b * d))


import math
import sys
from collections import *
import itertools

def cint():
	return list(map(int, sys.stdin.readline().strip().split()))

def cstr():
	return list(map(str, input().split(' ')))

def solve(t):
	s = input()
	s2 = input()
	target = 0
	for i in s:
		if i == '+':
			target += 1
		else:
			target -= 1
	target2 = 0
	c = 0
	for i in s2:
		if i == '+':
			target2 += 1
		elif i == '-':
			target2 -= 1
		else:
			c += 1
	if c == 0:
		if target == target2:
			print(format(1.0, '.12f'))
		else:
			print(format(0.0, '.12f'))
		return
	diff = abs(target - target2)
	if diff > c:
		print(format(0.0, '.12f'))
	else:
		a = (diff + c) // 2
		comb = math.factorial(c) // (math.factorial(c - a) * math.factorial(a))
		print(format(comb / 2 ** c, '.12f'))
t = 1
for i in range(1, t + 1):
	solve(i)


from math import factorial as f
a = input()
b = input()
(p, m) = (a.count('+'), a.count('-'))
(p1, m1) = (b.count('+'), b.count('-'))
ct = b.count('?')
v = p - p1
v1 = m - m1
if v + v1 < ct or v < 0 or v1 < 0:
	print(0)
else:
	ans = f(ct) // (f(v) * f(v1)) / 2 ** ct
	print(ans)


import itertools

def countPlace(stringValue):
	place = stringValue.count('+') - stringValue.count('-')
	unknown = stringValue.count('?')
	return (place, unknown)

def printResult(value):
	print('{:.13f}'.format(float(value)))
targetString = input()
recivedString = input()
targetPlace = countPlace(targetString)[0]
(currentPlace, unknownCount) = countPlace(recivedString)
if 0 == unknownCount:
	if targetPlace == currentPlace:
		printResult(1.0)
	else:
		printResult(0.0)
else:
	array = ['-', '+']
	cominationsArray = list(itertools.product(array, repeat=unknownCount))
	rightPlaceCount = 0
	for value in cominationsArray:
		if currentPlace + countPlace(value)[0] == targetPlace:
			rightPlaceCount += 1
	printResult(float(rightPlaceCount) / float(len(cominationsArray)))


cnt = 0
val = 0
s1 = input()
s2 = input()

def solve(i, sm):
	global s2
	global val
	global cnt
	if i == len(s2):
		if sm == val:
			cnt += 1
		return
	if s2[i] == '+':
		solve(i + 1, sm + 1)
	elif s2[i] == '-':
		solve(i + 1, sm - 1)
	else:
		solve(i + 1, sm - 1)
		solve(i + 1, sm + 1)
for i in s1:
	if i == '+':
		val += 1
	else:
		val -= 1
qs = 0
for i in s2:
	if i == '?':
		qs += 1
solve(0, 0)
if qs == 0:
	v = 0
	for i in s2:
		if i == '+':
			v += 1
		else:
			v -= 1
	if v == val:
		print(1.0)
	else:
		print(0.0)
else:
	print(cnt / 2 ** qs)


def coff(n, k):
	c = [[0 for x in range(k + 1)] for x in range(n + 1)]
	for i in range(n + 1):
		for j in range(min(i, k) + 1):
			if j == 0 or j == i:
				c[i][j] = 1
			else:
				c[i][j] = c[i - 1][j - 1] + c[i - 1][j]
	return c[n][k]
s1 = input()
s2 = input()
p1 = 0
n1 = 0
for i in s1:
	if i == '+':
		p1 += 1
	else:
		n1 += 1
p2 = 0
n2 = 0
q = 0
for i in s2:
	if i == '+':
		p2 += 1
	elif i == '-':
		n2 += 1
	else:
		q += 1
if q == 0:
	if p1 == p2 and n1 == n2:
		print(round(1 / 1, 10))
	else:
		print(round(0 / 1, 10))
else:
	p = p1 - p2
	n = n1 - n2
	if p < 0 and n < 0:
		print(round(0 / 1, 10))
	elif p < 0 and n > 0:
		n += abs(p)
		if n != q:
			print(round(0 / 1, 10))
		else:
			print(round(1 / 2 ** n, 10))
	elif p > 0 and n < 0:
		p += abs(n)
		if p != q:
			print(round(0 / 1, 10))
		else:
			print(round(1 / 2 ** p, 10))
	elif p + n != q:
		print(round(0 / 1, 10))
	else:
		if p == 0:
			perm = 1
		elif n == 0:
			perm = 1
		else:
			perm = coff(q, p) * coff(q - p, n)
		print(round(perm / 2 ** q, 10))


ans = lambda s, d, t: sum((0.5 ** t for tr in range(2 ** t) if sum([2 * (tr >> i & 1) - 1 for i in range(t)]) + s == d))
mv = lambda st: sum(({'+': 1, '-': -1, '?': 0}[c] for c in st))
d = input()
s = input()
print(ans(mv(s), mv(d), s.count('?')))


s = input()
t = input()
a = 0
b = 0
c = 0
for i in range(len(s)):
	if s[i] == '+':
		a += 1
	else:
		a -= 1
for i in range(len(t)):
	if t[i] == '+':
		b += 1
	elif t[i] == '-':
		b -= 1
	else:
		c += 1
x = a - b
d = 0 - c
y = 0 - 1
for i in range(c + 1):
	if d == x:
		y = i
	d += 2

def fact(n):
	w = 1
	for i in range(n):
		w *= i + 1
	return w

def parmi(k, n):
	w = 1
	w *= fact(n)
	w //= fact(k)
	w //= fact(n - k)
	return w

def puiss(k, n):
	w = 1
	for i in range(n):
		w *= k
	return w
if y == -1:
	print(0.0)
else:
	print(parmi(y, c) / puiss(2, c))


s1 = input()
s2 = input()
actualPosition = 0
for i in s1:
	if i == '+':
		actualPosition += 1
	else:
		actualPosition -= 1
dp = [[0 for i in range(50)] for j in range(50)]
dp[25][0] = 1
time = 0
for i in s2:
	time += 1
	if i == '+':
		for j in range(49):
			dp[j][time] = dp[j - 1][time - 1]
	elif i == '-':
		for j in range(49):
			dp[j][time] = dp[j + 1][time - 1]
	else:
		for j in range(49):
			dp[j][time] = dp[j - 1][time - 1] * 0.5 + dp[j + 1][time - 1] * 0.5
print(dp[actualPosition + 25][time])


import math
s = str(input())
s1 = str(input())
a = 0
a1 = 0
c1 = 0
for i in range(len(s1)):
	if s[i] == '+':
		a += 1
	else:
		a -= 1
	if s1[i] == '+':
		a1 += 1
	elif s1[i] == '-':
		a1 -= 1
	else:
		c1 += 1
a -= a1
if a == 0 and c1 == 0:
	print('%.20f' % 1.0)
	exit()
a = abs(a)
if a > c1:
	print('%.20f' % 0.0)
	exit()
a = (a + c1) // 2
a1 = math.factorial(c1) // math.factorial(c1 - a) // math.factorial(a)
ans = a1 / 2 ** c1
print('%.20f' % ans)


import math
s1 = list(input())
s2 = list(input())
pos1 = 0
c = 0
pos2 = 0
for i in range(0, len(s1)):
	if s1[i] == '+':
		pos1 += 1
	else:
		pos1 -= 1
for i in range(0, len(s2)):
	if s2[i] == '+':
		pos2 += 1
	elif s2[i] == '-':
		pos2 -= 1
	else:
		c += 1
if (pos1 - pos2 + c) % 2 != 0:
	ans = 0.0
elif c == 0 and pos1 != pos2:
	ans = 0.0
elif c == 0 and pos1 == pos2:
	ans = 1.0
else:
	n = (pos1 - pos2 + c) / 2
	m = c - n
	if n >= 0 and m >= 0:
		ans = math.factorial(n + m) / (math.factorial(n) * math.factorial(m))
		ans = ans / 2 ** (n + m)
	else:
		ans = 0.0
print(ans)


import math

def c(k, n):
	return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))

def main():
	sent = input()
	received = input()
	difference = abs(sent.count('+') - sent.count('-') - (received.count('+') - received.count('-')))
	unrecognized = received.count('?')
	if difference > unrecognized:
		print(0)
		return
	k = (unrecognized - difference) // 2
	answer = c(k, unrecognized) * 0.5 ** unrecognized
	print(answer)
main()


s = input()
t = input()
n = len(s)
ans = 0
from copy import deepcopy
prob = dict()
for i in range(-10, 11):
	prob[i] = 0
prob[0] = 1
for i in range(n):
	if s[i] == '+':
		ans += 1
	else:
		ans -= 1
	if t[i] == '+':
		old_prob = deepcopy(prob)
		for j in range(-10, 10):
			prob[j + 1] = old_prob[j]
	elif t[i] == '-':
		old_prob = deepcopy(prob)
		for j in range(-9, 11):
			prob[j - 1] = old_prob[j]
	elif t[i] == '?':
		old_prob = deepcopy(prob)
		for j in range(-10, 10):
			prob[j + 1] += old_prob[j] * (1 / 2)
			prob[j] -= old_prob[j] * (1 / 2)
		for j in range(-9, 11):
			prob[j - 1] += old_prob[j] * (1 / 2)
			prob[j] -= old_prob[j] * (1 / 2)
ans = max(ans, -10)
ans = min(ans, 10)
print(prob[ans])


from math import factorial
drazil = input()
dreamoon = input()
net_drazil = 0
net_dreamoon = 0
uncretain_count = 0
for i in drazil:
	if i == '-':
		net_drazil -= 1
	else:
		net_drazil += 1
for i in dreamoon:
	if i == '-':
		net_dreamoon -= 1
	elif i == '+':
		net_dreamoon += 1
	else:
		uncretain_count += 1
x = (uncretain_count + (net_drazil - net_dreamoon)) // 2
y = (uncretain_count - (net_drazil - net_dreamoon)) // 2
if abs(x) + abs(y) != uncretain_count:
	print(0.0)
else:
	out = factorial(uncretain_count) // (factorial(x) * factorial(uncretain_count - x))
	print(out / 2 ** uncretain_count)


commands = list(input())
received = list(input())
if commands == received:
	print(1)
else:
	numbers = []
	for i in range(len(commands)):
		number = commands[i].replace('+', '1')
		number = number.replace('-', '-1')
		numbers.append(int(number))
	m = [[0 for i in range(100)] for j in range(100)]
	m[0][50] = 1
	for i in range(1, len(commands) + 1):
		if received[i - 1] == '+':
			for j in range(1, 100):
				m[i][j] = m[i - 1][j - 1]
		elif received[i - 1] == '-':
			for j in range(0, 99):
				m[i][j] = m[i - 1][j + 1]
		else:
			for j in range(1, 99):
				m[i][j] = 0.5 * m[i - 1][j - 1] + 0.5 * m[i - 1][j + 1]
	sumcom = 50 + sum(numbers)
	print(m[len(commands)][sumcom])


s1 = input()
goal = sum((1 if x == '+' else -1 for x in s1))
s2 = input()
offset = sum((1 for x in s2 if x == '+')) - sum((1 for x in s2 if x == '-'))
wildcards = sum((1 for x in s2 if x == '?'))

def dfs(pos, depth):
	if depth == wildcards:
		return pos == goal
	return dfs(pos - 1, depth + 1) + dfs(pos + 1, depth + 1)
ans = dfs(offset, 0)
print(ans / 2 ** wildcards)


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans
s = si()
t = si()
cs = 0
for i in range(len(s)):
	if s[i] == '+':
		cs += 1
	else:
		cs -= 1
u = 0
ct = 0
for i in range(len(t)):
	if t[i] == '+':
		ct += 1
	elif t[i] == '-':
		ct -= 1
	else:
		u += 1
if u == 0:
	if cs == ct:
		print(1)
	else:
		print(0)
elif u > 0:
	x = abs(ct - cs)
	count = 0
	for i in range(int(pow(2, u))):
		y = len(decimalToBinary(i))
		z = '0' * (u - y) + decimalToBinary(i)
		sum = 0
		for j in range(len(z)):
			if z[j] == '0':
				sum -= 1
			else:
				sum += 1
		if sum == x:
			count += 1
	print(count / pow(2, u))


def fac(n):
	if n == 0:
		return 1
	return n * fac(n - 1)

def comb(n, r):
	return fac(n) / (fac(n - r) * fac(r))
orig_s = input()
s = input()
intended = orig_s.count('+') - orig_s.count('-')
our_final_pos = s.count('+') - s.count('-')
if s.count('?') == 0:
	if s.count('+') - s.count('-') == intended:
		print(1)
	else:
		print(0)
else:
	num_of_question = s.count('?')
	n_s = 2 ** num_of_question
	df = abs(intended - our_final_pos)
	if df > num_of_question:
		print(0)
	else:
		x = (num_of_question - df) // 2
		print(comb(num_of_question, x + df) / n_s)


def count(s1, s2):
	global total, yes
	total += 1
	if s1.count('+') == s2.count('+'):
		yes += 1

def make(s1, s2, i):
	if i == len(s2):
		count(s1, s2)
		return
	if s2[i] == '?':
		s2[i] = '+'
		make(s1, s2, i + 1)
		s2[i] = '-'
		make(s1, s2, i + 1)
		s2[i] = '?'
	else:
		make(s1, s2, i + 1)
s1 = list(input())
s2 = list(input())
yes = 0
total = 0
make(s1, s2, 0)
print(yes / total)


def gh(x):
	return x.count('+') - x.count('-')
a = input()
b = input()
a1 = gh(a)
b1 = gh(b)
c = b.count('?')
n = 0
for i in range(1 << c):
	s = 0
	for j in range(c):
		s += -1 if i & 1 << j else 1
	if a1 == b1 + s:
		n += 1
print(round(n / (1 << c), 9))


from math import factorial

def ncr(n, r):
	return factorial(n) / factorial(n - r) / factorial(r)
sent = input()
received = input()
plus = sent.count('+') - received.count('+')
minus = sent.count('-') - received.count('-')
missing = received.count('?')
if plus < 0 or minus < 0 or minus + plus != missing:
	print(0.0)
else:
	print(ncr(missing, plus) / (1 << missing))


import math
s = str(input())
s2 = str(input())
(p, m, res, ans, temp, i) = (0, 0, 0, 0, 0, 0)
p = s.count('+')
m = s.count('-')
q = s2.count('+')
w = s2.count('-')
(pr, mr) = (p - q, m - w)
if pr < 0 or mr < 0:
	print('%.12f' % 0)
else:
	temp = pr + mr
	if temp == 0:
		print('%.12f' % 1)
	else:
		i = pow(2, temp)
		res = math.factorial(temp) / (math.factorial(pr) * math.factorial(mr))
		ans = res / i
		print('%.12f' % ans)


from math import factorial
(s1, s2) = (input().strip(), input().strip())
(d, q) = (abs(s1.count('+') - s1.count('-') - s2.count('+') + s2.count('-')), s2.count('?'))
print(0 if d + q & 1 or d > q else factorial(q) / factorial(d + q >> 1) / factorial(q - d >> 1) / (1 << q))


import math

def binom(n, m):
	return math.factorial(n) // (math.factorial(m) * math.factorial(n - m))
correct = input()
received = input()
plus_correct = correct.count('+')
min_correct = correct.count('-')
pos_correct = plus_correct - min_correct
plus_received = received.count('+')
min_received = received.count('-')
unknown = received.count('?')
pos_received = plus_received - min_received
diff = abs(pos_correct - pos_received)
if (diff + unknown) % 2 != 0 or diff > unknown:
	prob = 0.0
else:
	m = (diff + unknown) // 2
	prob = 1.0 * binom(unknown, m) / 2 ** unknown
print(prob)


first = input()
second = input()
p1 = first.count('+')
m1 = first.count('-')
p2 = second.count('+')
m2 = second.count('-')
n = len(second) - p2 - m2
b = p1 - m1 - (p2 - m2)
pu = (n + b) // 2
mu = (n - b) // 2

def fact(n):
	ret = 1
	for i in range(1, n + 1):
		ret *= i
	return ret

def choose(n, k):
	return fact(n) / (fact(k) * fact(n - k))

def choose_sum(n):
	ret = 0
	for i in range(0, n + 1):
		ret += choose(n, i)
	return ret
if b > n or b < -n:
	prob = 0.0
else:
	prob = choose(n, pu) / choose_sum(n)
print(prob)


def fac(n):
	f = 1
	while n > 1:
		f *= n
		n -= 1
	return f

def comb(n, c):
	return fac(n) // (fac(c) * fac(n - c))
s = input()
t = input()
target = s.count('+') - s.count('-')
l = t.count('?')
need = target - (t.count('+') - t.count('-'))
if need == 0 and l == 0:
	print('{0:.16f}'.format(1.0))
elif abs(need) > l:
	print('0.000000000000000')
else:
	p = (need + l) // 2
	if p > 0:
		print('{0:.16f}'.format(comb(l, p) / 2 ** l))
	else:
		print('{0:.16f}'.format(1 / 2 ** l))


actual = input()
interpreted = input()

def position(string):
	return sum((1 if i == '+' else -1 for i in string))
possibilities = []

def backtrack(i, interpreted):
	if i == len(interpreted):
		possibilities.append(interpreted[:])
		return
	if interpreted[i] == '?':
		backtrack(i + 1, interpreted[:i] + '+' + interpreted[i + 1:])
		backtrack(i + 1, interpreted[:i] + '-' + interpreted[i + 1:])
	else:
		backtrack(i + 1, interpreted)
backtrack(0, interpreted)
check = position(actual)
print(sum((1 if position(p) == check else 0 for p in possibilities)) / len(possibilities))


from math import factorial
post = input()
receiver = input()
position = 0
unknown = 0
for c in post:
	if c == '+':
		position += 1
	else:
		position -= 1
summery = 0
for c in receiver:
	if c == '+':
		summery += 1
	elif c == '-':
		summery -= 1
	else:
		unknown += 1
delta = position - summery

def tmp(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m))
count1 = (unknown - abs(delta)) // 2
count2 = unknown - count1
allProbability = pow(2, unknown)
if unknown - abs(delta) < 0:
	print(0)
else:
	print((tmp(unknown, count1) + tmp(unknown, count2)) / (2 * allProbability))


a = list(input())
b = list(input())
x = a.count('+') + b.count('-')
y = a.count('-') + b.count('+')
cntQM = b.count('?')
if cntQM == 0:
	print(1 if x == y else 0)
	exit()
res = []
for i in range(2 ** cntQM):
	cnt = bin(i)[2:].count('1')
	res.append(2 * cnt - cntQM)
print(round(res.count(x - y) / 2 ** cntQM, 9))


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7
count = 0

def recursion(s2, n, ini, curr, i):
	global count
	if i == n:
		if curr == ini:
			count += 1
		return
	if s2[i] == '+':
		return recursion(s2, n, ini, curr + 1, i + 1)
	elif s2[i] == '-':
		return recursion(s2, n, ini, curr - 1, i + 1)
	else:
		recursion(s2, n, ini, curr + 1, i + 1)
		recursion(s2, n, ini, curr - 1, i + 1)
		return

def solve(i):
	s1 = input()
	s2 = input()
	n = len(s1)
	ini = 0
	for ele in s1:
		if ele == '+':
			ini += 1
		else:
			ini -= 1
	if '?' not in s2:
		pos = 0
		for ele in s2:
			if ele == '+':
				pos += 1
			else:
				pos -= 1
		if pos != ini:
			P(0)
		else:
			P(1)
	else:
		global count
		cnt = s2.count('?')
		cnt = pow(2, cnt)
		recursion(s2, n, ini, 0, 0)
		prob = count / cnt
		P(prob)
	return
t = 1
for i in range(t):
	solve(i)


import math

def C(a, b):
	return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
a = list(input())
b = list(input())
(x, y, d, ans, power) = (0, 0, 0, 0, 0)
for i in range(len(a)):
	if a[i] == '+':
		x += 1
	if a[i] == '-':
		x -= 1
	if b[i] == '?':
		d += 1
	if b[i] == '+':
		y += 1
	if b[i] == '-':
		y -= 1
(plus, minus) = (d, 0)
for i in range(0, d + 1):
	k = C(d, plus)
	if y + (plus - minus) == x:
		ans += k
	power += k
	plus -= 1
	minus += 1
print('{0:.12f}'.format(ans / power))


def ft(x):
	if x <= 0:
		return 1
	return x * ft(x - 1)
(x, y) = (input(), input())
(a, n, c, d) = (x.count('+'), len(x), y.count('?'), y.count('+'))
pos = 2 * a - n
r = 2 * d - (n - c)
r = abs(pos - r)
p = ft(c) // (ft((c + r) // 2) * ft((c - r) // 2)) if c % 2 == r % 2 and r <= c else 0
q = 2 ** c
print('%0.9f' % (p / q))


s1 = input()
s2 = input()
expected = 0
cases = 0
valid = 0
for c in s1:
	if c == '+':
		expected += 1
	else:
		expected -= 1

def recursive(z, val):
	global expected, cases, valid
	if z == len(s2):
		if val == expected:
			valid += 1
		cases += 1
		return
	if s2[z] != '-':
		recursive(z + 1, val + 1)
	if s2[z] != '+':
		recursive(z + 1, val - 1)
recursive(0, 0)
print('{:.10}'.format(1.0 * valid / cases))


import sys
import random
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
string1 = input()
string2 = input()
flag = 0
str1 = []
str2 = []
count = 0
result3 = []
for i in string1:
	if i == '+':
		str1.append(1)
	else:
		str1.append(-1)
for i in string2:
	if i == '?':
		flag = 1
		count += 1
		str2.append('?')
	elif i == '+':
		str2.append(1)
		result3.append(1)
	else:
		str2.append(-1)
		result3.append(-1)
if flag == 0:
	if sum(str1) != sum(str2):
		print('0.000000000000')
	else:
		print('1.000000000000')
	exit(0)
total = 0
for i in range(1 << count):
	z = bin(i)[2:]
	if len(z) < count:
		z = (count - len(z)) * '0' + z
	tot = 0
	for i in z:
		if i == '1':
			tot += 1
		else:
			tot -= 1
	if tot + sum(result3) == sum(str1):
		total += 1
count = 2 ** count
ans = total / count
print('{0:.12f}'.format(ans))


a = list(input())
b = list(input())
c = a.count('+') - a.count('-') - b.count('+') + b.count('-')
d = b.count('?')
e = 1.0
if d == 0:
	if c != 0:
		print(0.0)
	else:
		print(round(e, 9))
	exit(0)
l = []
for i in range(2 ** d):
	j = 2 * bin(i)[2:].count('1') - d
	l.append(j)
print(round(l.count(c) / 2 ** d, 9))


def PosCounter(n):
	p = 0
	for i in n:
		if i == '+':
			p += 1
	return p

def NegCounter(n):
	p = 0
	for i in n:
		if i == '-':
			p += 1
	return p

def UnCounter(n):
	p = 0
	for i in n:
		if i == '?':
			p += 1
	return p
dirt = ['+', '-']
drazil = input()
drimon = input()
if UnCounter(drimon) == 0:
	if NegCounter(drimon) == NegCounter(drazil) and PosCounter(drimon) == PosCounter(drazil):
		print('%.12f' % 1)
	else:
		print('%.12f' % 0)
else:
	realStop = PosCounter(drazil) - NegCounter(drazil)
	NegStop = PosCounter(drimon) - UnCounter(drimon) - NegCounter(drimon)
	PosStop = PosCounter(drimon) + UnCounter(drimon) - NegCounter(drimon)
	if realStop < NegStop or realStop > PosStop:
		print('%.12f' % 0)
	else:
		a = PosCounter(drimon)
		b = NegCounter(drimon)
		c = UnCounter(drimon)
		poss = []
		known = ''
		may = ''
		for i in drimon:
			if i != '?':
				known += i
		if UnCounter(drimon) == 1:
			for i in range(2):
				may += dirt[i]
				poss.append(PosCounter(may + known) - NegCounter(may + known))
				may = ''
		elif UnCounter(drimon) == 2:
			for i in range(2):
				for j in range(2):
					may += dirt[i]
					may += dirt[j]
					poss.append(PosCounter(may + known) - NegCounter(may + known))
					may = ''
		elif UnCounter(drimon) == 3:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						may += dirt[i]
						may += dirt[j]
						may += dirt[k]
						poss.append(PosCounter(may + known) - NegCounter(may + known))
						may = ''
		elif UnCounter(drimon) == 4:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							may += dirt[i]
							may += dirt[j]
							may += dirt[k]
							may += dirt[r]
							poss.append(PosCounter(may + known) - NegCounter(may + known))
							may = ''
		elif UnCounter(drimon) == 5:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								may += dirt[i]
								may += dirt[j]
								may += dirt[k]
								may += dirt[r]
								may += dirt[o]
								poss.append(PosCounter(may + known) - NegCounter(may + known))
								may = ''
		elif UnCounter(drimon) == 6:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								for p in range(2):
									may += dirt[i]
									may += dirt[j]
									may += dirt[k]
									may += dirt[r]
									may += dirt[o]
									may += dirt[p]
									poss.append(PosCounter(may + known) - NegCounter(may + known))
									may = ''
		elif UnCounter(drimon) == 7:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								for p in range(2):
									for z in range(2):
										may += dirt[i]
										may += dirt[j]
										may += dirt[k]
										may += dirt[r]
										may += dirt[o]
										may += dirt[p]
										may += dirt[z]
										poss.append(PosCounter(may + known) - NegCounter(may + known))
										may = ''
		elif UnCounter(drimon) == 8:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								for p in range(2):
									for z in range(2):
										for u in range(2):
											may += dirt[i]
											may += dirt[j]
											may += dirt[k]
											may += dirt[r]
											may += dirt[o]
											may += dirt[p]
											may += dirt[z]
											may += dirt[u]
											poss.append(PosCounter(may + known) - NegCounter(may + known))
											may = ''
		elif UnCounter(drimon) == 9:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								for p in range(2):
									for z in range(2):
										for u in range(2):
											for t in range(2):
												may += dirt[i]
												may += dirt[j]
												may += dirt[k]
												may += dirt[r]
												may += dirt[o]
												may += dirt[p]
												may += dirt[z]
												may += dirt[u]
												may += dirt[t]
												poss.append(PosCounter(may + known) - NegCounter(may + known))
												may = ''
		elif UnCounter(drimon) == 10:
			for i in range(2):
				for j in range(2):
					for k in range(2):
						for r in range(2):
							for o in range(2):
								for p in range(2):
									for z in range(2):
										for u in range(2):
											for t in range(2):
												for f in range(2):
													may += dirt[i]
													may += dirt[j]
													may += dirt[k]
													may += dirt[r]
													may += dirt[o]
													may += dirt[p]
													may += dirt[z]
													may += dirt[u]
													may += dirt[t]
													may += dirt[f]
													poss.append(PosCounter(may + known) - NegCounter(may + known))
													may = ''
		prob = poss.count(realStop) / float(len(poss))
		print('%.12f' % prob)


from math import factorial
from decimal import *
A = input()
B = input()
a = 0
cnt2 = 0
cnt1 = 0
b = 0
for i in A:
	if i == '+':
		a += 1
		cnt1 += 1
	else:
		a -= 1
		cnt2 += 1
cnt3 = 0
cnt = 0
cnt4 = 0
for i in B:
	if i == '+':
		b += 1
		cnt3 += 1
	elif i == '-':
		b -= 1
		cnt4 += 1
	else:
		cnt += 1
if cnt3 > cnt1 or cnt4 > cnt2:
	print(format(0, '.12f'))
else:
	No_of_plus = cnt1 - cnt3
	No_of_minus = cnt2 - cnt4
	Total_cases = 2 ** cnt
	Total_No_of_favourable_cases = factorial(cnt) // (factorial(No_of_plus) * factorial(No_of_minus))
	print(format(Decimal(Total_No_of_favourable_cases) / Decimal(Total_cases), '.12f'))


import math
a = input()
b = input()
sa = a.count('+')
ta = a.count('-')
sb = b.count('+')
tb = b.count('-')
x = b.count('?')
s = abs(sa - sb)
t = abs(ta - tb)
su = math.factorial(s + t)
re = math.factorial(s)
sa = math.factorial(t)
result = su / (re * sa)
if s + t <= x:
	print(float(result) / float(2 ** x))
else:
	print(0)


s1 = input()
s2 = input()
ans = 0
pos = [0]
for e in s1:
	if e == '+':
		ans += 1
	else:
		ans -= 1
for e in s2:
	m = len(pos)
	if e == '+':
		for i in range(m):
			pos[i] += 1
	elif e == '-':
		for i in range(m):
			pos[i] -= 1
	else:
		for i in range(m):
			pos.append(pos[i] + 1)
			pos[i] -= 1
n = len(pos)
res = pos.count(ans)
print(res / n)


s = input()
t = input()
pos = 0
for i in s:
	if i == '+':
		pos += 1
	else:
		pos -= 1
Len = 1
for i in t:
	if i == '?':
		Len += 1
Tree = [0] * 2 ** Len
start = 1
end = 1
level = 0
for i in range(len(t)):
	if t[i] == '?':
		for k in range(start, end + 1):
			Tree[k * 2] = Tree[k] - 1
			Tree[k * 2 + 1] = Tree[k] + 1
		level += 1
		start = 2 ** level
		end = 2 ** (level + 1) - 1
	else:
		val = -1
		if t[i] == '+':
			val = 1
		for k in range(start, end + 1):
			Tree[k] += val
res = 0
for i in range(start, end + 1):
	if Tree[i] == pos:
		res += 1
print(res / (end - start + 1))


s1 = input()
s2 = input()
from math import factorial
from collections import Counter
c1 = Counter(s1)
c2 = Counter(s2)
if c2['?'] == 0:
	if c1['+'] == c2['+'] and c1['-'] == c2['-']:
		print(1.0)
	else:
		print(0.0)
else:
	a = c1['+'] - c2['+']
	b = c1['-'] - c2['-']
	if a < 0 or b < 0:
		print(0.0)
	else:
		c = c2['?']
		x = factorial(c) // (factorial(a) * factorial(c - a))
		y = 2 ** c
		print(x / y)


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
s1 = get_string()
s2 = get_string()
d = defaultdict(int)
for c in s1:
	d[c] += 1
f = 0
for ch in s2:
	if ch == '?':
		continue
	if d[ch] is None:
		print('%.12f' % 0)
		f = 1
		break
	d[ch] -= 1
t = d['+'] + d['-']
if f == 0:
	ans = 0
	for i in range(1 << t):
		if str(bin(i)).count('1') == d['+']:
			ans += 1
	a = ans / (1 << t)
	print('%.12f' % a)


from itertools import permutations, combinations
from math import factorial
word1 = list(map(str, input()))
word2 = list(map(str, input()))
expected = 0
for i in word1:
	if i == '+':
		expected += 1
	else:
		expected -= 1
blank = 0
for i in word2:
	if i == '+':
		expected -= 1
	elif i == '-':
		expected += 1
	else:
		blank += 1
if abs(expected) > blank:
	print(float(0))
elif blank == 0:
	if expected == 0:
		print(1)
	else:
		print(0)
else:
	total = 2 ** blank
	if expected == blank - 1:
		print(float(0))
	else:
		f = (blank - expected) // 2
		if expected > 0:
			(a, b) = (expected + f, f)
		elif expected < 0:
			(a, b) = (expected + f, f)
		else:
			(a, b) = (f, f)
		ans = factorial(a + b) / factorial(a)
		ans = ans / factorial(b)
		ans = ans / total
		print(ans)


def C(m, n):
	if m == n:
		return 1
	elif m == 0:
		return 1
	else:
		return C(m - 1, n - 1) + C(m, n - 1)
(command_1, command_2) = (input(), input())
num = command_2.count('?')
i = command_1.count('+') - command_1.count('-') - command_2.count('+') + command_2.count('-') + num
if i % 2 == 0 and 0 <= i // 2 <= num:
	print('%.9f' % (C(i // 2, num) / 2 ** num))
else:
	print('0.000000000')


from math import factorial as f
a = input()
b = input()
pos1 = a.count('+')
pos2 = b.count('+')
req = pos1 - pos2
replac = b.count('?')
if req < 0:
	print(0.0)
elif replac - req < 0:
	print(0.0)
else:
	print(f(replac) / f(req) / f(replac - req) / (1 << replac))


correct = list(input())
received = list(input())

def matrix_builder(correct, received):
	matrix = [[0 for i in range(100)] for j in range(100)]
	level = 50
	matrix[0][level] = 1
	for i in range(1, len(correct) + 1):
		if received[i - 1] == '+':
			for j in range(1, 100):
				matrix[i][j] = matrix[i - 1][j - 1]
		if received[i - 1] == '-':
			for k in range(0, 99):
				matrix[i][k] = matrix[i - 1][k + 1]
		if received[i - 1] == '?':
			for l in range(1, 99):
				matrix[i][l] = 0.5 * matrix[i - 1][l - 1] + 0.5 * matrix[i - 1][l + 1]
	return matrix
p = 50
for i in correct:
	if i == '+':
		p += 1
	else:
		p -= 1
print(matrix_builder(correct, received)[len(correct)][p])


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))
ans = []

def generateAllBinaryStrings(n, arr, i):
	if i == n:
		ans.append(arr.copy())
		return
	arr[i] = -1
	generateAllBinaryStrings(n, arr, i + 1)
	arr[i] = 1
	generateAllBinaryStrings(n, arr, i + 1)

def case():
	p = input().strip()
	q = input().strip()
	s = 0
	t = 0
	c = d = n = 0
	req = 0
	for i in range(len(p)):
		if p[i] == '+':
			c += 1
		else:
			c -= 1
		if q[i] == '+':
			d += 1
		elif q[i] == '-':
			d -= 1
		else:
			n += 1
	a = [None] * n
	generateAllBinaryStrings(n, a, 0)
	for i in ans:
		if sum(i) + d == c:
			req += 1
	print(req / 2 ** n)
for _ in range(1):
	case()


import sys
import itertools
import math
import collections
from collections import Counter
input = sys.stdin.readline

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
s = input()
t = input()
p = s.count('+') - s.count('-')
r = t.count('+') - t.count('-')
d = list(itertools.product([-1, 1], repeat=t.count('?')))
c = 0
for i in d:
	if r + sum(i) == p:
		c += 1
print(c / len(d))


import sys

def solve(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	romeo = f.readline().rstrip()
	juliet = f.readline().rstrip()
	factorial = list()
	factorial.append(1)
	factorial.append(1)
	for i in range(2, 20):
		factorial.append(factorial[i - 1] * i)
	diff_plus = romeo.count('+') - juliet.count('+')
	diff_minus = romeo.count('-') - juliet.count('-')
	question_marks = juliet.count('?')
	if diff_plus < 0 or diff_minus < 0:
		return ['0']
	else:
		res = factorial[question_marks] / (factorial[diff_plus] * factorial[diff_minus]) / 2 ** question_marks
		return [f'{res}']

def main():
	for line in solve():
		print(f'{line}')
main()


import math
s1 = input()
s2 = input()
x = 0
y = 0
p = 0
for i in range(len(s1)):
	if s1[i] == '+':
		x += 1
	elif s1[i] == '-':
		y += 1
	if s2[i] == '+':
		x -= 1
	elif s2[i] == '-':
		y -= 1
	else:
		p += 1
if x < 0 or y < 0:
	print(float(0))
else:
	q = math.factorial(x + y) / (math.factorial(x) * math.factorial(y))
	r = q / math.pow(2, p)
	print(r)


from math import factorial
t = input()
s = input()
if t.count('+') == s.count('+') and t.count('-') == s.count('-'):
	print(1 / 1)
else:
	a = s.count('?')
	p = t.count('+') - s.count('+')
	n = t.count('-') - s.count('-')
	if p < 0 or n < 0:
		print(0)
	else:
		print(factorial(a) / (factorial(p) * factorial(a - p)) / 2 ** a)


point = {'1': '+', '0': '-'}

def counter(text):
	ans = 0
	for i in text:
		if i == '+':
			ans += 1
		else:
			ans -= 1
	return ans

def uniform(s, size):
	add = ''
	length = len(s)
	while length != size:
		add += '0'
		length += 1
	return add + s

def convert(s):
	ans = ''
	for i in s:
		if i == '1':
			ans += point[i]
		else:
			ans += point[i]
	return ans
s1 = input()
s2 = ''.join(sorted(input()))
real = counter(s1)
without_q = s2[:len(s2) - s2.count('?')]
change = []
c = 0
if not s2.count('?'):
	if real == counter(s2):
		print('{:.12f}'.format(1))
	else:
		print('{:.12f}'.format(0))
else:
	q_len = s2.count('?')
	for i in range(2 ** q_len):
		change.append(convert(uniform(bin(i)[2:], q_len)))
	for i in change:
		new = without_q + i
		if counter(new) == real:
			c += 1
	print('{: .12f}'.format(c / len(change)))