/*
URL_HERE
*/
/*

*/
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <iostream>
using namespace std;

FILE* _fin = stdin;
FILE* _fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var,n) for(int var=0;var<n;++var)
#define repi(n) rep(i,n)
#define repj(n) rep(j,n)
#define repi1(n) for(int i=1;i<n;++i)
#define repj1(n) for(int j=1;j<n;++j)
int _min(int a, int b) { return a <= b ? a : b; }
int _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
int _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int* data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll* data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(char* data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() { char var; fscanf(_fin, "%c", &var); return var; }
int readi() { int var; fscanf(_fin, "%d", &var); return var; }
double readlf() { double var; fscanf(_fin, "%lf", &var); return var; }
ll readll() { ll var; fscanf(_fin, "%lld", &var); return var; }
void repread(int* data, int n) { repi(n) data[i] = readi(); }
void repread(ll* data, int n) { repi(n) data[i] = readll(); }
int reads(char* str, int maxsize)
{
	for (;;) { if (fgets(str, maxsize, _fin) == NULL) break; if (str[0] != '\n' && str[0] != '\r') break; }
	int slen = strlen(str); if (slen == 0) return 0;
	if (str[slen - 1] == '\n' || str[slen - 1] == '\r') str[--slen] = 0;
	return slen;
}

#define writec(var) fprintf(_fout,"%c",var)
#define writecsp(var) fprintf(_fout,"%c ",var)
#define writecln(var) fprintf(_fout,"%c\n",var)
#define writei(var) fprintf(_fout,"%d",var)
#define writeisp(var) fprintf(_fout,"%d ",var)
#define writellsp(var) fprintf(_fout,"%lld ",var)
#define writeiln(var) fprintf(_fout,"%d\n",var)
#define writellln(var) fprintf(_fout,"%lld\n",var)
#define writeulln(var) fprintf(_fout,"%llu\n",var)
#define writefln(var) fprintf(_fout,"%f\n",var)
#define writes(str) fprintf(_fout,"%s",str)
#define writesp() fprintf(_fout," ")
#define writeln() fprintf(_fout,"\n")
#define RUN_LOCAL(testfilename) {_fin = fopen(testfilename, "r"); if(_fin==NULL) _fin=stdin;}
#define swap(type,a, b) {type t=a;a=b;b=t;}
#define sort(data,n) std::sort(data,data+n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell is this...
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return (a / g) * b; }
void reverse(char* data, int n) { int k = n >> 1; repi(k) { char tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(int* data, int n) { int k = n >> 1; repi(k) { int tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }

#define _Vec(type, name) \
struct name { type* data; int size; int n; };\
void init(name* t, int size) { t->data = (type*)malloc(sizeof(type) * size); t->size = size; t->n = 0; }\
void resize(name* t) { int ns = t->size * 1.2f; t->data = (type*)realloc(t->data, sizeof(type) * ns); t->size = ns; }\
void add(name* t, type val) { if (t->n >= t->size) resize(t); int k = t->n; t->data[k] = val; t->n = k + 1; }\
void free(name* t) { free(t->data);}
_Vec(int, Veci)
_Vec(long long, Vecll)
_Vec(char*, Vecs)

#define _ispal(type, name) int name(type* a, type* b, int n){repi(n){if (a[i] != b[n - i - 1]){return 0;}}return 1;}
_ispal(int, ispali)
_ispal(char, ispalc)

#define _Pair(type, name) struct name{type x, y;}; \
int cmp_##name(const void* _a, const void* _b)\
{\
	name* a = (name*)_a;name* b = (name*)_b;\
	if (a->x < b->x) return -1;\
	else\
	{\
		if (a->x == b->x)\
		{\
			if (a->y == b->y) return 0;\
			if (a->y < b->y) return -1;\
			else return 1;\
		}\
		else\
		{\
			return 1;\
		}\
	}\
}\
void sort_##name(name* d, int n){qsort(d, n, sizeof(name), cmp_##name);}
	_Pair(int, Pairi)

	int cmp_Str(const void* _a, const void* _b) { char* a = *((char**)_a); char* b = *((char**)_b); return strcmp(a, b); }
void sort_Str(char** str, int n) { qsort(str, n, sizeof(char*), cmp_Str); }

ll expmod(ll x, ll n, ll m) {
	ll ans = 1;
	for (; n;) {
		if (n & 1) ans = (ans * x) % m;
		x = (x * x) % m;
		n >>= 1;
	}
	return ans;
}

ll combmod(ll n, ll k, ll m) {
	ll ret = 1;
	ll div = 1;
	for (ll i = 0; i < k; ++i) {
		ret = (ret * (n - i) % m) % m;
		div = (div * (i + 1)) % m;
	}
	div = expmod(div, m - 2, m) % m;
	return (ret * div) % m;
}

int next_perm(int* data, int n)
{
	//find first i,i+1 where d[i]<d[i+1]
	int rootidx = -1;
	for (int i = n - 2; i >= 0; --i)
	{
		if (data[i] < data[i + 1])
		{
			rootidx = i;
			break;
		}
	}

	if (rootidx == -1) return 0;

	int ceilingidx = rootidx + 1;
	//find smallest d[x] after d[rooti] where d[x]>d[rooti]
	for (int i = rootidx + 2; i < n; ++i)
	{
		if (data[i] > data[rootidx] && data[i] < data[ceilingidx])
		{
			ceilingidx = i;
		}
	}

	swap(int, data[rootidx], data[ceilingidx]);
	sort(&data[rootidx + 1], n - rootidx - 1);
	return 1;
}
int count_digits(ll a)
{
	int k = 0;
	for (;;)
	{
		if (a == 0)break;
		k++;
		a /= 10;
	}
	return k;
}

/*
use only when val EXISTS in data
*/
int bs_exists(int* data, int n, int val)
{
	int left = 0;
	int right = n - 1;
	for (; left < right;)
	{
		int mid = (left + right + 1) >> 1;
		if (data[mid] <= val) left = mid;
		else right = mid - 1;
	}
	return right;
}
//------------------------------------------

//------------

double factorial(int x)
{
	double f = 1.0;
	repi(x)
	{
		f *= (i + 1);
	}
	return f;
}

int main()
{
	RUN_LOCAL("input.txt");
	static char s1[11];
	static char s2[11];
	int len = reads(s1, 11);
	reads(s2, 11);

	int nplus = 0;
	int nminus = 0;
	repi(len)if (s1[i] == '+')nplus++; else nminus++;
	int finaldest = nplus - nminus;

	nplus = 0;
	nminus = 0;
	repi(len)if (s2[i] == '+')nplus++; else if(s2[i]=='-') nminus++;
	int travelleddest = nplus - nminus;

	int diff = abs(finaldest - travelleddest);
	int nguess = len - (nplus + nminus);

	if (diff > nguess)
	{
		printf("0.000000000\n");
		return 0;
	}

	int idlematch = nguess - diff;//these are +- pairs that u need to idle
	if (idlematch&1)
	{
		printf("0.000000000\n");
		return 0;
	}

	/*
	u need to pick +- to make up for diff
	and extras need to be +-pairs
	all these are spread over nguess
	nguess!/2^nguess

	*/

	double totalfact = factorial(nguess);
	double afact = factorial(abs(diff) + idlematch / 2);
	double bfact = factorial(idlematch / 2);
	/*
	this is correct IF each + and - were unique
	however
	x1x2x3
	x2x3x1
	are same => still xxx
	need to divide by n+!n-!
	*/
	double ans = totalfact / (afact*bfact*(pow(2.0, nguess)));
	printf("%.12f\n", ans);
	return 0;

	/*
++++++++++
+++??++?++
Output
0.750000
Answer
0.125000000000
	*/
}

#include <iostream>
#include <stack>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <iomanip>
#define rep(a, b, c) for(int i = (a); i < (b); i+=(c))
using namespace std;
const int MAX = 1000000000;

string s1, s2;

long long c(long long k, long long n)
{
	long long res = 1;
	if (k > n - k) k = n - k;
	for (int i = 1; i <= k; i++)
		res = res * (n - i + 1) / i;
	return (long long)res;
}

int main()
{
	cin >> s1 >> s2;
	int a1 = 0, b1 = 0, a2 = 0, b2 = 0;
	rep(0, s1.length(), 1) if (s1[i] == '+') a1++; else b1++;
	rep(0, s2.length(), 1) if (s2[i] == '+') a2++; else  if(s2[i] == '-' )b2++;
	int x = a1 - a2, y = b1 - b2;
	if (x < 0 || y < 0)
	{
		cout << 0.0 << endl;
		return 0;
	}

	long long xx = 1, yy = 1;;
	for (int i = 1; i <= x + y; i++) xx *= i;
	xx = pow(2.0, x + y);
	yy = c(x, x + y);
	cout << setprecision(12)<< 1.0*yy / xx << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int n,k,l;
int fun(int ctx,int idx )
{

    int ct=0;
    if(idx>l)
        return 0;
    if(idx==l)
    {
        if(ctx==k)
        {
            //cout<<l<<"   ";
            //cout<<ctx<<" "<<k<<endl;

            return 1;
           //
        }
        else
            return 0;
    }

    if(s2[idx]!='?')
    {

        if(s2[idx]=='-')
        {

        //cout<<s2[idx]<<endl;
        ct+=fun(ctx-1,idx+1);

        }
        else
            ct+=fun(ctx+1,idx+1);
    }
    else
    {
    ct+=fun(ctx-1,idx+1);

ct+=fun(ctx+1,idx+1);
    }
//cout<<ct<<endl;
    return ct;
}
int main()
{
//    k=0;
    cin>>s1>>s2;
    for(int i=0;i<s1.length();i++)
    {
        if(s1[i]=='-')
            k--;
        else
            k++;

    }
    l=s2.length();
    int x=fun(0,0);
    //cout<<x<<endl;
    int vx=k;
    k=0;
    int f=0;
   double xf=1.0;
    for(int i=0;i<l;i++)
    {
        if(s2[i]=='?')
            k++,f=1,xf=xf*2.0;
    }

    double v=x,px,data=1.0;
    px=x/xf;

    printf("%.15f\n",px);

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

vector<ll> arr(20, 1);
void factorial()
{
	ll product = 1;
	arr[0] = 1;
	for(int i = 1; i < 15; i++)
	{
		product *= i;
		arr[i] = product;
	}
}

int main()
{
	string s1, s2;
	cin >> s1;
	cin >> s2;

	int p = 0, n = 0, unknown = 0;
	for(int i = 0; i < s1.size(); i++)
	{
		if(s1[i] == '+'){p++;}
		else if(s1[i] == '-'){n++;}
	}

	for(int i = 0; i < s2.size(); i++)
	{
		if(s2[i] == '+'){p--;}
		else if(s2[i] == '-'){n--;}
		else{unknown++;}
	}
	if(p < 0 || n < 0){cout << 0;}
	else
	{
		factorial();
		int den = pow(2, unknown);
		//cout << "den is: " << den << endl;
		double num = double(arr[unknown] / (arr[p] * arr[unknown - p])); //
		//cout << "num is: " << num <<endl;
		cout << setprecision(9) <<double(num / den);
	}

	return 0;
}

using namespace std;
#include<bits/stdc++.h>
typedef long long  ll;
typedef   pair<ll,ll>  pii;
typedef   vector< pii > vpii;
typedef   vector<long long>   vi;
typedef   map<string,ll>  msi;
typedef   map<ll,ll>  mii;
///Print
#define out(a)  printf("%lld\n",a)
#define out2(a,b)  printf("%lld %lld\n",a,b)
#define out3(a,b,c)  printf("%lld %lld %lld\n",a,b,c)
#define nl printf("\n")
///Case
#define case(no) printf("Case %lld: ",++no)
#define casenl(no) printf("Case %lld:\n",++no)
#define caseh(no) printf("Case #%lld: ",++no)
#define casehnl(no) printf("Case #%lld:\n",++no)
///Scanf
#define in(n)       scanf("%lld", &n)
#define in2(a,b)    scanf("%lld %lld", &a, &b)
#define in3(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
///LOOP
#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)
#define reps(i,x) for(int  i=0;i<(x.size());i++)
#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)
#define foreach(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)
///Shortcut
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define len(s) s.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
///Min AND Max
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define eps (1e-9)
#define PI acos(-1.0)
#define mod 1e9+7
#define isEq(a,b) (fabs((a)-(b))<eps)
#define Dist(x1,y1,x2,y2) (sqrt(sqr((x1)-(x2))+sqr((y1)-(y2))))
///File
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
/**Define Bitwise operation**/
#define check(n, pos) (n & (1<<(pos)))
#define biton(n, pos) (n | (1<<(pos)))
#define bitoff(n, pos) (n & ~(1<<(pos)))
#define ledzero(n) (__builtin_clz(n))
#define trailzero(n) (__builtin_ctz(n))
#define onbit(n) (__builtin_popcount(n))
///DEBUG
#define d1(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define d2(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define d3(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" = "<<z<<endl;
///Gcd and Lcm
template<class T>T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}
///Bigmod && Pow
template<class T>T my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p
template<class T>T big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}
template<class T> inline T Mod(T n,T m) {return (n%m+m)%m;} ///For Positive Negative No.
///string to int
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}/// extract words or numbers from a line
template<class T> string itos(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}///NOTES:toString(
ll stoi(string s){ll r=0;istringstream sin(s);sin>>r;return r;}///NOTES:toInt(
double toDouble(string s){double r=0;istringstream sin(s);sin>>r;return r;}
//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};///8 Direction
//int col[4] = {1, 0, -1, 0};int row[4] = {0, 1, 0, -1};///4 Directionint
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};///Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0};int dy[]={-1,+1,+2,+1,-1,-2};///Hexagonal Direction

ll ar[204][204],ar1[2000005];
ll a=0,b=0,c=0,r=0,rr=0,res=0,n,m;
string s,s1;
ll dp[505][505];
ll go(ll i,ll pos)
{
    if(i>=len(s1))
    {
        if(c==pos)return 1;
        return 0;
    }

    ll &ret=dp[i][pos];
    if(ret!=-1)return ret;

    ret=0;
    if(s1[i]=='+')
    {
        ret+=go(i+1,pos+1);
    }
    else if(s1[i]=='-')  ret+=go(i+1,pos-1);
    else
    {
        ret+=go(i+1,pos+1);
        ret+=go(i+1,pos-1);
    }
    return ret;
}

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(false);

    mem(dp,-1);

        cin>>s>>s1;
        reps(i,s)
        {
            if(s[i]=='+')c++;
            else c--;
        }

        ll aa=1;
        reps(i,s1)
        {
            if(s1[i]=='?')
            {
                aa*=2;
            }
        }
       ll  bb=go(0,0);
        cout<<fixed<<setprecision(10)<<double(bb)/double(aa);

   return 0;

}

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>

using namespace std;

string a, b;
int  memo[100][100], target;

int dp(int i, int sum) // el zaher kda
{
    if (i == a.size())
        return sum == target;

    int &ret = memo[i][sum];
    if ( ret != -1)
        return ret;

    if (b[i] == '+')
    {
        ret = dp(i + 1, sum + 1);
    }
    else if (b[i] == '-')
    {
        ret = dp(i + 1, sum - 1);
    }
    else
    {
        ret = dp(i + 1, sum + 1) + dp(i + 1, sum - 1);
    }

    return ret;
}

int main()
{
    memset(memo, -1, sizeof memo);

    cin >> a >> b;

    for (int i = 0; i < a.size(); i++){
        if (a[i] == '+')
            target++;
        else
            target--;
    }

    int count = 0;
    for (int i = 0; i < b.size(); i++)
        if (b[i] == '?')
            count++;

    double valids =  dp(0, 0);

    cout.precision(20);

    cout << valids / pow(2, count);

}

#include<bits/stdc++.h>
using namespace std;
int solve(int i,int x,int y,string &s){
    if(i==s.size())return x==y;
    if(s[i]!='?')return solve(i+1,x,y,s);
    return solve(i+1,x,y-1,s)+solve(i+1,x,y+1,s);
}
int main()
{
int x=0,y=0,q=0;
string s,s2;
cin>>s>>s2;
for(char ch:s){
    if(ch=='+')x++;
    else x--;
}
for(char ch:s2){
    if(ch=='+')y++;
    else if(ch=='-')y--;
    else q++;
}
q=1<<q;
cout<<setprecision(12)<<fixed<<solve(0,x,y,s2)*1.0/q;
return 0;
}

#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>

using namespace std;

constexpr char positive     {'+'};
constexpr char negative     {'-'};
constexpr char unrecognized {'?'};

inline void use_io_optimizations()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

unsigned int factorial(unsigned int n)
{
    unsigned int result {1};

    for (unsigned int i {2}; i <= n; ++i)
    {
        result *= i;
    }

    return result;
}

int main()
{
    use_io_optimizations();

    string sent;
    string received;

    cin >> sent >> received;

    int positive_count     {0};
    int negative_count     {0};
    int unrecognized_count {0};

    for (char symbol : sent)
    {
        switch (symbol)
        {
        case positive:
            ++positive_count;
            break;

        case negative:
            ++negative_count;
            break;
        }
    }

    for (char symbol : received)
    {
        switch (symbol)
        {
        case positive:
            --positive_count;
            break;

        case negative:
            --negative_count;
            break;

        case unrecognized:
            ++unrecognized_count;
            break;
        }
    }
    cout << fixed << setprecision(12);

    if (positive_count < 0 || negative_count < 0)
    {
        cout << 0.0 << '\n';
        return 0;
    }

    unsigned int all_choices     = pow(2.0, unrecognized_count);
    unsigned int correct_choices = (factorial(unrecognized_count) /
                                    factorial(positive_count)     /
                                    factorial(negative_count));

    cout << static_cast<double>(correct_choices) / all_choices << '\n';

    return 0;
}

#include<iostream>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
	string s1, s2;
	double c1 = 0, c2 = 0, p1 = 0, p2 = 0;
	cin >> s1 >> s2;
	for (int i = 0; i < s1.size(); ++i)
	{
		if (s1[i] == '+')
			p1++;
		else p1--;
	}
	for (int i = 0; i < s2.size(); i++)
	{
		if (s2[i] == '+')
			p2++;
		else if (s2[i] == '-')
			p2--;
		else c1++;
	}
	for (int i = 0; i <= pow(2, c1) - 1; i++)
	{
		int t = p2, t2 = i;
		for (int j = 0; j < c1; j++)
		{
			int t1 = t2 % 2;
			t2 /= 2;
			if (t1 == 0)
				t--;
			else t++;
		}
		if (t == p1)
			c2++;
	}
	double c = 1.0000;
	if (c1 != 0)
		c = c2 / pow(2, c1);
	else
	if (p1 != p2)
		c = 0;
	cout <<fixed<<showpoint<<setprecision(12) <<c << endl;

	return 0;

}

#include <bits/stdc++.h>

using namespace std;

double sum = 0;

void combos(int diff, int nr, int i, int end){
	if(i == end){
		if(nr == diff)
			sum++;
	}
	else{
		i++;
		combos(diff, nr + 1, i, end);
		combos(diff, nr - 1, i, end);
	}
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

	string sent;
	string rec;

	cin >> sent >> rec;

	int pol1 = 0;
	int pol2 = 0;
	int unrec = 0;

	for(int i = 0; i < sent.length(); i++){
		if(sent.at(i) == '+'){
			pol1++;
		}
		else{
			pol1--;
		}
		if(rec.at(i) == '+'){
			pol2++;
		}
		else if (rec.at(i) == '-'){
			pol2--;
		}
		else{
			unrec++;
		}
	}
	if(abs(pol1 - pol2) > unrec){
		cout << double(0);
	}
	else{
		combos(abs(pol1 - pol2), 0, 0, unrec);
		cout << setprecision(10) << sum * pow(0.5, unrec);
	}

}

#include <bits/stdc++.h>

using namespace std;

struct Dreamoon {
    Dreamoon(): asserts(0), total(0) {

    };

    void backtrack(size_t i = 0, int pos = 0) {
        if (i == instructions.size()) {
            if (pos == objective) {
                ++asserts;
            }
            ++total;
            return;
        }
        switch (instructions[i]) {
        case '?':
            backtrack(i + 1, pos + 1);
            backtrack(i + 1, pos - 1);
            break;
        case '+':
            backtrack(i + 1, pos + 1);
            break;
        default:
            backtrack(i + 1, pos - 1);
            break;
        }
    }

    double getProbability() {
        return asserts / total;
    }

    double asserts;
    double total;
    int objective;
    string instructions;
};

int calculateFinal(const string & s) {
    int pos = 0;
    for (char c : s) {
        if (c == '+') {
            ++pos;
        } else --pos;
    }
    return pos;
}

int main() {
    string original, modified;
    cin >> original >> modified;

    Dreamoon d;
    d.objective = calculateFinal(original);
    d.instructions = modified;
    d.backtrack();

    cout << fixed << setprecision(9) << d.getProbability() << endl;

    return 0;
}
// 1538770397133

#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<cstdio>
using namespace std;
char arr1[15],arr2[15];
int p2(int n)
{
	int i,b=1;for(i=0;i<n;i++) b*=2;
	return b;
}

int cc(int u,int n)
{
	if(!n) return 1;
	int i,s=1,t=1;
	for(i=2;i<=n;i++)
	{
		s*=i;
	}

    for(i=u-n+1;i<=u;i++)
    {
    	t*=i;
    }
    return t/s;
}

int main()
{
      cin>>arr1;
     cin>>arr2;
     int l=strlen(arr1);
     int i,s1=0,s2=0,uno=0;
     for(i=0;i<l;i++)
     {
     	switch(arr1[i])
     	{
     		case'+':s1++;break;
     		case'-':s1--;break;
     	}

        switch(arr2[i])
     	{
     		case'+':s2++;break;
     		case'-':s2--;break;
     		case'?':uno++;break;
     	}
     }
     if(abs(s1-s2)>uno) printf("0.000000000");
     else
     {
     	uno-=abs(s1-s2);
     	if(uno%2) cout<<"0.0000000000000";
     	else if(!abs(s1-s2)&&!uno) cout<<"1.0000000000";
     	else
     	{
     		printf("%.16f",(double)cc(uno+abs(s1-s2),uno/2)/(double)p2(uno+abs(s1-s2)));
     	}
     }

	 	return 0;
}

#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;
long double ss;

long long f(int n)
{
	long long a = 1;

	for (int i = 1; i <= n; i++)
	{
		a *= i;
	}

	return a;
}

long long c_n_k(int m, int n)
{
	return f(n) / (f(m) * f(n - m));
}

int main()
{
	string s;
	int sum = 0, non_rec = 0;
	cin >> s;

	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '+')
		{
			sum++;
		}
		else
		{
			sum--;
		}
	}

	cin >> s;

	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '+')
		{
			sum--;
		}
		else
		{
			if (s[i] == '-')
			{
				sum++;
			}
			else
			{
				non_rec++;
			}
		}
	}

	if (non_rec == 0)
	{
		if (sum == 0)
		{
			ss = 1.0;
		}
		else
		{
			ss = 0.0;
		}
	}
	else
	{
		if (non_rec % 2 != abs(sum) % 2)
		{
			ss = 0.0;
		}
		else
		{
			if (abs(sum) > non_rec)
			{
				ss = 0.0;
			}
			else
			{
				sum += non_rec;
				sum /= 2;
				long long c = 1;
				ss = long double(c_n_k(sum, non_rec)) / long double(c << non_rec);
			}
		}
	}

	cout << setiosflags(ios::fixed) << setprecision(12) << ss;
	//cin >> s;
	return 0;
}

//#include <bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.141592653589793238462643383279502884
#define MAX 1000010
#define ll long long
#define mod 1000000007
#define EPS 1E-9

ll fix(ll cur, ll m)
{
	return ((cur%m) + m) % m;
}

ll fast_power(ll x, ll y)
{
	if (y == 0)
		return 1;
	ll temp = fast_power(x, y / 2);
	temp = (temp*temp);
	if (y % 2 != 0)
		temp = temp*x;
	return temp;

}
string str, found;
int real_command, fake_command, marks, ans;

void solve(string s)
{
	if (s.size() == marks)
	{
		int cur = 0;
		for (int i = 0; i < s.size(); i++)
		{
			if (s[i] == '+')
				cur++;
			else
				cur--;
		}
		if (fake_command + cur == real_command)
			ans++;
		return;
	}
	solve(s + '+');
	//s.pop_back();
	solve(s + '-');

}

int main()
{
	cin.tie(0); std::ios::sync_with_stdio(false); cout.tie(0);
	//freopen("kids.in", "r", stdin);
	//freopen("kids.out", "w", stdout);
	cin >> str >> found;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == '+')
			real_command++;
		else
			real_command--;
		if (found[i] == '+')
			fake_command++;
		else if (found[i] == '-')
			fake_command--;
		else
			marks++;
	}
	solve("");
	double tries = pow(2, marks);

	cout << fixed << setprecision(10) << ans / (double)tries << endl;
	return 0;
}

#include <iostream>
#include <string>
#include <cmath>
#include <stdio.h>
using namespace std;

typedef long long int ll;

inline ll choooooooose(ll n, ll k) {
	if (k > n) {
		return 0;
	}
	if (k * 2 > n) {
		k = n - k;
	}
	if (k == 0) {
		return 1;
	}
	ll ans = n;
	for (int i = 2; i <= k; i++) {
		ans *= (n - i + 1);
		ans /= i;
	}
	return ans;
}

int main() {
	string a, b;
	cin >> a >> b;
	ll ad = 0, bd = 0, c = 0;
	for (int i = 0; i < a.size(); i++) {
		if (a[i] == '+') {
			ad++;
		}
		if (a[i] == '-') {
			ad--;
		}
		if (b[i] == '?') {
			c++;
		}
		if (b[i] == '+') {
			bd++;
		}
		if (b[i] == '-') {
			bd--;
		}
	}
	ll dist = bd - ad;

	if(abs(dist)>c){
		printf("%.12f\n", 0.0);
		return 0;
	}

	if ((c - dist) % 2 == 0) {
		ll n = abs(c - dist) / 2;
		double ans = choooooooose(c, n);
		for (int i = 0; i < c; i++) {
			ans /= 2;
		}
		printf("%.12f\n", ans);
	} else {
		printf("%.12f\n", 0.0);
	}
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int fact[1000];
int powe(int x,int y)
{
    int ans=1;
    for(int i=1;i<=x;i++)
    {
        ans=ans*2;
    }
    return ans;
}
int main()
{
    fact[0]=1;
    for(int i=1;i<=11;i++)
    {
        fact[i]=i*fact[i-1];
    }

    string s,k;cin>>s>>k;int cp=0,cm=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='+')
            cp++;
        if(s[i]=='-')
            cm++;
    }
    int kp=0,km=0;
    for(int i=0;i<k.length();i++)
    {
        if(k[i]=='+')
            kp++;
        if(k[i]=='-')
            km++;

    }
    double ans=0;
    if(kp>cp || km>cm )
    {
        ans=0;
    }
    else
    {
        int f=0;
        if(cp!=0)
            f=f+cp-kp;
        if(cm!=0)
            f=f+cm-km;
        int d=fact[f];
        ll z=1;
        if(cp!=0)
        {
            //cout<<"**"<<endl;
            z=z*fact[cp-kp];
        }
        if(cm!=0)
        {
            //cout<<"%%"<<endl;
            z=z*fact[cm-km];
        }
        z=z*powe(f,2);
        double m=d*1.0;double n=z*1.0;
        ans=m/n;//cout<<m<<" "<<n<<endl;
        //cout<<ans;

    }
    cout<<fixed<<setprecision(10)<<ans;

}

#include<iostream>
#include<cmath>

using namespace std;

int main(){
    string a,b;
    cin>>a>>b;
    int len=a.length();
    int ca1=0;
    int ca0=0;
    int cb1=0;
    int cb0=0;
    int cc=0;
    int c1=0;
    int c0=0;
    int m=1,n=1;
    float lv=0.0;
    for(int i=0;i<len;i++){
        if(a[i]!=b[i]){
            if(a[i]=='+'){
                ca1+=1;
            }
            else{
                ca0+=1;
            }
            if(b[i]=='+'){
                cb1+=1;
            }
            else if(b[i]=='-'){
                cb0+=1;
            }
            else{
                cc+=1;
            }
        }
    }
    c1=abs(ca1-cb1);
    c0=abs(ca0-cb0);
    if(c1+c0==cc && cc!=0){
        for(int j=cc;j>c1;j--){
            m=m*j;
        }
        for(int k=cc-c1;k>0;k--){
            n=n*k;
        }
        lv=m/n/pow(2,cc);
    }
    if(c1+c0==cc && cc==0){
        lv=1.0;
    }
    printf("%.12f\n",lv);
}

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
double ncp(ll n,ll r)
{
	if(n==r)return 1;
	if(r==1)return n;
	if(r==0)return 1;
	return (n*ncp(n-1,r-1))/r;
}
int main()
{
	string a,b;
	cin>>a>>b;
	ll af=0;
	for(ll i=0;i<a.size();i++)if(a[i]=='+')af++;else af-- ;
	ll f=0,q=0;
for(ll i=0;i<b.size();i++)
{
	if(b[i]=='+')f++;
	else if(b[i]=='-')f--;
	else q++;
}
ll c=q;
double count=0;
ll tt=pow(2,q);
ll oo=q;
while(c>=0)
{
	//cout<<q<<" "<<f<<" "<<af<<endl;
	if(q+f==af){count+=ncp(oo,c);}
	c--;
	q-=2;
}
//cout<<count<<endl;
double d1=count,d2=tt;
printf("%.9lf",d1/d2);
}

#include<bits/stdc++.h>
using namespace std;
int main(){

    int a,b,c,d,e;
   string s,s1;
   cin >> s >> s1;
   vector<char>vec;
   map<char,int>mp;
   for(int i=0;i<s.size();i++)
    vec.push_back(s[i]);
   int m=0;
   for(int i=0;i<s.length();i++)
   {
       if(find(vec.begin(),vec.end(),s1[i])!=vec.end())
       {
           vec.erase(find(vec.begin(),vec.end(),s1[i]));
           s1[i]='l';
       }
       else if(s1[i]=='?'){
        m++;
       }
   }
   for(int i=0;i<vec.size();i++)
   {
       mp[vec[i]]++;
   }

   if(m==0 && vec.size()==0)
   {
       cout << 1 << endl;
   }
   else if(vec.size()==m)
   {
     d=mp['+'];
     e=mp['-'];
     int ok=1;
     int sum=1,sum1=1,sum2=1;
     for(int i=1;i<=d;i++)
        sum*=i;
     for(int i=1;i<=e;i++)
        sum1*=i;
        for(int i=1;i<=m;i++)
        sum2*=i,ok*=2;
      double p=((double)sum2/((double)sum1*(double)sum))/((double)ok);
         printf("%.10f\n",p);

   }
   else{
    cout << 0 << endl;
   }
}

#include <bits/stdc++.h>
using namespace std;
string a, b;
int len, m= 0, c= 0, p= 0;

int dfs(int pos, int sco) {
    if (pos == len) {
        if (sco == m) return 1;
        else return 0;
    }else {
        if (b[pos] == '+') return dfs(pos+1, sco+1);
        else if (b[pos] == '-') return dfs(pos+1, sco-1);
        else if (b[pos] == '?') {
            return dfs(pos+1, sco+1) + dfs(pos+1, sco-1);
        }
    }
}

int main () {
	cin >> a >> b;

	double ans;

	len = a.length();
	for(int i=0; i<len; i++) {
	    if (a[i] == '+') m++;
	    else if (a[i] == '-') m--;
	}

	for(int i=0; i<len ;i++) {
	    if (b[i] == '?') c++;
	    else if (b[i] == '+') {
	        p++;
	    }else if (b[i] == '-') {
	        p--;
	    }
	}

	if (c == 0) {
	    if (p == m) {
	        ans = 1.0;
	    }else {
	        ans = 0.0;
	    }
	}else {
	    int x = p+c, y = p-c;
	    if (m > x || m < y ) {
	        ans = 0.0;
	    }else {
	        ans = dfs(0,0)/double(pow(2,c));
	    }
	}

	cout << fixed;
	cout << setprecision(9) << ans;

	return 0;
}

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;
int hsy[100005];
char a[100005],b[100005];
void dfs(int x,int s)
{
    if(x==0)
    {
        hsy[s+15]++;
        return ;
    }
    dfs(x-1,s+1);
    dfs(x-1,s-1);
}
int main()
{
    int ans=0;
    scanf("%s%s",a,b);
    int lena=strlen(a);
    int  lenb=strlen(b);
    for(int i=0; i<lena; i++)
    {
        if(a[i]=='+')ans++;
        else ans--;
    }
    int tmp=0;
    int bb=0;
    for(int i=0; i<lenb; i++)
    {
        if(b[i]=='+')tmp++;
        else if(b[i]=='-')tmp--;
        else bb++;
    }
    double anss;
   memset(hsy,0,sizeof hsy);
    if(bb==0)
    {
        if(tmp==ans)
        {
            anss=1.0;
        }
        else anss=0;
    }
    else
    {
        dfs(bb,tmp);
        int sum=1;
        for(int i=1; i<=bb; i++)sum*=2;
        anss=hsy[ans+15]*1.0/sum*1.0;
    }

    printf("%.12f\n",anss);
    return 0;
}
//2019-07-26 19:42:34.309

#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

int fact(int n)
{
    if(n==0)
        return 1;
    else
        return n*fact(n-1);
}

int main()
{
    string str1,str2;
    cin>>str1;
    cin>>str2;
    int sum=0,j=0;
    while(str1[j]!='\0')
    {
        if(str1[j]=='+')
            sum=sum+1;
        else
            sum=sum-1;

            j++;
    }

    int nq=0,i=0,sum2=0;

    while(str2[i]!='\0')
    {
        if(str2[i]=='+')
            sum2++;
        else if(str2[i]=='-')
            sum2--;
        else if(str2[i]=='?')
            nq++;
        i++;
    }

    int temp=nq;
    int test=sum-sum2;
      if(abs(test)>nq)
      {
          nq=0;

      }

    if(nq!=0)
    {

      int dc=nq-test;
      int m=dc/2;

      int a=nq-m;

      int possible=fact(nq)/(fact(m)*fact(a));

      float tot=pow(2,nq);

      float prob=possible/tot;

     printf("%0.12f",prob);
    }
    else
    {
        if(sum==sum2)
            cout<<"1.000000000000";
        else
            cout<<"0.000000000000";
    }

    return 0;

}

#include <bits/stdc++.h>
using namespace std;
long long fact(int a)
{
    if(a==0)
        return 1;
    long long res = 1;
    for(int i = 1;i<=a;i++)
        res*=i;
    return res;
}
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int a = 0;
    for(int i=0;i<s1.size();i++)
        if(s1[i]=='+')
            a++;
        else
            a--;
    int re = 0,count = 0;
    for(int i=0;i<s2.size();i++)
    {
        if(s2[i] == '+')
            re++;
        else if(s2[i] == '-')
            re--;
        else
            count++;
    }
    double res = 0;
    long long arr[100][100];
    memset(arr,0,sizeof(arr));
    if(re == a && count == 0)
        res = 1.0;
    else if(count>=1)
    {
        double total=0,sum = (1<<count);
        for(int i=1;i<=10;i++){
            for(int j = 0;j<=i;j++){
                arr[i][j] = fact(i)/(fact(j)*fact(i-j));
            }
        }
        for(int i = -1*count,cnt = 0; i<=count ; i+=2,cnt++)
        {
            if((i+re) == a)
                total += arr[count][cnt];
        }
        res = total / sum;
    }
    else
        res = 0;
    printf("%.9lf\n",res);
    return 0;
}

#include <iostream>
#include <string>
#include <cstdlib>
#define forn(i, n) for(int i = 0; i < n; i ++)
#define fornn(i, m, n) for(int i = m, i < n; i ++)

using namespace std;

int count1 = 0;
int countall = 0;
int balance = 0;
int balb = 0;
int n;

void fun(int i, int raz){
    if (i == n){
     //   cout << balance << endl;
        countall ++;
        if (balance == raz)
            count1 ++;
    }
    else{
        balance ++;
        fun(i + 1, raz);
        balance -= 2;
        fun(i + 1, raz);
        balance ++;
    }
}

int main(){
    string a;
    string b;
    cin >> a >> b;
    int sa = 0;
    int sb = 0;
    int sc = 0;
    for (int i = 0; i < a.size(); i ++){
        if (a[i] == '+'){
            sa ++;
        }
        else
            sa --;
        if (b[i] == '?'){
            sc ++;
        }
        if (b[i] == '+')
            sb ++;
        if (b[i] == '-')
            sb --;
    }
 //   cout << sa << ' ' << sb << ' ' << sc << endl;
    n = sc;
    balb = sb;
    int raz = sa - sb;
    if (raz == 0 && sc == 0){
        cout << 1;
        exit(0);
    }
    if (raz > 0){
        if (sc < raz)
            cout << 0;
        else{
            fun(0, raz);
            cout.precision(11);
            cout << double(count1) / double(countall);
        }
    }
    else{
        if (- 1 * sc > raz)
            cout << 0;
        else{
            fun(0, raz);
          //  cout << count1 << ' ' << countall
          //  << endl;
            cout.precision(11);
            cout << double(count1) / double(countall);
        }

    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <utility>
#include <iomanip>

int main() {
	std::string s;
	std::string t;
	std::cin >> s >> t;
	std::vector<char> v;
	std::map<char, double> m;
	std::map<char, double> ma;
	for (int k = 0; k < s.length(); k++) {
		m[s[k]]++;
	}
	for (int k = 0; k < t.length(); k++) {
		ma[t[k]]++;
	}
	if (ma['?'] == 0) {
		if (m['+'] == ma['+'] ) {
			double t = 1;
			std::cout << std::fixed << std::setprecision(12) << t << '\n';
			return 0;
		}
		else {
			double r = 0;
			std::cout << std::fixed << std::setprecision(12) << r << '\n';
			return 0;
		}
	}
	if (m['-'] < ma['-'] || m['+'] < ma['+']) {
		double t = 0;
		std::cout << std::fixed << std::setprecision(12) << t << '\n';
		return 0;
	}
	else {
		double y = ma['?'];
		double x = m['+'] - ma['+'];
		double z = m['-'] - ma['-'];
		double q = std::max(x, z);
		double c = std::min(x, z);
		double t = 1;
		double w = 1;
		double s = pow(2, y);
		for (double r = y; r > q; r--) {
			t = t * r;
		}
		for (double r = c; r > 0; r--) {
			w = w * r;
		}
		std::cout << std::fixed << std::setprecision(12) << t / (w * s);
		return 0;
	}
}

#include <iostream>
#include <cmath>
#include <string>
#include <cstdio>
#include <algorithm>

using namespace std;
int kol1, kol2, t;
string s, s1;
void rec(int a, int b){
    if (a == s1.size()){
        kol1++;
        if(b == t)
            kol2++;
        return;
    }
    if (s1[a] == '+')
        rec(a + 1, b + 1);
    else
        if (s1[a] == '-')
            rec(a + 1, b - 1);
    else{
        rec(a + 1, b + 1);
        rec(a + 1, b - 1);
    }
}
int main(){

    cin >> s >> s1;
    sort(s.begin(), s.end());
    sort(s1.begin(), s1.end());
    for (int i = 0; i < s.size(); i++)
        if (s[i] == '+')
            t++;
        else
            t--;
    rec(0, 0);
    printf("%.9lf", double(kol2) / double(kol1));

    return 0;
}

#include <iostream>
#include <vector>
#include <limits>
#include <fstream>
#include <memory>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

int countOnes(int num, int countNonDet)
{
    int res = 0;
    for (int i = 0; i < countNonDet; ++i)
    {
        res += num & 1 ? 1 : 0;
        num >>= 1;
    }

    return res;
}

double find(string a, string b)
{
    int posA = 0;

    for (char c : a)
    {
        posA += c == '+' ? 1 : -1;
    }

    int posB = 0;
    int countNonDet = 0;

    for (char c : b)
    {
        if (c == '+')
        {
            ++posB;
        }
        else if (c == '-')
        {
            --posB;
        }
        else // c == '?'
        {
            ++countNonDet;
        }
    }

    if (posA == posB && !countNonDet)
    {
        return 1.0;
    }

    int equal = 0;

    for (int i = 0; i < 1 << countNonDet; ++i)
    {
        int ones = countOnes(i, countNonDet);

        int tmp = posB + ones - (countNonDet - ones);
        if ( tmp == posA)
        {
            ++equal;
        }
    }

    return (double)equal / (double)(1 << countNonDet);

}

int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    cout << setprecision(10) << find(s1,s2);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define fori(i,x,n) for(int i=x;i<n;i++)
#define forie(i,x,n) for(int i=x;i<=n;i++)
int tSum[11],sum1=0,sum2=0,cnt=0,x;
float per=0;
string st1,st2;
int com(int n,int k){
	int sum=1,cnk=1,cn=n,l=k,tot;
	while(l>0){
		sum*=l;
		l--;
	}
	for(int i=0;i<k;i++){
		cnk*=cn;
		cn--;
	}
	tot = cnk/sum;
	return tot;
}
int main(){
	cin>>st1;
	fori(i,0,st1.length())(st1[i]=='+')?sum1++:sum1--;
	cin>>st2;
	fori(i,0,st2.length()){
		if(st2[i]=='+')sum2++;
		else
		if(st2[i]=='-')sum2--;
		else
		if(st2[i]=='?')cnt++;
	}
	float totalp=(float) pow(2.0,(cnt+0.0));
	if(sum1==sum2 && cnt==0)
	{
		printf("%.12f",1.0);
		return 0;
	}
	if(sum2+cnt==sum1){
		per = (float) (1/totalp);
		printf("%.12f",per);
		return 0;
	}
	tSum[0]=sum2+cnt;
	for(int i=1;i<=cnt;i++){
		tSum[i]=tSum[i-1]-2;
		if(tSum[i]==sum1){
			x=com(cnt,i);
			per=(float)(x/totalp);
			printf("%.12f",(per+0.0));
			return 0;
		}
	}
	printf("%.12f",0.0);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 50;

string s;
ll x, q, f[N], inv[N];

ll fexp (ll b, ll e) {
    ll ans = 1;
    while (e) {
        if (e&1) ans = (ans*b) % MOD;
        b = (b*b) % MOD;
        e >>= 1;
    }
    return ans;
}

ll bin (ll i, ll j) {
    ll ans = f[i];
    ans *= inv[j];        ans %= MOD;
    ans *= inv[abs(i-j)]; ans %= MOD;
    return ans;
}

int main () {
    f[0] = f[1] = 1;
    for (int i = 2; i < N; i++) f[i] = (i*f[i-1]) % MOD;
    for (int i = 0; i < N; i++) inv[i] = fexp(f[i], MOD-2);
    cin >> s;
    for (auto c : s) {
        if (c == '+') x++;
        if (c == '-') x--;
    }
    cin >> s;
    for (auto c : s) {
        if (c == '-') x++;
        if (c == '+') x--;
        if (c == '?') q++;
    }
    ll num = 0;
    for (ll i = 0; i <= q; i++)
        if (abs(2*i-q) == abs(x))
            num = bin(q, i);
    printf("%.10lf\n", (double) num/fexp(2, q));
    return 0;
}

// 1520892233348

#include<iostream>
#include<algorithm>
#include<string>
#include<set>
#include<memory.h>
#include<vector>
#include<stdio.h>
#include<unordered_map>
#include<map>
#include<queue>
#include<stack>
#include<sstream>
using namespace std;
#define Max 1000001
typedef long long ll;
int n;
string a, b;
int freq[2][2];
int sum = 0;
typedef long double ld;
ld cal(int x, int e){
	if (x==n)
	if (e == sum)
		return 1;
	else
		return 0;
	if (b[x] == '+')
		return cal(x + 1, e + 1);
	if (b[x] == '-')
		return cal(x + 1, e - 1);
	return .5*cal(x + 1, e + 1) + .5*cal(x + 1, e - 1);
}
int main(){
//	cout << (.3)*(.3)*(.3) << endl;
	cin >> a >> b;
	n = a.length();
	for (int i = 0; i < n; i++)
	{
		sum = sum+(a[i] == '+' ? 1 : -1);
	}
	printf("%.12lf", cal(0, 0));

}

#include <bits/stdc++.h>
using namespace std;
#define fori(i,x,n) for(int i=x;i<n;i++)
#define forie(i,x,n) for(int i=x;i<=n;i++)
int tSum[101],sum1=0,sum2=0,cnt=0,x;
float per=0;
string st1,st2;
int com(int n,int k){
	int sum=1,cnk=1,cn=n,l=k,tot;
	while(l>0){
		sum*=l;
		l--;
	}
	for(int i=0;i<k;i++){
		cnk*=cn;
		cn--;
	}
	tot = cnk/sum;
	return tot;
}
int main(){
	cin>>st1;
	fori(i,0,st1.length())(st1[i]=='+')?sum1++:sum1--;
	cin>>st2;
	fori(i,0,st2.length()){
		if(st2[i]=='+')sum2++;
		else
		if(st2[i]=='-')sum2--;
		else
		if(st2[i]=='?')cnt++;
	}
	float totalp=(float) pow(2.0,(cnt+0.0));
	if(sum1==sum2 && cnt==0)
	{
		printf("%.12f",1.0);
		return 0;
	}
	if(sum2+cnt==sum1){
		per = (float) (1/totalp);
		printf("%.12f",per);
		return 0;
	}
	tSum[0]=sum2+cnt;
	for(int i=1;i<=cnt;i++){
		tSum[i]=tSum[i-1]-2;
		if(tSum[i]==sum1){
			x=com(cnt,i);
			per=(float)(x/totalp);
			printf("%.12f",(per+0.0));
			return 0;
		}
	}
	printf("%.12f",0.0);
	return 0;
}

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<limits.h>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<cassert>
#include<cctype>
#include<cstring>

#define IT(a,it) for(auto it=a.begin(); it != a.end(); it++)
#define ITT(a,it) for(typeof(a.begin()) it=a.begin();it!=a.end();it++)
#define REV_IT(a,it) for(auto it=a.rbegin(); it != a.rend(); it++)
#define REV_ITT(a,it) for(typeof(a.rbegin()) it=a.rbegin(); it != a.rend(); it++)
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define INF (int)(1e9)
#define L_INF (LL)(1e18)
#define EPS (double)(1e-9)
#define L_EPS (LD)(1e-18)
#define PI (double)(3.141592653589793238)
#define MAXX 100005

using namespace std;

typedef pair <int, int> pi_i;

bool cmp(int a, int b){ return a>b; }

string s1, s2;
multimap<int, int> mm;

void solve(int idx, int vvv){
    if(idx >= s2.size()){
        mm.insert(MP(vvv, 0));
        return;
    }
    if(s2[idx] == '+') solve(idx+1, vvv+1);
    if(s2[idx] == '-') solve(idx+1, vvv-1);
    if(s2[idx] == '?'){
        solve(idx+1, vvv+1);
        solve(idx+1, vvv-1);
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    //freopen("out.txt","w",stdout);

    cin>>s1>>s2;
    int v1 = 0;
    for(int i=0;i<s1.size();i++){
        if(s1[i] == '+'){
            v1+= 1.0;
        }else{
            v1-=1.0;
        }
    }
    solve(0, 0);
    auto it = mm.find(v1);
    int ct1 = 0, ct2 = mm.size();
    while(it != mm.end()){
        if(it->FF != v1){
            break;
        }else ct1 += 1;
        it++;
    }
    double ans = (double)ct1/(double)ct2;
    printf("%.12Lf\n", ans);
return 0;
}

// Utilities library
#include <cstdlib>
#include <bitset>
#include <functional>
#include <utility>
#include <tuple>
#include <limits>
#include <cinttypes>
#include <cassert>
// Strings library
#include <cctype>
#include <cstring>
#include <string>
//Containers library
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
// Algorithms library
#include <algorithm>
// Iterators library
#include <iterator>
// Numerics library
#include <cmath>
#include <complex>
#include <valarray>
#include <numeric>
// Input/Ouput library
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
// Localization library
#include <locale>
// Regular expressions library
#include <regex>

// Support code
using std::cout;
using std::cin;
using std::size_t;

template <class Function>
void repeat(std::size_t n, Function f) {
    while(n--) f();
}

template <class T>
T input_value(std::istream& input = std::cin) {
    T value;
    input >> value;
    return value;
}
template <class T>
T powi( size_t exponent , T  base ){
  T pot = 1;
  while(exponent--){
    pot *=base;
  }
  return pot;
}
template <class T>
T fact( T i){
  T prod = i;
  while(--i)
      prod *= i;
  return prod;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::string s1,s2;
    cin>>s1>>s2;

    long long Plus_s1=0,Plus_s2=0;
    long long Substract_s1=0,Substract_s2=0;
    long long questions = 0;

    for (size_t i = 0; i < s1.size(); i++) {
      if( s1[i] == '+')
        Plus_s1++;
      else
        Substract_s1++;
    }

    for (size_t i = 0; i < s1.size(); i++) {
      if( s2[i] == '+')
        Plus_s2++;
      else if (s2[i] == '-')
        Substract_s2++;
      else
        questions++;
    }
    // std::cout << "Plus_s1 : "<<Plus_s1 <<" Substract_s1 :"<<Substract_s1 << '\n';
    // std::cout << "Plus_s2 : "<<Plus_s2 <<" Substract_s2 :"<<Substract_s2 << '\n';
    long long sum1 = Plus_s1 - Substract_s1;
    long long sum2 = Plus_s2 - Substract_s2;
    std::vector<size_t> factor(11,1);
    for (size_t i = 2; i < factor.size(); i++) {
      //std::cout << " i + 1 : "<<i+1 <<"    : "<< factor.at(i-1)<<'\n';
        factor.at(i) = (i) * factor.at(i-1);
    }
    // for(auto elem : factor)
    //   std::cout << elem << " ";
    // std::cout  << '\n';
    //std::cout << "sum2 :"<<sum2<<" sum1 :"<<sum1<<" questions :"<<questions << '\n';
    //std::cout << " Cantidad de + : "<< << '\n';
    if (questions == 0){
      if ( sum1 == sum2)
        std::cout << std::fixed<<std::setprecision(10)<<float(1) << '\n';
      else
        std::cout << std::fixed<<std::setprecision(10)<<float(0) << '\n';
    }
    else{
      // std::cout << Plus_s1 - Plus_s2 << '\n';
      // std::cout << "sum1 : "<<sum1 <<" sum2 : "<< sum2 - questions <<" " <<sum2 + questions<< '\n';
      if( sum1 >= sum2 - questions && sum1 <= sum2 + questions ){
        long long k1 = Plus_s1 - Plus_s2;
        //std::cout << k1 - questions << '\n';
        //long long k2 = Substract_s1 - Substract_s2;
        std::cout << std::fixed <<std::setprecision(10);
        std::cout << ( factor.at( questions ) / ( factor.at(k1) * factor.at( questions - k1 ) ) ) * powi(questions,0.5)  << '\n';

      }
      else
        std::cout << std::fixed<<std::setprecision(10)<<float(0) << '\n';
    }
    // ( q! / (k! * ( k - q)! ) ) * p^k * (1-p)^(q-k);
}

// 1500683608151

#include<stdio.h>
#include<string.h>
int jiecheng(int a){
	int i,j=1;
	for(i=1;i<=a;i++) j*=i;
	return j;
}
int pow(int a,int b){
	int m=1;
	while(b--) m*=a;
	return m;
}
int c(int a,int b){
	return jiecheng(a)/(jiecheng(b)*jiecheng(a-b));
}
int main(){
	char a[100]={};
	char b[100]={};
	float gailv;
	int m,n,i,j,k,a1=0,a2=0,a3=0;
	scanf("%s",a);
	scanf("%s",b);
	for(i=0;i<strlen(a);i++){
		if(a[i]=='+') a1++;
		if(a[i]=='-') a2++;
	}
	for(i=0;i<strlen(b);i++){
		if(b[i]=='+') a1--;
		if(b[i]=='-') a2--;
		if(b[i]=='?') a3++;
	}
	if(a1<0||a2<0){
		printf("0.000000000\n");
		return 0;
	}
	gailv=(float)c(a1+a2,a1)/(float)(pow(2,a1+a2));
	printf("%.9f",gailv);
}

#include <iostream>
#include <string>
#include <math.h>
#include <cstdio>
using namespace std;

double C( int n , int k)
{
    if ( k > n)
        return 0;
    if ( k == 0 || k == n)
        return 1;
    if ( k == 1 && n > k)
        return n;
    return C(n-1 , k-1) + C(n-1 , k);
}
int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    double ans = 1.000000;
    int e = 0, t = 0;
    for (int i = 0 ;i < s1.size() ; i++)
    {
        if (s1[i] == '+')
            e++;
        if (s2[i] == '+')
            e--;
        else if (s2[i] == '?')
            t++;
    }
    //
    if ( t == 0)
    {
        if ( e == 0){
            cout << ans;
            return 0;
        }
        else
        {
            cout << 0;
            return 0;
        }
    }
    if ( e < 0 || (e - t)> 0)
    {
        ans = 0;
        cout << ans;
        return 0;
    }
    double ans2 = 1 , ans1;
    ans2 = pow(2 , t);

    cerr << t << ":" << e << endl;

    ans1 = C( t , e );
    ans = ans1/ans2;

    cerr << ans1 << "/" << ans2 << endl;
    printf("%.12f\n",ans);
    return 0;
}

//CodeForces 476B
#include<iostream>
#include <iomanip>
#include<string>
#include<math.h>

using namespace std;

long long int C(int n,int k)
{

  long long int a = 1;
  for(int i = 0;i < k; i++)
  {

      a = a * (n-i) / (i+1);

  }
  return a;
}

int main()
{

  string s1;
  string s2;
  cin>>s1>>s2;

  int p1 = 0;
  int p2 = 0;
  int q2 = 0;
  double p = 0.0;

  for(int i = 0;i < s1.length();i++)
  {

    if(s1[i] == '+') p1++;
    if(s2[i] == '+') p2++;
    else if(s2[i] == '?') q2++;

  }
  if(p1 < p2 || q2 < (p1-p2))
  {

    p = 0.0;
    cout << fixed;
    cout << setprecision(10) << p << endl;

  }
  else
  {

    cout << fixed;
    cout << setprecision(10) << (double)C(q2,(p1-p2)) / pow(2,q2) << endl;

  }

}

#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<sstream>
#include<stack>
#include<queue>
#include<bitset>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<stdio.h>
#include<fstream>
using namespace std;
#define PI 3.14159265358979323846
#define ll long long
int main()
{
    string s1, s2; int sum1 = 0, sum2 = 0, sum = 0; cin >> s1 >> s2; int sumP1 = 0, sumN1 = 0, sumP2 = 0, sumN2 = 0;
    for (int i = 0; i < s1.length(); i++)
    {
        if (s1[i] == '+'){ sum1++; sumP1++; }
        if (s1[i] == '-'){ sum1--; sumN1++; }
        if (s2[i] == '+'){ sum2++; sumP2++; }
        if (s2[i] == '-'){ sum2--; sumN2++; }
        if (s2[i] == '?')sum++;
    }
    if ((sum1 == sum2&&sum == 0) || (sum1 == sum2&&sum % 2 != 0))cout << 1.00000000000000 << endl;
    else
    if ((sum1 != sum2) && sum == 0)cout << .0000000000000 << endl;
    else
    {
        double oraginal = sum2, sum3 = 0; int x = sum, y = 0;
        while (y != sum + 1)
        {
            sum2 += (x - y);
            if (sum1 == sum2){ sum3++; break; }
            sum2 = oraginal;
            x--, y++;
        }
        if (sum3 == 0)cout << .00000000000 << endl;
        else
        {
            string s; double ans = 0;
            for (int i = 0; i < x; i++)s += '+'; for (int i = 0; i < y; i++)s += '-'; sort(s.begin(), s.end());
            do
            {
                ans++;
            } while (next_permutation(s.begin(), s.end()));
            cout << fixed << setprecision(10) <<ans/ pow(2, double(sum)) << endl;
        }
    }
}

#include<bits/stdc++.h>
using namespace std;

double rec(int n, int k){
    if(k==1) return n;
    if(k==n||k==0) return 1;
    double p=n;
    for(int i=1; i<k; i++){
        p*=(n-i);
        p/=(i+1);
    }return p;
}

int main(){
    string a, b;
    long double ans=0;
    cin>>a>>b;
    int val=0, n= a.length(), pl=0, pl2=0;
    for(int i=0; i<n; i++){
        if(a[i]=='+'){val++;pl++;}
        else val--;
    }
    int nval=0, q=0;
    for(int i=0; i<n; i++){
        if(b[i]=='?') q++;
        else if(b[i]=='+') {nval++; pl2++;}
        else nval--;
    }
    cout<<fixed;
    if(q==0)
    if(val==nval){
        cout<<setprecision(12)<<(double)1<<endl;
    return 0;
    }else{
        cout<<setprecision(12)<<0<<endl;
        return 0;
    }
    if(pl<pl2){
        cout<<setprecision(12)<<(double)0<<endl;
    return 0;
    }
    int diff=abs(pl-pl2);
   // cout<<diff<<endl;
    if(diff>q){cout<<setprecision(12)<<ans<<endl;return 0;}
    double pow=1;
    for(int i=0; i<q; i++)pow*=2;
  //  cout<<rec(q, diff)<<" "<<pow<<endl;
    cout<<setprecision(12)<<(double)rec(q, diff)/(double)pow<<endl;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <limits>
#include <map>

using namespace std;

unsigned long long nchoosek(unsigned long long n,
        unsigned long long k) {
    if(k==0) return 1;
    if(n==0) return 0;
    return nchoosek(n-1, k-1)+nchoosek(n-1,k);
}

int main() {

    string in;
    string rec;
    getline(cin, in);
    getline(cin, rec);

    int input = 0;
    int received = 0;
    int qmarks = 0;

    for (int i = 0; i < in.length(); i++) {
        if (in[i] == '+') {
            input++;
        } else if (in[i] == '-') {
            input--;
        } else if (in[i] == '?') {
            continue;
        } else {
            cout << "uh oh" << endl;
        }
    }

    for (int i = 0; i < rec.length(); i++) {
        if (rec[i] == '+') {
            received++;
        } else if (rec[i] == '-') {
            received--;
        } else if (rec[i] == '?') {
            qmarks++;
        } else {
            cout << "uh oh" << endl;
        }
    }

    int diff = abs(input - received);
    cout.precision(10);

    if (qmarks > 0) {
        //cout << "qmarks: " << qmarks << endl;
        //cout << "diff: " << diff << endl;

        if (diff > qmarks) {
            cout << 0.0;
            return 0;
        }

        if (qmarks % 2 == 0) {
            if (diff % 2 == 1) {
                cout << 0.0;
                return 0;
            } else {
                unsigned long long combs = nchoosek(qmarks,
                        (qmarks + diff)/2);
                //cout << "combs: " << combs << endl;
                unsigned long long exp = 1;
                while (qmarks > 0) {
                    exp = exp * 2;
                    qmarks--;
                }
                //cout << "exp: " << exp << endl;
                double res = ((double)combs) / exp;
                cout << res;
                return 0;
            }
        } else {
            if (diff == 0) {
                cout << 0.0;
                return 0;
            }
            if (diff % 2 == 0) {
                cout << 0.0;
                return 0;
            }
            if (diff == qmarks) {
                unsigned long long exp = 1;
                while (qmarks > 0) {
                    exp = exp * 2;
                    qmarks--;
                }
                double res = ((double)1.0) / exp;
                cout << res;
                return 0;
            }
        }

        unsigned long long combs = nchoosek(qmarks,
            (diff+qmarks)/2);
        //cout << "combs: " << combs << endl;
        unsigned long long exp = 1;
        while (qmarks > 0) {
            exp = exp * 2;
            qmarks--;
        }

        //cout << "exp: " << exp << endl;

        double res = ((double)combs) / exp;

        cout << res;

    } else {
        if (diff == 0) {
            cout << 1.0;
        } else {
            cout << 0.0;
        }
    }

    return 0;
}

//~ #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

using namespace std;
typedef unsigned long long int llu;

vector<int> v;
void solve(int unrec, int pos) {
	//~ cout << unrec << " " << pos << endl;
	if (!unrec) {
		v.push_back(pos);
		return;
	}

	solve(unrec - 1, pos - 1);
	solve(unrec - 1, pos + 1);
}

int main() { ios_base::sync_with_stdio(false);
	int dpos = 0;
	int cpos = 0;
	int unrec = 0;
	string s;
	cin >> s;
	for (auto c: s)
		if (c == '-') dpos--;
		else dpos++;

	cin >> s;
	for (auto c: s) {
		if (c == '-') cpos--;
		else if (c == '+') cpos++;
		else unrec++;
	}

	// cout << delta << endl << endl;

	//~
	//~
	//~ if (delta > unrec) {
		//~ cout << 0.0F;
	//~ } else {
		//~ double p = 1;
		//~ while (delta--) {
			//~ p *= 0.5;
			//~ unrec--;
		//~ }
		//~
		//~ while (unrec > 1) {
			//~ unrec -= 2;
			//~ p *= 0.5;
		//~ }
		//~
		//~ cout << p;
	//~ }
	//~

	solve(unrec, cpos);
	//~ for(auto e: v) {
		//~ cout << e << " ";
	//~ }cout << endl;
	int count = 0;
	for (auto e: v)
		if (e == dpos)
			count++;

	//~ for (auto e: v) cout << e << " ";
	printf("%.12f\n", (double) count / v.size());

	return 0;
}

/*template created by */
#include <bits/stdc++.h>
#define SI set<int>
#define VI vector<int>
#define ull unsigned long long
#define inint(a) scanf("%d",&a)
#define input(a) cin>>a
#define ll long long
#define f first
#define s second
#define len(s) s.length()
#define range(a,b,n) for(int i=a;i<b;i+=n)
ull mulmod(ull a,ull b,ull c){
    ull x = 0,y=a%c;
    while(b > 0){
        if(b%2 == 1){
            x = (x+y)%c;
        }
        y = (y*2)%c;
        b /= 2;
    }
    return x%c;
}
ull pow(ull a, ull b, ull c){
    ull x = 1, y = a;

    while(b>0){
        if(b&1) x = mulmod(x,y,c);
        y = mulmod(y,y,c);
        b >>= 1;
    }

    return x;
}
using namespace std;
vector<ll> fact(11);
double f(int n, int r){
    return (fact[n] / (fact[n - r] * fact[r]));
}
int main()
{
  ll pos = 1;
  fact[0] = 1;
  for(int i = 1 ; i <= 10; i++){
      fact[i] = pos * i;
      pos = fact[i];
  }
  string a, b;
  int proa = 0, prob = 0;
  cin >> a >> b;
  for(int i = 0 ; i < len(a); i++){
      if(a[i] == '+'){
          proa++;
      }
      else {
          proa--;
      }
  }
  int places = 0;
  for(int i = 0 ; i < len(b); i++){
      if(b[i] == '+'){
          prob++;
      }
      else if(b[i] == '-'){
          prob--;
      }
      else {
          places++;
      }
  }
  double ans = 0.0;
  cout << setprecision(20) << fixed;
  /*if(places == 0){
      ans = 1.0;
      cout << ans << endl;
      return 0;
  }*/
  //cout << places << " " << abs(proa - prob) << endl;
  if(places < abs(proa - prob) || ((places & 1)^ (abs(proa - prob) & 1))){
      cout << ans << endl;
  }
  else {
      int val = places - abs(proa - prob);
      int l = (places + abs(proa - prob)) / 2;
      ans = f(places, l);
      //cout << ans << endl;
      //cout << ans << endl;
      cout << ans / pow(2, places) <<endl;
  }
  return 0;
}

#include <algorithm>
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <stack>
#include <map>
#include <iomanip>

using namespace std;

int dp[15][15];

int main()
{
	string s1, s2;
	cin >> s1 >> s2;

	int balance1 = 0;
	int balance2 = 0;
	int places2 = 0;

	for (int i = 0; i < s1.length(); i++)
	{
		if (s1[i] == '+') balance1++;
		else balance1--;

		if (s2[i] == '+') balance2++;
		else if (s2[i] == '-') balance2--;
		else places2++;
	}

	int balanceDiff = balance1 - balance2;

	if (places2 < abs(balanceDiff))
	{
		cout << 0.0 << endl;
		return 0;
	}

	int plusCount2 = 0;
	int minusCount2 = 0;
	if (balanceDiff>=0)
	{
		plusCount2 += balanceDiff;
	}
	else
	{
		minusCount2 += -1 * balanceDiff;
	}

	plusCount2 += (places2 - abs(balanceDiff)) / 2;
	minusCount2 += (places2 - abs(balanceDiff)) / 2;

	for (int i = 0; i <= plusCount2; i++)
	{
		for (int j = 0; j <= minusCount2; j++)
		{
			if ( (i == 0) || (j == 0) )
			{
				dp[i][j] = 1;
			}
			else
			{
				dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			}
		}
	}

	double res = dp[plusCount2][minusCount2] / pow(2.0, places2);

	cout << std::setprecision(9) << res;

	return 0;
}

/**
  *    author:  NEZZ
 **/
 #include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  0x3f3f3f3f3f3f3f3f
 #define f first
 #define s second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii>
 #define vll vector < ll >
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define debug(x) cerr << #x << " is " << x << endl;
 #define input freopen("input","r",stdin)
 #define output freopen("output","w",stdout)
 #define fastIO ios_base::sync_with_stdio (0),cin.tie(0)

 using namespace std;
 void affiche (int t[],int n){ rep (i,0,n) cout<<t[i]<<" ";cout<<endl;}
 void afficheV (vll t){rep (i,0,sz(t))cout<<t[i]<<" ";cout<<endl;}

 int const MAXN=1e5+7;
 int nbr_plus1,nbr_plus2,nbr_minus1,nbr_minus2,nbr_mark;
 int main(){
    fastIO;
    string s;
    cin>>s;
    string s2;
    cin>>s2;
    rep(i,0,sz(s)){
      nbr_plus1+=(s[i]=='+');
      nbr_minus1+=(s[i]=='-');

    }
     rep(i,0,sz(s)){
      nbr_plus2+=(s2[i]=='+');
      nbr_minus2+=(s2[i]=='-');
      nbr_mark+=(s2[i]=='?');
    }
    if(nbr_plus1==nbr_plus2 && nbr_minus1==nbr_minus2) cout<<1;
    else if (nbr_mark==0 && (nbr_plus2!=nbr_plus1 or nbr_minus1!=nbr_minus2)) cout<<0;
    else {
    nbr_plus1-=nbr_plus2;
    nbr_minus1-=nbr_minus2;
     debug(nbr_plus1);
     debug(nbr_minus2);
    if (nbr_plus1<0 or nbr_minus1 <0) cout<<0;
    else {
            int ans=0;

        for (int i=0;i<(1<<nbr_mark);i++)
            if (nbr_plus1==__builtin_popcount(i)) ans++;
     double n=(1<<nbr_mark);
      debug (ans);
      debug (n);
      double res=(double)ans/n;
      cout<<fixed<<setprecision(20)<<res;

 }
    }
 }

#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define br                "\n"
#define ss                second
#define int               long long
#define pb                push_back
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type *arr=new type(n);
#define w(x)              int x; cin>>x; while(x--)
#define FOR(i,a,b)        for(int i=(a);i<(b);i++)
#define ROF(i,a,b)        for(int i=(a);i>=(b);i--)
#define so(a,n)           sort(a,a+n)
#define rso(a,n)          sort(a,a+n),reverse(a,a+n)
const                     int maxn=100010;
#define all(v)            (v).begin(),(v).end()

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input1.txt", "r", stdin);
  freopen("outp1.txt", "w", stdout);
#endif
}

int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int dp[100005];
void solve()
{

  string s;cin>>s;
  string t;cin>>t;
  int x=s.length();
  int y=t.length();
  int sum=0,sum1=0;
  FOR(i,0,x)
  {
  	if(s[i]=='+')sum+=1;
  	else if(s[i]=='-')sum+=-1;
  }
  int counter=0;
  int index=-1;
  FOR(i,0,y)
  {
  	if(t[i]=='+')sum1+=1;
  	else if(t[i]=='-')sum1+=-1;
    else if(t[i]=='?')counter++;
  }
  if(counter==0)
  {
   if(sum==sum1)
   cout<<"1.000";
   else cout<<"0";
   return;
  }
  int j=0;
  for(int i=-1*counter;i<=1*counter;i+=2)
  {if(sum1+i==sum)index=j;
  j++;}
  if(counter*-1+sum1==sum||counter*1+sum1==sum)
  	cout<<1/(1.0*(pow(2,counter)));
  else
  	{
  		int zz=fact(counter) / (fact(index) * fact(counter- index));
  		cout<<setprecision(9) <<zz/(1.0*(pow(2,counter)));
  	}
}
int32_t main()
{
  c_p_c();
  //w(t)
  solve();
}

#include <iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<set>
using namespace std;
int main()
{
             long long com[60][60]{},j,m,t=0,x=0,i,x2=0,p=0;
             long double n;
             string s1,s2;
             cin>>s1>>s2;
             com[0][0]=1;
             com[1][0]=1;
             com[1][1]=1;
             for(i=2;i<60;i++)
             {
                          com[i][i]=1;
                          com[i][0]=1;
                          for(j=1;j<i;j++)
                          {
                                com[i][j]=com[i-1][j]+com[i-1][j-1];

                          }

             }
             for(i=0;i<s1.size();i++)
             {
                          if(s1[i]=='+')
                          {
                                       x++;
                                       p++;
                          }

                          else if(s1[i]=='-')
                          x-=1;
                          if(s2[i]=='+')
                          x2+=1;

                          if(s2[i]=='?')
                          t++;
             }
          if(p>=x2)
          {
                       n=com[t][p-x2]/pow(2,t);
                       cout<<fixed<<setprecision(12)<<n;

          }
          else
          {
                       n=0;
                       cout<<fixed<<setprecision(12)<<n;

          }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int fact (int n){
  if(n==0 || n==1)
   return 1;

  else
   return n*fact(n-1);
}
int i,s,pos1=0,pos2=0,q=0,m=0;
 string s1,s2;

int main(){
 ios_base::sync_with_stdio(0);
 cout.tie(0);
 cin.tie(0);

 cin>>s1>>s2;

 for(i=0;i<(int)s1.size();i++)
 {
   if(s1[i] == '+')
   {
       pos1++;
   }
   else
   {
       pos1--;
   }
 }
 for(i=0;i<(int)s2.size();i++){
    if(s2[i]=='+')
      {
          pos2++;
      }
    else if(s2[i]=='-')
      {
      pos2--;
      }
    else if(s2[i]=='?')
    {
      q++;
    }
 }
 if(q==0){
      if(pos1==pos2)
      {
     cout<<"1.000000000000" ;
     return 0;
     }
     else
     cout<<"0.000000000000";
     return 0;
  }

  else {
    s = q+(pos1-pos2);
     if(s%2 == 0 && s/2>=0 && s/2<=q){
       m=fact(q)/(fact(q-s/2)*fact(s/2));
      double x= double(m)/double(pow(2,q));
       cout<<setprecision(12)<<x;
     }

     else
       cout<<"0.000000000000";
   }

  return 0;
}

#include<iostream>
#include<stdio.h>
#include <sstream>
#include <cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define ll long long
#define vbe(v) ((v).begin()), ((v).end())
ll GCD(ll a, ll b) { return (a) ? GCD(b % a, a) : b; }
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll fastpow(ll b, ll p) { if (!p) return 1; ll ret = fastpow(b, p >> 1); ret *= ret; if (p & 1) ret *= b; return ret; }
string alpha = "abcdefghijklmnopqrstuvwxyz";

#define all(v)      ((v).begin()), ((v).end())
#define sz(v)     ((int)((v).size()))
#define clr(v, d)   memset(v, d, sizeof(v))
#define rep(i, v)   for(int i=0;i<sz(v);++i)
#define lp(i, n)    for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)  for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)  for(int i=(j);i>=(int)(n);--i)

int divisor(int number)
{
    int i;
    for (i = 2; i <= sqrt(number); i++)
    {
        if (number % i == 0)
        {
            return number / i;
        }
    }
    return 1;
}
int myXOR(int x, int y)
{
    int res = 0; // Initialize result

    // Assuming 32-bit Integer
    for (int i = 31; i >= 0; i--)
    {
        // Find current bits in x and y
        bool b1 = x & (1 << i);
        bool b2 = y & (1 << i);

        // If both are 1 then 0 else xor is same as OR
        bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);

        // Update result
        res <<= 1;
        res |= xoredBit;
    }
    return res;
}
//std::getline(std::cin, a); //read string with spaces
void printDivisors(int n, vector<int>& v)
{
    // Note that this loop runs till square root
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            // If divisors are equal, print only one
            if (n / i == i && i > 1)
                v.push_back(i);

            else // Otherwise print both
            {
                if (i > 1)
                    v.push_back(i);
                if (n / i > 1)
                    v.push_back(n / i);
            }
        }
    }
}
int bin(vector<int>vec, int val)
{
    int l = 0, r = vec.size() - 1, mid = r / 2;
    while (l <= r)
    {
        mid = (l + r) / 2;

        if (vec[mid]<val && vec[mid + 1]>val)
        {
            if (vec[mid + 1] == val)
                return mid + 1;
            return mid;

        }
        else if (vec[mid] > val)
        {
            r = mid - 1;
        }
        else if (vec[mid] < val)
        {
            l = mid + 1;
        }
        else if (vec[mid] == val)
            return mid;

    }
    return -1;
}
void clear(vector<bool>v)
{
    for (int i = 0; i < v.size(); i++)
        v[i] = 0;
}

bool comp(const string& s1, const string& s2)
{
    // Suppose s1 = 900, s2 = 9, then it compares
    // 9900 with 9009.
    return s2 + s1 < s1 + s2;
}
vector<string> split(const string& s, char delim) {
    vector<string> result;
    stringstream ss(s);
    string item;

    while (getline(ss, item, delim)) {
        result.push_back(item);
    }

    return result;
}
int countWords(string str)
{
    // breaking input into word using string stream
    stringstream s(str); // Used for breaking words
    string word; // to store individual words

    int count = 0;
    while (s >> word)
        count++;
    return count;
}

inline bool IsLowerCharacter(char c)
{
    return c >= 'a' && c <= 'z';
}

int main()
{

    string s1, s2;
    cin >> s1>> s2;
    int pos = 0, posPor = 0,q=0;
    for (int i = 0; i < s1.length(); i++)
    {
        if (s1[i] == '+')
            pos++;
        else
            pos--;
    }
    for (int i = 0; i < s2.length(); i++)
    {
        if (s2[i] == '+')
            posPor++;
        else if (s2[i] == '-')
            posPor--;
        else
            q++;
    }
    if (posPor == pos && q == 0)
    {
        std::cout << std::fixed;
        std::cout << std::setprecision(10);
        cout << 1;
    }
    else
    {
        int n = q;
        int x = pow(2, n);
        int** ary = new int* [x]; //like trossTable
        for (int i = 0; i < x; ++i)
            ary[i] = new int[n];
        for (int i = n; i >= 0; i--) //colum
        {
            int num = pow(2, n - i);//1 2 4 8 16
            int max = pow(2, i);//16 8 4 2 1
            int r = 0;
            for (int s = 0; s < max; s++)
            {
                if (s % 2 == 0)
                    for (int j = 0; j < num; j++)
                    {
                        ary[r][i - 1] = 1;
                        r++;
                    }
                else
                    for (int j = 0; j < num; j++)
                    {
                        ary[r][i - 1] = 0;
                        r++;
                    }
            }
        }
        int ans = 0;
        for (int i = 0; i < x; i++)
        {
            int PP = 0;
            for (int j = 0; j < n; j++)
            {
                if (ary[i][j]==1)
                {
                    PP++;
                }
                else
                    PP--;
            }
            if (PP + posPor == pos)
                ans++;
        }
        std::cout << std::fixed;
        std::cout << std::setprecision(10);
       /// if(ans)
            cout << double(ans)/x;
       // else
    }

    return 0;

}

/*
    int NNN = 1000000;
    bool* isprime = new bool[NNN + 1];

    for (int i = 0; i < NNN + 1; i++)
        isprime[i] = 1;
    isprime[0] = isprime[1] = 0;
    int sqt = sqrt(NNN + 1);
    for (int i = 2; i < 1 + sqt; i++)
    {
        if (isprime[i])
            for (int j = i * 2; j < NNN + 1; j += i)
                isprime[j] = 0;
    }
*/

#include <iostream>
using namespace std;
#include <string>
#include<iomanip>

int fac(int x, int y)
{
	float temp1 = 1, temp2 = 1, temp3 = 1;
	int i,j,k;
	for (i = 1; i <= x; i ++)
	{
		temp1 = temp1 * i;
	}
	temp2 = temp1;
	for (j = i; j <= y; j ++)
	{
		temp2 = temp2 * j;
	}
	for (int i = 1; i <= (y-x); i++)
	{
		temp3 = temp3 * i;
	}
	return temp2 / (temp1*temp3);

}

int power(int x)
{
	int temp = 1;
	for (int i = 1; i <= x; i ++)
	{
		temp = temp * 2;
	}
	return temp;
}

int main ()
{
	string a,b;
	getline(cin, a);
	getline(cin, b);
	int p1=0,m1=0,p2=0,q2=0,m2=0;
	for (int i = 0; i < a.length(); i++)
	{
		if (a[i] == '+') { p1++;}
		if (a[i] == '-') { m1++;}

		if (b[i] == '+') { p2++;}
		if (b[i] == '-') { m2++;}
		if (b[i] == '?') { q2++;}
	}
	 std::cout << std::setprecision(9) << std::fixed;
	 float ans;
	 if (q2 == 0)
	 {if ( p1 == p2 && m1 == m2)
		{
			ans = 1;
			cout << ans;
			//system("Pause");
			return(0);
		}
	 else { ans = 0; cout << ans; //system("Pause");
	 return(0); }
	 }
	 else
	 {
		  if ((p2 > p1) || (m2 > m1))
			  { ans = 0; cout << ans; //system("Pause");
		  return(0); }
		  int tmp1 = p1 - p2, tmp2 = m1 - m2;
		  if (tmp1 + tmp2 > q2 ) { ans = 0; cout << ans; //system("Pause");
		  return(0); }
		  else
		  {
			  ans = fac(tmp1,q2);
			  long tmp3 = power(q2);
			  ans = ans / tmp3;
			  cout << ans; //system("Pause");
			  return 0;
		  }
	 }

}

#include<iostream>
#include<stdio.h>
using namespace std;

float c(float a,float b)
{
    //cout<<a<<" "<<b<<endl;
    if(b<0)
        return 0;
    if(a==b)
        return 1;
    if(b==0)
        return 1;
    if(b>a)
        return 0;
    return c(a-1,b-1)+c(a-1,b);
}

main()
{
    string s1,s2;
    cin>>s1;
    //cout<<s1.size()<<"a"<<endl;
    cin>>s2;
    float p1=0,p2=0,p=0;
    int q=0;
    for(int i=0; i<s1.size(); i++)
        if(s1[i]=='+')
            p1++;
    for(int i=0; i<s2.size(); i++)
    {
        if(s2[i]=='+')
            p2++;
        if(s2[i]=='?')
            q++;
    }
    //cout<<p1<<endl;
    //cout<<p2<<endl;
    p=p1-p2;
    //cout<<p<<" "<<q<<endl;
    float su,ma;
    su=c(q,p);
    ma=(float)(1<<q);
    //cout<<(su)<<endl;
    printf("%.12f",su/ma);
}

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<iomanip>

using namespace std;

long long n,m,k;

vector<set<pair<long long,long long> > > s;
vector<vector<pair<long long,long long> > > e;
vector<long long> d;
vector<long long> ans;
set<long long> c;
long long INF = 1000*1000*1000+1000;

long long pow(long long x)
{
    long long j=1;
    for(long long i=0;i<x;i++)
    {
        j = j*2;
    }
    return j;
}

long long select(long long a,long long b)
{
    long long a1=1,a2=1,a3=1;
    for(int i=1;i<=a;i++)
    {
        a1 = a1*i;
    }
    for(int i=1;i<=a-b;i++)
    {
        a2 = a2*i;
    }
    for(int i=1;i<=b;i++)
    {
        a3 = a3*i;
    }
    return a1/(a2*a3);
}
int main()
{
    //freopen("C.in", "r", stdin);
    //freopen("C.out", "w", stdout);
    string tmp,tmp2;
    cin>>tmp>>tmp2;
    int p1=0,p2=0,n1=0,n2=0;
    for(int i=0;i<tmp.size();i++)
    {
        if(tmp[i]=='+')p1++;
        else n1++;
        if(tmp2[i]=='+')p1--;
        else if(tmp2[i]=='-')n1--;
    }
    if(p1<0 || n1<0)cout<<0;
    else cout<<setprecision(10)<<(double)select(p1+n1,p1)/pow(p1+n1);
    //return 0;
    //system("pause");
}

#include <bits/stdc++.h>
#include <set>
#include <limits>
#include <string>
using namespace std;
typedef long long int lld;
#define MAXN std::numeric_limits<lld>::max()
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
double getComb (double n, double x){
    if (x > n){
        return 0;
    }
    else{
        double r = 1.0;
        for(double i = 1.0; i<=x;i+=1){
            double a = n-i+1;
            double b = a / i;
            r*=b;
        }
        return r;
    }
}
int main () {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("inputf.in",  "r",  stdin);
    // for writing output to output.txt
    freopen("outputf.in", "w", stdout);
    #endif
    FastIO
    string s;
    cin >> s;
    string t;
    cin >> t;
    lld i, n;
    lld c, d;
    lld x, y;
    n = s.length();
    x = 0;
    y = 0;
    d = 0;
    for(i = 0; i<n; i += 1){
        if (s[i] == '+'){
            x++;
        }
        if (s[i] == '-'){
            y++;
        }
    }
    for(i = 0; i<n; i += 1){
        if (t[i] == '+'){
            x--;
        }
        if (t[i] == '-'){
            y--;
        }
        if (t[i] == '?'){
            d++;
        }
    }
    if (x < 0)
        x = 0;
    if (y < 0)
        y = 0;
    double a , z;
    double b = d;
    if (x+y == d){
        z = 0.0;
        for(i = 0;i<n;i+=1){
            if (s[i] =='+'){
                z++;
            }
        }
        for(i = 0;i<n;i+=1){
            if (t[i] =='+'){
                z--;
            }
        }
        a = getComb(b, z) / pow(2, d);
    }
    else{
        a = 0.0;
    }
    cout << fixed << setprecision(12) << a << "\n";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii            	map<int,int>
#define pqb             priority_queue<int>
#define pqs            	priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod            	1000000007
#define inf             1e18
#define all(x) 			x.begin(), x.end()
#define clr(x) 			memset(x, 0, sizeof(x))
#define sortall(x) 		sort(all(x))
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

#define deb(x) 			cout << #x << "=" << x << endl
#define deb2(x, y) 		cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) 		for(auto it = a.begin(); it != a.end(); it++)
#define fo(i, n) 		for(int i=0; i<n; i++)
#define Fo(i,k,n) 		for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int calc(string& s1)
{
	int pos = 0;
	for (auto ch : s1)
	{
		if (ch == '+')
			pos++;
		else
			pos--;
	}
	return pos;
}
int32_t main()
{
	FIO();
	string s1, s2; cin >> s1 >> s2;
	int sent = calc(s1);

	int cnt = 0;
	int fix = 0;
	for (auto ch : s2)
	{
		if (ch == '?')
			cnt++;
		else if (ch == '+')
			fix++;
		else
			fix--;
	}
	if (cnt == 0)
	{
		if (sent == fix)
		{
			cout << "1.0000000000" << '\n';
		}
		else
		{
			cout << "0.00000000000" << '\n';
		}
	}
	else
	{
		int correct_pos = 0;
		for (int i = 0; i < (1 << cnt); i++)
		{
			int temp = i, x = 0;
			for (int j = 1; j <= cnt; j++)
			{
				if (temp & 1)
					x++;
				else
					x--;

				temp = temp >> 1;
			}
			if (x + fix == sent)
				correct_pos++;
		}
		//deb(correct_pos);
		if (correct_pos == 0)
		{
			cout << "0.00000000000" << '\n';
		}
		else
		{
			double ans = 0.0;
			ans = (correct_pos / double(1 << cnt));
			cout << ps(ans, 20) << '\n';
		}
	}
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <numeric>
#include <functional>
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
#include <string>

using namespace std;

int fact(int n) {
	int res = 1;
	while (n) {
		res *= n--;
	}
	return res;
}

int main() {
	int countP = 0, countM, len, cnt =0;
	double res;
	string str;
	cin >> str;
	len = str.length();
	countP = count(str.begin(), str.end(), '+');
	countM = len - countP;
	len = str.length();
	cin >> str;
	for (int i = 0; i < len; ++i) {
		if (str[i] == '+') countP--;
		else if (str[i] == '-') countM--;
		else cnt++;
	}
	if (countM >= 0 && countP >= 0) {
		res = (fact(cnt)/(fact(countM)*fact(countP))) / pow(2, countM + countP);
	}
	else {
		res = 0.0;
	}
	printf("%.10f", res);
	return 0;
}

#include<iomanip>
#include<iostream>
#include<algorithm>
#include<string>
#include<list>
#include<vector>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<unordered_map>
#include<numeric>
#include<queue>

using namespace std;

double choose(int n, int k){

    vector<int> dp(n + 1, 1);

    for(int i = 0; i < n; i++){

        vector<int> ndp(n + 1, 1);

        for(int j = 0; j <= i + 1; j++){

            if(j == 0 || j == i + 1) ndp[j] = 1;
            else ndp[j] = dp[j] + dp[j - 1];

        }

        dp = ndp;

    }

    return dp[k];

}

int main(){

    string s1, s2;
    cin >> s1 >> s2;

    if(s1.size() != s2.size()){
        cout << 0.0 << endl;
        return 0;
    }
    double sum = 0.0;

    for(int i = 0; i < s1.size(); i++)
        sum += s1[i] == '+' ? 1 : 0;

    double q = 0;
    double sum2 = 0.0;

    for(int i = 0; i < s2.size(); i++){

        if(s2[i] == '?') q++;
        else if(s2[i] == '+') sum2++;

    }

    int dst  = sum2 - sum;
    if(dst > 0 || dst + q < 0){
        cout << "0.0" << endl;
        return 0;
    }
    // q choose dst
    double ans = choose(q, abs(dst));
    cout << fixed << setprecision(12) << ans * pow(0.5, q) << endl;

}

#include<iostream>
#include<iomanip>
#include<vector>
#include<unordered_map>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin >> s;
    int pos = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == '+') pos++;
        else pos--;
    }

    cin >> s;
    int coins = 0;
    int wrongPos = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == '+'){
            wrongPos++;
        }else if(s[i] == '-'){
            wrongPos--;
        }else{
            coins++;
        }
    }

    int n = coins;
    vector<int> cur(n + 1, 0);
    vector<int> next(n + 1, 0);
    cur[0] = 1;
    cur[1] = 1;

    for(int i=0;i<n;i++){
        next[0] = 1;
        next[i+1] = 1;
        for(int j=1;j<i+1;j++){
            next[j] = cur[j-1] + cur[j];
        }
        cur = next;
    }

    int diff = pos - wrongPos;
    if((abs(diff) + n) % 2 != 0 || abs(diff) > coins){
        cout << 0.0 << endl;
    }else if(diff == 0 && coins == 0){
        cout << 1.0 << endl;
    }else{
        cout << setprecision(10) << endl;
        cout << next[(abs(diff) + n)/2] * pow(0.5, coins) << endl;
    }

    return 0;
}

// while( !(succeed == try()) );

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

int fact(int x)
{
    if(x==1 or x==0) return 1;
    return x*fact(x-1);
}

void alpha()
{
    string sen;
    cin>>sen;

    string rec;
    cin>>rec;

    int pos1=0, neg1=0, pos2=0, neg2=0, ques=0;

    loop(i,0,sen.size())
    {
        if(sen[i]=='+') pos1++;
        else if(sen[i]=='-') neg1++;

        if(rec[i]=='+') pos2++;
        else if(rec[i]=='-') neg2++;
        else if(rec[i]=='?')ques++;
    }

    // bug(pos1, neg1, pos2, neg2, ques);

    if(pos1==pos2 and neg1==neg2)
    {
        cout<<fixed<<setprecision(10)<<1.0<<endl;
        return;
    }

    if(pos2 > pos1 or neg2>neg1 or pos1 > pos2+ques or neg1 > neg2+ques)
    {
        cout<<fixed<<setprecision(10)<<0.0<<endl;
        return;
    }

    int diff_pos = pos1-pos2;
    int diff_neg = neg1-neg2;

    double ans = (1.0*fact(ques)/(fact(ques-diff_pos)*fact(diff_pos)))/pow(2, ques);

    cout<<fixed<<setprecision(10)<<ans<<endl;
}

int32_t main(){

    ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    INP();
    int t=1;
    //cin>>t;

    while(t--) alpha();

    return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}

#include<bits/stdc++.h>
using namespace std;
int mpow(int a,int b)
{
    int res = 1;
    while(b)
        {
            if(b&1)
                res*=a;
            a*=a;
            b>>=1;
        }
return res;
}
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int q =  0;
    int dist1 = 0 ,dist2 = 0;
    for(int i=0;i<s1.length();i++)
        if(s1[i]=='+')
             dist1++;
        else dist1--;
    for(int i=0;i<s2.length();i++)
        {
            if(s2[i]=='?') q++;
            else if(s2[i]=='+') dist2++;
            else dist2--;
        }
        int res = 0 ;
        for(int i=0;i<(1<<q);i++)
            {
                int d = 0 ,cnt = 0;
                for(int j = 0;j<q;j++)
                    {
                        if( i & (1<<j))
                            {
                                d+=1;
                                cnt++;
                            }
                        else d+=-1;
                    }
                if(dist2+d == dist1)
                res++;
            }
            cout<<setprecision(9)<<res/(double)mpow(2,q);
            //printf("%0.9f\n",res/(double)mpow(2,q));
return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <random>
using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string a, b;
    cin >> a >> b;

    int ap = count(a.begin(), a.end(), '+');
    int am = count(a.begin(), a.end(), '-');
    int ax = ap - am;

    int bp = count(b.begin(), b.end(), '+');
    int bm = count(b.begin(), b.end(), '-');
    int bq = count(b.begin(), b.end(), '?');
    int bx = bp - bm;

    int dx = abs(bx - ax);

    if (dx > bq) {
        cout << 0;
        return 0;
    }

    if ((bq - dx) % 2) {
        cout << 0;
        return 0;
    }

    double p = 0;
    for (int i = 0; i < 1 << bq; i++) {
        int m = i, k = 0;
        while (m) {
            k++;
            m &= m - 1;
        }
        if (k == (bq - dx) / 2)
            p += pow(0.5, bq);
    }
    printf("%.10lf", p);
}

#include <iostream>
#include <limits>
#include <cmath>
#include <iomanip>

using namespace std;

class ConversionResult
{
	int result;
	int num_wildcards;

	public:
		ConversionResult(int, int);
		int get_result()
		{
			return result;
		}
		int get_num_wildcards()
		{
			return num_wildcards;
		}
};
ConversionResult::ConversionResult(int result_param, int num_wildcards_param)
{
	this->result = result_param;
	this->num_wildcards = num_wildcards_param;
}

int compute_target(string s);
ConversionResult convert(string s);
long long binom(int n, int k);

int main()
{
	string s1, s2;
	cin >> s1 >> s2;

	int target = compute_target(s1);
	ConversionResult actual = convert(s2);

	int displacement = abs(actual.get_result() - target);
	if (displacement > actual.get_num_wildcards())
	{
		cout << 0 << endl;
	}
	else
	{
		int num_alternate = actual.get_num_wildcards() - displacement;
		if (num_alternate % 2 == 0)
		{
			int total_one_sign = (num_alternate / 2) + displacement;
			long long num_outcomes_working =
				binom(actual.get_num_wildcards(), total_one_sign);
			double fraction =
				((double) num_outcomes_working) /
					((double) pow(2, actual.get_num_wildcards()));
			cout << setprecision(12) << fraction << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}

	return 0;
}

int compute_target(string s)
{
	return convert(s).get_result();
}

ConversionResult convert(string s)
{
	int result = 0;
	int num_wildcards = 0;
	for (string::iterator it = s.begin(); it < s.end(); it++)
	{
		if (*it == '+')
		{
			result++;
		}
		else if (*it == '-')
		{
			result--;
		}
		else
		{
			num_wildcards++;
		}
	}
	return ConversionResult(result, num_wildcards);
}

long long binom(int n, int k)
{
	if (k > n)
	{
		return 0;
	}
	else if (k < 0)
	{
		throw;
	}
	else if (k == 0 || k == n)
	{
		return 1;
	}
	else
	{
		return binom(n-1, k-1) + binom(n-1, k);
	}
}

# include<stdio.h>
# include<algorithm>
# include<string.h>
# include<map>
# include <string>
# include <iostream>
#include <queue>
using namespace std;
map<int,string>x,y;
int l[330],c[330];
double min (double a,double b){return a<b?a:b;}
//double gcd(double a,double b){return b==0?a:gcd(b,a%b);}
map<int ,int >dp;
priority_queue<int>q;
char str1[20],str2[20];
char str[110];
int main ()
{

    while(scanf("%s",str1)!=EOF)
    {
        int flag1=0,flag2=0,flag3=0;
    scanf("%s",str2);
    for(int i=0;str1[i]!='\0';i++)
    {
        if(str1[i]=='+')    flag1++;
        if(str1[i]=='-')    flag2++;
    }
    for(int i=0;str2[i]!='\0';i++)
    {
        if(str2[i]=='+')    flag1--;
        if(str2[i]=='-')    flag2--;
        if(str2[i]=='?')    flag3++;
    }
    if(flag1==0&&flag2==0)  printf("1.000000000\n");
    else if(flag3<flag2||flag3<flag1) printf("0.000000000000\n");
    else
    {
        double sum=1;
        double shang=min(flag2,flag1);
        double xia=flag3;
        for(double j=shang,i=xia;j>=1;j--,i--)
            sum*=i/j;
        for(int i=1;i<=flag3;i++)
            sum*=0.5;
        printf("%.12lf\n",sum);
    }
    }
    return 0;
}

#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// Powered by caide (code generator, tester, and library code inliner)

class Solution {
public:
  long long newton(int n, int k) {
    if (n == 0) return 1;
    if (k == 0 || n == k) return 1;
    if (k == 1 || k == n - 1) return n;
    return newton(n - 1, k - 1) + newton(n - 1, k);
  }
  void solve(std::istream& in, std::ostream& out) {
    string s1, s2;
    in >> s1 >> s2;
    int x = 0, t = 0;
    int n = 0;
    for (size_t i = 0; i < s1.size(); i++) {
      t += (s1[i] == '+') ? 1 : -1;
      if (s2[i] != '?')
        x += (s2[i] == '+') ? 1 : -1;
      else ++n;
    }
    double res = 0.0;
    int f = t - x;
    if ((n + f) % 2 == 1 || abs(f)>n) {
      out << res;
      return;
    }
    out << setprecision(10) << double(newton(n, (n+f) / 2)) / (1 << n);
  }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;
    solve(in, out);
    return 0;
}

#include<iostream>
#include<string>
#include<cstdio>
#include<iomanip>
#include<cmath>

using namespace std;

long long sum, sum1, n, m, X, Y, Z;
string s, S;

int main ()
{
    cin >> s >> S;
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] == '+')
            n ++;
        else if(s[i] == '-')m ++;
        if(S[i] == '+')X++;
        else if(S[i] == '-')Y++;
        else Z++;
    }
    if(n == X && m == Y){
        // printf("%.10f", 1);
        cout << "1.000000000000";
        return 0;
    }
        if(Y > m || X > n)
        {
           cout << "0.000000000000";
            return 0;
        }
        X = n - X;
        Y = m - Y;
        sum = 1;
        sum1 = 1;
        for(int i = 2; i <= Z;  i ++)
            sum *= i;
        for(int i = 2; i <= X; i ++)
            sum1 *= i;
        for(int i = 2; i <= (Z - X); i ++)
            sum1 *= i;

        printf("%.10f", double(sum * 1.0 / double (sum1)) / pow(2.0, double(Z)));
 }

#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// Powered by caide (code generator, tester, and library code inliner)

class Solution {
public:
  long long newton(int n, int k) {
    if (n == 0) return 1;
    if (k == 0 || n == k) return 1;
    if (k == 1 || k == n - 1) return n;
    return newton(n - 1, k - 1) + newton(n - 1, k);
  }
  void solve(std::istream& in, std::ostream& out) {
    string s1, s2;
    in >> s1 >> s2;
    int x = 0, t = 0;
    int n = 0;
    for (size_t i = 0; i < s1.size(); i++) {
      t += (s1[i] == '+') ? 1 : -1;
      if (s2[i] != '?')
        x += (s2[i] == '+') ? 1 : -1;
      else ++n;
    }
    double res = 0.0;
    int f = t - x;
    if ((n + f) % 2 == 1 || abs(f)>n) {
      out << res;
      return;
    }
    out << double(newton(n, (n+f) / 2)) / (1 << n);
  }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;
    solve(in, out);
    return 0;
}

#include<cstdio>
#include<cstring>
#include<string>
#include<map>
using namespace std;
char s1[12],s2[12];
int f[12]={0};
int main()
{
    scanf("%s",s1);
    getchar();
    scanf("%s",s2);
    int l=0,q=0;
    for(int i=0;s2[i]!='\0';++i)
    {
        if(s1[i]=='+')
        {
            ++l;
        }
        else
        {
            --l;
        }
        if(s2[i]!='?')
        {
            f[i]=1;
        }
        else
        {
            ++q;
        }
    }
    int len = strlen(s1);
    int mx = (1<<len) - 1;
    float ans=0.0;
    string cur;
    map<string,int> m;
    for(int k=0;k<=mx;++k)
    {
        char cmp[12];
        cur="";
        for(int i=0;i<len;++i)
        {
            if(f[i])
            {
                cmp[i]=s2[i];
            }
            else if((k & 1<<(len-i-1))>>(len-i-1)==1)
            {
                cmp[i]='+';
                cur=cur+"+";
            }
            else
            {
                cmp[i]='-';
                cur=cur+"-";
            }
        }
        cmp[len]='\0';
        if(m.find(cur)==m.end())
        {
            m[cur]=1;
            int c=0;
            for(int i=0;i<len;++i)
            {
                if(cmp[i]=='+')
                {
                    ++c;
                }
                else
                {
                    --c;
                }
            }
            if(l==c)
            {
                ++ans;
            }
        }
    }
    printf("%0.12f",ans/(1<<q));
    return 0;
}

// esta3anna 3al sha2a belAllah ..
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<sstream>
#include<limits.h>
#include<iomanip>
#include<cstring>
#include<bitset>
#include<fstream>
#include<cmath>
#include<cassert>
#include <stdio.h>
#include<ctype.h>
using namespace std;
#define rep(i,n,m) for(int i = (int)(n), _m = (int)(m); i < _m; ++ i)
#define rrep(i,n,m) for(int i = (int)(n), _m = (int)(m); i >= _m; -- i)
#define foreach(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz size()
#define pb push_back
#define mp make_pair
#define mems(arr, v) memset(arr, v, sizeof arr)
#define setBit(mask, bit) ((mask) | (1LL << (bit)))
#define resetBit(mask, bit) ((mask) & (~(1LL << (bit))))
#define flipBit(mask, bit) ((mask) ^ (1LL << (bit)))
#define is0(mask, bit)(((mask) & (1LL << (bit))) == 0)
#define is1(mask, bit)(((mask) & (1LL << (bit))) != 0)
#define removeLastBit(mask) ((mask) & ((mask) - 1LL))
#define firstBitOn(mask) ((mask) & ~((mask) - 1LL))
#define grayCode(mask) ((mask) ^ ((mask) << 1LL))
#define repSubMasks(subMask, mask) for(ll subMask = (ll)(mask), _mask = subMask; subMask; subMask = _mask & (subMask - 1))
int countBits(long long mask) {int res = 0; while(mask) mask &= (mask - 1), ++ res; return res;}
string toString(long long n) {stringstream ss; ss << n; return ss.str();}
long long toNumber(string s) {stringstream ss; long long n; ss << s; ss >> n; return n;}
#define INT_MAX  1000000000
#define INT_MIN -1000000000
#define INF 1000000000
#define EPS 1e-9
#define MOD 1000000007
#define debug(x) cout << #x << " : " << x << endl
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define Read() freopen("input.txt","r",stdin)
#define Write() freopen("output.txt","w",stdout)
ld nCr(int n, int k) {
    if(k > n) return 0;
    ld res = 1;
    rep(i, 1, n + 1) res *= i;
    rep(i, 1, k + 1) res /= i;
    rep(i, 1, n - k + 1) res /= i;
    return res;
}
int main() {
 //   Read();
    string a, b;
    while(cin >> a >> b) {
        int p = count(all(a), '+') - count(all(b), '+');
        int m = count(all(a), '-') - count(all(b), '-');
        int free = count(all(b), '?');
        cout.precision(10);
        if(free && p + m == free && p >= 0 && m >= 0) cout << fixed << nCr(free, p) / powl(2, free) << endl;
        else cout << (!p && !m) << endl;
    }
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mem(a,x) memset(a,x,sizeof(a))
vector<int> v2;
lli p;
typedef pair<lli,lli> ll;
int a1[1000007];
int flag=1;
lli n,x1,k;
lli s[1000000];
bool cmp(ll a,ll b)
{
    if(a.second==b.second)
    return a.first<b.first;
    return a.second>b.second;
}
int pos=0;
lli gcd(lli a,lli b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
string s1;
double c=0.0;
double c1=0.0;
void dfs(int x,int y)
{
    if(s1[x]=='\0')
    {
        if(y==pos)
    {
        c++;
    }
    c1++;
    return;
    }
    if(s1[x]=='+')
    dfs(x+1,y+1);
    else if(s1[x]=='-')
    dfs(x+1,y-1);
    else
    dfs(x+1,y+1),dfs(x+1,y-1);
}
main()
{
lli m;
string s;
cin>>s;
lli t=0;
lli t4=0;
for(int j=0;j<s.length();j++)
{
    if(s[j]=='+')
    pos+=1;
    else
    pos-=1;
}
cin>>s1;
dfs(0,0);
cout<<fixed<<setprecision(10)<<c/c1<<endl;
}

#include <iostream>
#include <string>

int fact(int x) {
	if (x != 1)
		return x * fact(x - 1);
	else
		return 1;
}
int C(int n, int k) {
	return (fact(n) / (fact(k)*fact(n - k)));
}

using namespace std;
int main() {

	string s1, s2;
	cin >> s1 >> s2;

	float goodCom=0, maxCom = 1;
	int plus1=0, minus1=0,
		plus2=0, minus2=0, q=0;
	int size = s1.size();
	for (int i = 0; i < size; ++i) {
		if (s1[i] == '+')
			plus1++;
		else
			minus1++;

		if (s2[i] == '+')
			plus2++;
		else
			if (s2[i] == '-')
				minus2++;
			else {
				q++;
				maxCom *= 2;
			}
	}
	int plus = plus1 - plus2,
		minus = minus1 - minus2;

	if (plus < 0 || minus < 0) {
		printf("%.10f", 0.0);
		return 0;
	}

	if (q == 0) {
		if (plus == 0 && minus == 0) {
			printf("%.10f", 1.0);
			return 0;
		}
		else {
			printf("%.10f", 0.0);
			return 0;
		}
	}
	else {
		if (plus > 0 && minus == 0) {
			if (plus - q == 0) {
				goodCom = 1.0;
				printf("%.10f", goodCom / maxCom);
				return 0;
			}
			else{
				printf("%.10f", 0.0);
				return 0;
			}
		}else
			if (minus > 0 && plus == 0){
				if (minus - q == 0){
					goodCom = 1.0;
					printf("%.10f", goodCom / maxCom);
					return 0;
				}
				else {
					printf("%.10f", 0.0);
					return 0;
				}
			}else
				if (plus == minus && plus != 0) {
					if (plus + minus - q == 0) {
						goodCom = C(q, minus);
						printf("%.10f", goodCom / maxCom);
						return 0;
					}
					else {
						printf("%.10f", 0.0);
						return 0;
					}
				}
				else {
					if (plus != minus && (plus > 0 || minus > 0)) {
						int max;
						if (plus + minus - q == 0) {
							if (plus > minus)
								max = plus;
							else
								max = minus;
							goodCom = C(q, max);
							printf("%.10f", goodCom / maxCom);
							return 0;
						}
						else {
							printf("%.10f", 0.0);
							return 0;
						}
					}
				}
	}

}

#include<iostream>
#include<bits/stdc++.h>
#define ll long long int
#define ss string
#define mod 1000000007
using namespace std;

void go(ll n,ll k)
{  //cout<<n<<k;
   ll c[k+1];memset(c,0,sizeof(c));
   c[0]=1;
   for(ll i=1;i<=n;i++)
   for(ll j=min(i,k);j>0;j--)
   c[j]+=c[j-1];

   // cout<<c[k]<<endl;
     double p=c[k]/pow(2,n);
     cout<<fixed<<setprecision(12)<<p;
}

int main()
{
    ss s,r;
    cin>>s>>r;
    ll sum=0;
    for(ll i=0;i<s.length();i++)
    if(s[i]=='+')sum++;
    else
    sum--;
    ll q=0;
    ll sum2=0;
    for(ll i=0;i<r.length();i++)
    if(r[i]!='?')
    {
        if(r[i]=='+')sum2++;
        else
        sum2--;
    }
    else
    q++;

   // cout<<sum<<sum2;
    if(q==0&&sum==sum2)
    {
        cout<<"1.000000000000";return 0;
    }
    if(q==0&&sum!=sum2)
    {
        cout<<"0.000000000000";return 0;
    }
    double pro=0;
    if(abs(q+sum2)<(sum))
    {cout<<fixed<<setprecision(12)<<pro;
    return 0;}

    if(sum2-q>sum)
    {cout<<fixed<<setprecision(12)<<pro;
    return 0;}
    else
    {
        ll left=sum-sum2;

          ll k=0;
            for(ll i=-q;i<=q;i+=2)
            {
                if(i==left)
                {go(q,k);break;}
                else k++;
            }

    }

    return 0;
}

#include <bits/stdc++.h>
#include<limits.h>

using namespace std;

#define endl "\n"

const int precision = 13;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(precision);
    cout.setf(ios_base::fixed);

    string answer, command;
    cin >> answer >> command;

    vector<vector<double>> dp(command.size() + 1, vector<double>(40, 0));
    int middle = 20;
    dp[0][20] = 1; // center of probability tree;

    for(auto i = 0; i < (int)command.size(); ++i) {
        int row = i + 1;
        if(command[i] == '+') {
            for(auto j = 1; j < (int)dp[row].size(); ++j) {
                dp[row][j] = dp[row - 1][j - 1];
            }
        }

        if(command[i] == '-') {
            for(auto j = 1; j < (int)dp[row].size() - 1; ++j) {
                dp[row][j] = dp[row - 1][j + 1];
            }
        }

        if(command[i] == '?') {
            for(auto j = 1; j < (int)dp[row].size() - 1; ++j) {
                dp[row][j] += dp[row - 1][j - 1] / 2.0;
                dp[row][j] += dp[row - 1][j + 1] / 2.0;
            }
        }
    }

    int answerBalance = 0;
    for(auto c : answer) {
        answerBalance += c == '+' ? 1 : -1;
    }

    cout << setprecision(12) << fixed<<dp[command.size()][answerBalance + middle];
    return 0;
}

#include<iostream>
using namespace std;
#include<string>
#include<math.h>
#include<algorithm>
#include<iomanip>
int main(){
	string num1, num2;
	int n1 = 0, n2 = 0, numofsym = 0;
	long double final_result = 1;
	cin >> num1 >> num2;
	int i = 0;
	long double factorial_num, factorial_size = 1;
	while (i != num1.size()){

		if (num1[i] == '+')
			n1++;
		else
			n1--;
		if (num2[i] == '+')
			n2++;
		else if (num2[i] == '-')
			n2--;
		else if (num2[i] == '?')
			numofsym++;

		i++;
	}
	int n;
	if (numofsym == 0)
	{
		if (n1 == n2)
			cout << 1;
		else
			cout << 0;
		return 0;
	}
	n = numofsym;
	long double factorial_max = 1;
	factorial_size = 1;

	if (n1 > n2)
	{
		if ((n2 + numofsym) == n1)
		{
			factorial_num = 1;
			i = 0;
			while (true){
				if (n > 0)
					factorial_size *= n;
				if ((numofsym - i) > 0)
				{
					factorial_num *= (numofsym - i);
				}
				i++;
				n--;
				if (n <= 0 && (numofsym - i) <= 0)
					break;
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;
		}
		else if ((n2 + numofsym) > n1)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}

	else if (n2 > n1){
		if ((n1 + numofsym) == n2)
		{
			factorial_num = 1;
			i = 0;
			while (true){
				if ((numofsym - i) > 0)
				{
					factorial_num *= (numofsym - i);
				}
				if (n > 0)
					factorial_size *= n;
				i++;
				n--;
				if (n <= 0 && (numofsym - i) <= 0)
					break;
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;
		}
		else if ((n1 + numofsym) > n2)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}
	else if (n1 == n2)
	{
		if (numofsym % 2 == 0)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}
}

#include <iostream>
#include <cstring>
#include <stdio.h>

using namespace std;

double ans1=0,ans2=0;
void rec(int save,int k,int kol,int z)
{
    if (kol==0)
    {
        if (save==k) ++ans1;
        else ++ans2;
        return;
    }
    rec(save,k+z,kol-1,-1);
    rec(save,k+z,kol-1,1);
}

int main()
{
    string s1,s2;
    int a1[20],a2[20],i,m;
    cin >> s1;
    cin >> s2;
    m=s1.length();
    for (i=0; i<m; ++i)
    {
        if (s1[i]=='+') a1[i]=1;
        else if (s1[i]=='?') a1[i]=0;
        else a1[i]=-1;
    }
    for (i=0; i<m; ++i)
    {
        if (s2[i]=='+') a2[i]=1;
        else if (s2[i]=='?') a2[i]=0;
        else a2[i]=-1;
    }
    int k1=0,k2=0;
    int met=0;
    for (i=0; i<m; ++i)
    {
        k1+=a1[i];
        k2+=a2[i];
        if (a2[i]==0) ++met;
    }
    if (met>0)
    {
    rec(k1,k2,met,1);
    rec(k1,k2,met,-1);
    printf("%0.14lf", ans1/(ans1+ans2));
    }
    else {
    if (k1==k2) cout << 1;
    else cout << 0;
    }
    return 0;
}

// solution from MuhammadAl-Halaby
#include <bits/stdc++.h>
using namespace std;

#define OnlineJudge1

#define loop(a,n) for(int i = a;i<n;i++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-6

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
    #ifdef OnlineJudge
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}

int prefix[(int)1e5+5];
int seen[(int)1e5+5];
int freq[(int)1e5+5];

int main(){
    init();
    string s1,s2;
    cin >> s1 >> s2;
    int p1=0,n1=0,p2=0,n2=0,q=0;
    vector<char> possible;
    for(int i = 0;i<s1.length();i++){
        if(s1[i] == '+')p1++;
        else n1++;
        if(s2[i] == '+')p2++;
        else if(s2[i] == '-')n2++;
        else{
            q++;
        }
    }
    int pos=0,neg=0;
    pos = p1 - p2;
    neg = n1 - n2;
    if(pos >=0 && neg >= 0 && q == pos + neg){
        for(int i = 0;i<pos;i++)
            possible.push_back('+');
        for(int i = 0;i<neg;i++)
            possible.push_back('-');
        sort(possible.begin(),possible.end());
        double prob=0, all =1;
        if(q) all = pow(2,q);
        do{
            prob++;
        }while(next_permutation(possible.begin(),possible.end()));
        printf("%.9f",prob / all);
        return 0;
    }
    cout << 0.0;
}

// WIFI B.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;
int factorial(int n)
{
    return (n == 1 || n == 0) ? 1 : factorial(n - 1)*n;
}
double power(int n, int m)
{
    int result=1;
    for (int i = 0; i < m; i++)
        result *= n;

    return result;
}
int main()
{
    //cout << factorial(10) << endl << power(2, 10);
    //cout << i;
    string s1 = "", s2 = "";
    cin >> s1;
    cin >> s2;
    double probability = 1;
    int qm = 0;
    int n1 = 0, n2 = 0;
    string arr = "";
    for (int i = 0; i < s1.length(); i++)(s1[i] == '+') ? n1++ : n1--;

    for (int i = 0; i < s2.length(); i++)
    {
        if (s2[i] == '+')n2 += 1;
        else if (s2[i] == '-')n2 += -1;
        else qm++;
    }
    int difference = abs(n1 - n2);
    if (qm == 0){if(difference==0)cout << "1.000000000000";
    else cout<<"0.000000000000";}//if there was not any question mark
    else
    {
        if (n1 == n2)
        {
            if (qm % 2 != 0)cout << "0.000000000000";//if number of question marks was odd
            else
            {
                double temp = ((factorial(qm) / (factorial(qm/2)*(factorial(qm / 2)))) / power(2,qm));

                cout << fixed << setprecision(12) << temp;
            }
        }
        else
        {
            int qm2 = qm;
            qm -= difference;
            if (qm >= 0)
            {
                if (qm % 2 != 0)cout << "0.000000000000";//
                else {
                    //qm += difference;
                    double temp = 0;
                    temp = ((factorial(qm2)) / (factorial(difference + (qm2 - difference) / 2)*factorial(qm2 - difference - (qm2 - difference) / 2))) / power(2, qm2);
                    cout <<fixed<< setprecision(12) << temp;
                }
            }
            else if (qm < 0){ cout << "0.000000000000"; }//
            else
            {
                cout << fixed<<setprecision(12) << probability;
            }
        }

    }
   // cin >> s1;
    return 0;
}

#include<iostream>
#include<math.h>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
#include<functional>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<numeric>
using namespace std;
typedef  pair <int,int> pi;
string s1,s2;
int counts = 0;
int res = 0;
void rec (string s,int pos,int ans)
{
	if (s.length() == pos)
	{
		if (ans==counts) res++;
	}
	else
	{
		if (s[pos]=='?')
		{
			rec(s,pos+1,ans - 1);
			rec(s,pos+1,ans + 1);
		}
		else
		{
			int k = -1;
			if (s[pos]=='+') k = 1;
			rec(s,pos+1,ans + k);
		}
	}
}

int main ()
{
	//string s1,s2;
	cin>>s1>>s2;
	int cnt = 0;
	int cnt1 = 0;
	for (int i = 0;i<s1.length();i++) if (s1[i]=='+') cnt++;else cnt--;
	for (int i = 0;i<s2.length();i++) if (s2[i]=='?') cnt1++;
	counts = cnt;
	rec(s2,0,0);
	if (res!=0)
	printf("%.10f",res/pow(2.0,cnt1));
	else printf("%.10f",0);
	//printf("%.10f",1.0/20);
	//system("pause");
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define SZ(x) int((x).size())
#define SQR(x) (x)*(x)
#define SIGN(x) (x>0)
#define mod 1000000007
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<long long int> vli;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pii > vpii;
typedef stack<int> ST;
typedef queue<int> Q;
typedef map<int,bool> MAP;
int main(int argc, char const *argv[])
{
	int i,counta=0,countb=0;
	string s,p;
	cin>>s>>p;
	for(i=0;i<s.length();i++)
	{
		if(s[i]=='+') counta++;
		else countb++;
		if(p[i]=='+')counta--;
		else if(p[i]=='-')countb--;
	}
	double z=0;
	if(counta<0 || countb<0)
	{
	    cout<<z<<endl;
	    return 0;
	}
	lli var = 1,fact=1,tempa=1,tempb=1;
	for(i=1;i<=counta+countb;i++)
	{
		var = var<<1;
		fact=fact*i;
		if(i==counta) tempa = fact;
		if(i==countb) tempb = fact;
	}
	lli ans = (fact/(tempa))/tempb;
	z = (ans*(1.0))/var;
	cout << setprecision(10) << z<<endl;
//	cout<<z<<endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <map>
#include <ctime>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <list>

using namespace std;

const int MAX_N = 123;
const double EPS = 1e-7;

void recursiveProcedure(int begin, int questions, int currentQuestions, int currentCoordinate, int &goodWays, int &badWays) {
	if (currentQuestions >= questions) {
		if (currentCoordinate == begin)
			goodWays++;
		else
			badWays++;
	}
	else {
		recursiveProcedure(begin, questions, currentQuestions + 1, currentCoordinate - 1, goodWays, badWays);
		recursiveProcedure(begin, questions, currentQuestions + 1, currentCoordinate + 1, goodWays, badWays);
	}
}

int main()
{
	//freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);

	string s1, s2;
	int goodWays, badWays;
	int questions;
	int coord1, coord2;
	int lengthS;

	cin >> s1 >> s2;

	lengthS = s1.length();
	coord1 = coord2 = 0;

	for (int i = 0; i < lengthS; i++) {
		if (s1[i] == '-') coord1--;
		else coord1++;
	}
	questions = 0;
	for (int i = 0; i < lengthS; i++) {
		if (s2[i] == '-') coord2--;
		else if (s2[i] == '+') coord2++;
		else questions++;
	}

	if (questions == 0) {
		if (coord1 == coord2)
			printf("1.000000000000");
		else
			printf("0.000000000000");
	}
	else {
		goodWays = badWays = 0;
		recursiveProcedure(coord1, questions, 0, coord2, goodWays, badWays);

		printf("%.12lf", (double)goodWays / (double)(goodWays + badWays));
	}

	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int posx, cou, x = 10, spn0, spn1;
double ans;
string str0, str1;
const int N = 20;
int dp[N][N];

int main () {
	cin >> str0 >> str1;
	for (int i = 0; i < 15; i++) {
		dp[i][0] = 1;
		dp[i][i] = 1;
		for (int j = 0; j < i; j++) {
			dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
		}
	}
	for (int i = 0; i < str0.size(); i++) {
		if (str0[i] == '+')
			posx++;
		else
			posx--;
	}
	for (int i = 0; i < str1.size(); i++) {
		if (str1[i] == '+')
			posx--;
		if (str1[i] == '-')
			posx++;
		if (str1[i] == '?')
			cou++;
	}
	posx = abs(posx);
	if (posx > cou || posx % 2 != cou % 2) {
		cout << fixed << setprecision(10) << ans;
		return 0;
	}
	if (posx == 0 && cou == 0) {
		ans++;
		cout << fixed << setprecision(10) << ans;
		return 0;
	}
	cout << fixed << setprecision(10) << dp[cou][posx + ((cou - posx) / 2)]  / (pow(2, cou));
}

#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;

#define     _test int _TC; cin >> _TC; while(_TC--)
#define     sz(x) int(x.size())
#define     all(_n) _n.begin(), _n.end()
#define     rall(_n) _n.rbegin(), _n.rend()
#define     IN(a) for(auto &it : a) cin >> it

const    int Mod = 1e9 + 7;
const    int Inf = (1LL << 31) -1;
const    int Maxx = 2e5;

/************************************[Code Starts Here]************************************/
int fact[11];
void precal()
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < 11; i++) fact[i] = fact[i-1]*i;
}

void _case()
{
    string s, ss; cin >> s >> ss;
    int val1 = 0, val2 = 0, cntQ = 0;
    for (char c : s) {
        val1 += c == '+' ? +1 : -1;
    }
    for (char c : ss) {
        cntQ += c == '?';
        val2 += c == '+';
        val2 -= c == '-';
    }
    double tot = pow(2, cntQ);
    int dist = val1 - val2;
    cout << fixed << setprecision(9);

    if (abs(dist) > cntQ || (dist+cntQ)&1) cout << 0.0;
    else {
        int p = 0, m = 0;
        for (int i = 0; i < cntQ; i++) {
            if (val2 < val1) p++, val2++;
            else if (val2 > val1) m++, val2--;
            else m++, p++, i++;
        }
        int permu = fact[cntQ]/fact[m]/fact[p];
        cout << permu/tot;
    }
}

int32_t main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    precal();
    _case();
    return 0;
}

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

double com (int n)
{
    double Num=0 , num=1, dem=1;
    for (int i=n; i>=0; i--)
    {
        num=1;
        dem=1;
        if (i == n) {num=1; dem = 1;}
        for (int j=n; j>n-i; j--)
        {
            num *= j;
        }

        for (int j=i; j>=1; j--)
            dem *= j;
    Num += (num/dem);

    }

    return Num;
}

double com2(int n , int ind)
{
    double Num=0 , num=1, dem=1;

    for (int j=n; j>n-ind; j--)
            num *= j;

        for (int j=ind; j>=1; j--)
            dem *= j;
    Num = num/dem;

    return Num;
}

int main()
{
    string s1,s2;
    double n , pos1=0, pos2=0,counter=0,pro=0,def,post1=0,neg1=0,post2=0,neg2=0;
    cin >> s1 >> s2;
    for (int i=0; i<s1.size(); i++)
    {
        if (s1[i] == '+') post1++;
        else neg1++;
    }

    for (int i=0; i<s2.size(); i++)
    {
        if (s2[i] == '+') post2++;
        else if (s2[i] == '-') neg2++;
        else counter++;
    }

    if (post1==post2 && neg1==neg2) pro=1;
    else if (abs(post1-post2) > counter || abs(neg1-neg2) > counter) pro=0;
    else if (post1 != post2) {def=abs(post1-post2); pro = com2(counter,def)/com(counter); }
    else if (neg1 != neg2) {def=abs(neg1-neg2); pro = com2(counter,def)/com(counter); }

    cout << fixed << setprecision(9) << pro << endl;

    return 0;
}

        #include<bits/stdc++.h>
        using namespace std;
        typedef long long int ll ;
        int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

        int main()
            {
                string a,b;
                char x= '+';
                char y= '-';

                cin>>a>>b;
                map<char,int>check ;
                map<char,int>check2 ;
                int cnt= 0,type=0 ;
                double ans= 0;

                for(int i =0 ;i<a.size();i++)
                {
                     check[a[i]]++;
                     if(b[i]!='?')
                        check2[b[i]]++;
                    else
                        cnt++;
                }
                int val = 0;
                if(check2[x]>check[x]){val+=check2[x]-check[x];type++;}
                if(check2[y]>check[y]){val+=check2[y]-check[y];type++;}

                if(cnt==0&&check[x]==check2[x]&&check2[y]==check[y])
                    ans = 1;
                else if(cnt==0&&((check[x]<check2[x])|(check2[y]>check[y])))
                    ans=0;
                else if(val>cnt)ans=0;
                else if(cnt>0)
                {
                    double power =  ceil(pow(2,cnt));
                    int sd = max(-check2[x]+check[x],-check2[y]+check[y]);
                    int ap = nCr(cnt,sd);
                    ans = (ap*1.00)/power;
                  //  cout<<sd<<endl;
                }
                    printf("%.12lf\n",ans);
            }

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s, s1;
	cin >> s >> s1;
	int n = s.size();
	int cnt = 0;
	rep(i, n){
		if(s[i] == '+') cnt++;
		else cnt--;
	}
	int cnt1 = 0;
	int cur = 0;
	rep(i, n){
		if(s1[i] == '+') cnt1++;
		else if(s1[i] == '-') cnt1--;
		else cur++;
	}
	cout << fixed << setprecision(15);
	if(!cur){
		if(cnt == cnt1) cout << (ld)1 << endl;
		else cout << (ld)0 << endl;
		return 0;
	}
	int num;
	if(cnt < cnt1){
		num = (cur - (cnt1 - cnt)) / 2;
	}
	else{
		num = ((cur - (cnt1 - cnt)) / 2);
	}
	ld cnt2 = 0;
	rep(i, (1 << cur)){
		int c = __builtin_popcount(i);
		if(c == num) cnt2++;
	}
	ld num1 = cnt2;
	ld den = (1 << cur);
	ld ans = (ld)(num1 / den);
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

#include<climits>
#include<algorithm>
#include<numeric>
#include<cstring>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<iomanip>
#include <sstream>
using namespace std;

#define LOOP(i,s,n) for(int i=(s);i<(n);i++)
#define loop(i,n) for(int i=0;i<(n);i++)
#define MAX(mVal, oVal) (mVal) = max((mVal),(oVal))
#define MIN(mVal, oVal) (mVal) = min((mVal),(oVal))
#define All(c) (c).begin(),(c).end()
#define ZERO(arr) memset(arr,0,sizeof(arr))
#define FILL(arr,val) memset(arr,val,sizeof(arr))

#define vi vector<int>
#define vii vector<int,int>
#define vl vector<long>
#define vll vector<long,long>
#define vd vector<double>
#define vdd vector<double,double>
#define vs vector<string>
#define vb vector<bool>
#define mp make_pair
#define pb push_back

#define PI 3.14159265358979
#define INF 1e9
#define DIFF 1e-9

#define MOD (int)(1e9+7)
#define CN (50+1)
int ncr[CN][CN];
void cal_ncr(void)
{
	for(int i=0;i<CN;i++) ncr[i][0]=1;
	for(int i=1;i<CN;i++) for(int j=1;j<=i;j++)
		ncr[i][j] = (ncr[i-1][j-1] + ncr[i-1][j]) % MOD;
}

int main()
{
	double ans=1;
	string X, Y;
	cin>>X>>Y;
	cal_ncr();

	int p1=0,m1=0;
	loop(i,X.size()) if(X[i]==(signed)'+') p1++;
	loop(i,X.size()) if(X[i]==(signed)'-') m1++;

	int p2=0,m2=0,q2=0;
	loop(i,X.size()) if(Y[i]==(signed)'+') p2++;
	loop(i,X.size()) if(Y[i]==(signed)'-') m2++;
	loop(i,X.size()) if(Y[i]==(signed)'?') q2++;

	p1-=p2; m1-=m2;
	int a=max(p1,m1);
	int b=min(p1,m1);
	if(q2>=a)
	{
		if(b>=0)
		{
			int c=q2-a+1;
			if(c<=0) ans=0;
			else
			{
				if(q2>0) ans=(double)ncr[q2][a]/pow(2.0,q2);
			}
		}

	}
	else if(p1!=0 || m1!=0) ans=0;

	cout<<setprecision(15)<<(double)ans<<endl;
	return 0;
}

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vii         vector<pair<ll int, ll int>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  100005
ll fact(ll n){
    ll an=1;
    ll i;
    rep(i,2,n+1)
    an*=i;
    return an;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
	{
	    string s1,s2;
	    cin>>s1;
	    cin>>s2;
	    ll i=0,a1=0,a2=0,a3=0;
	    while(s1[i]!=0){
	        if(s1[i]=='+')
	        a1++;
	        else
	        a1--;
	        if(s2[i]=='+')
	        a2++;
	        else if(s2[i]=='-')
	        a2--;
	        else
	        a3++;
	        i++;
	    }

	    if(a1==a2&&a3==0){
	        cout<<"1";
	        return 0;
	    }
	    if(a1!=a2&&a3==0){
	        cout<<"0";
	        return 0;
	    }
	    if(abs(a1)%2!=abs(a2+a3)%2){
	    cout<<"0";
	    return 0;}

	    if(((a2+a3)<(a1)&&a2<a1)){
	    cout<<"0";
	    return 0;}

	    if((a2-a3)>(a1)&& a2>a1){
        cout<<"0";
	    return 0;}
	    //cout<<a1<<a2<<a3;
	    double x;
	    x=(fact(abs(a3))/(fact(abs((a1-a2)+a3)/2)*fact(abs((a1-a2)-a3)/2)))/(double)(pow(2,a3));
	    printf("%0.11lf",x);
	}
	return 0;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s, s1;
	cin >> s >> s1;
	int n = s.size();
	int cnt = 0;
	rep(i, n){
		if(s[i] == '+') cnt++;
		else cnt--;
	}
	int cnt1 = 0;
	int cur = 0;
	rep(i, n){
		if(s1[i] == '+') cnt1++;
		else if(s1[i] == '-') cnt1--;
		else cur++;
	}
	cout << fixed << setprecision(15);
	if(!cur){
		if(cnt == cnt1) cout << (ld)1 << endl;
		else cout << (ld)0 << endl;
		return 0;
	}
	int num;
	if(cnt < cnt1){
		num = (cur - (cnt1 - cnt)) / 2;
	}
	else{
		num = ((cur - (cnt - cnt1)) / 2) + (cnt - cnt1);
	}
	ld cnt2 = 0;
	rep(i, (1 << cur)){
		int c = __builtin_popcount(i);
		if(c == num) cnt2++;
	}
	ld num1 = cnt2;
	ld den = (1 << cur);
	ld ans = (ld)(num1 / den);
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;

int main()
{
	string a , b;
	cin >> a >> b;

	int res = 0;
	for(int i = 0 ; i < a.size() ; i++)
	{
		if(a[i] == '+')
			res+=1;
		else if(a[i] == '-')
			res-=1;
	}

	int  n = 0 , k = 0;
	for(int i = 0; i < b.size() ; i++)
	{
		if(b[i] == '+')
			k++;
		else if(b[i] == '-')
			k--;
		else if(b[i] == '?')
			n++;

	}

	double cnt = 0;
	for(int mask = 0; mask < 1 << n ; mask++)
	{
		int ans = 0;
		for(int i = 0; i < n ; i++)
		{
			if(mask & 1 << i)
			{
				ans++;
			}
			else
				ans--;

		}

		if(ans + k == res )
			cnt++;

	}

	double m = (cnt/(1<<n));

	if(n == 0)
	{
		if( k == res)
			cout << 1;
		else
			cout << 0;
	}
	else
		cout << fixed << setprecision(9) <<  m;

	return 0;
}

#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <utility>

using namespace std;
#define TR(c,it) for(auto it = c.begin(); it != c.end(); it++)

#define ALL(A) (A).begin(), (A).end()
#define PB push_back
#define MP(A, B) make_pair(A, B)
#define PII vector<pair<int,int> >
#define FI first
#define SE second
#define endl "\n"
#define PR(a...)    do { cout << #a << ": "; pr,a; cout << '\n'; } while (false)
//#define double long double

typedef long long ll;

ll ni() {
	ll ret;
	cin >> ret;
	return ret;
}
template<class T>
void nia(T& list, int n) {
	for (int i = 0; i < n; i++)
		list.emplace(list.end(), ni());

}
template<class T>
void print(T& arr) {
	int index = 0;
	TR(arr,it)
	{
		if (index == 0) {
			cout << *it;
		} else {
			cout << " " << *it;
		}
		index++;
	}
	cout << endl;
}

struct print {
    template <typename T>
    print& operator,(const T& v) {
        std::cout << v << ", ";
        return *this;
    }
} pr;

int main() {
//	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string enviado;
	cin>>enviado;
	int end=0;
	for(char c : enviado)
		if(c=='+'){
			end++;
		}else{
			end--;
		}

	string recibido;
	cin>>recibido;

	int offset =10;
	vector<double>* curr= new vector<double>(21,0.0);
	(*curr)[offset]=1.0;
	vector<double>* next= new vector<double>(21,0.0);

	for(char c : recibido){
		if(c=='+'){
			for(int i =0;i<20;i++)
				(*next)[i+1]+=(*curr)[i];
		}else if(c=='-'){
			for(int i =20;i>0;i--)
				(*next)[i-1]+=(*curr)[i];
		}else{
			for(int i =1;i<20;i++){
				(*next)[i+1]+=(*curr)[i]/2.0;
				(*next)[i-1]+=(*curr)[i]/2.0;
			}

		}

		fill(ALL( *curr),0.0);
		swap(curr, next);
	}
	printf("%.10f\n",(*curr)[end+offset]);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

double factorial( float n){
    if( n == 0)
        return 1;
    return factorial(n -1)*n;
}

int main (){
    string s1, s2;
    cin >> s1 >> s2;
    float n = s1.size();
    float pos_con1 = 0, pos_con2 = 0, unk_count2 = 0;
    for( float i = 0; i < n; i++)
        if( s1[i] == '+')
            pos_con1++;
    for( float i = 0; i < n; i++){
        if(s2[i] == '+')
            pos_con2++;
        else if( s2[i] == '?')
            unk_count2++;
    }
    float count_tobe = pos_con1 - pos_con2;
    double ans = 0;
    if( pos_con1 < pos_con2 )
        printf( "%.12f", ans);
    else if ( pos_con1 == pos_con2)
        printf( "%.12f", float(1)/pow(2, unk_count2));
    else{
        if( count_tobe > unk_count2)
            printf( "%.12f", ans);
        else{
            ans = factorial(unk_count2)/(factorial(count_tobe)*(factorial(unk_count2-count_tobe)));
            ans /= pow(2,unk_count2);
            printf( "%.12f", ans);
        }

    }

}

#include <iostream>
#include <vector>
#include <limits.h>
#include <cmath>

using namespace std;

// build binomial table
vector<int> binomial(int n) {
    vector<int> result(n + 1, 0);
    result[0] = 1;

    for (int i = 0; i < n; ++i) {
        int last = 0;

        for (int j = 0; j <= n; ++j) {
            int temp = result[j];
            result[j] = last + result[j];
            last = temp;
        }
    }

    return result;
}

int main() {
    string drazil, dreamoon;
    cin >> drazil;
    cin >> dreamoon;

    int drazil_pos = 0;

    for (auto& c: drazil) {
        if (c == '+') {
            drazil_pos++;
        } else {
            drazil_pos--;
        }
    }

    int dreamoon_pos = 0;
    int dreamoon_q = 0;

    for (auto &c: dreamoon) {
        if (c == '+') {
            dreamoon_pos++;
        } else if (c == '-') {
            dreamoon_pos--;
        } else {
            dreamoon_q++;
        }
    }

    vector<int> bin = binomial(dreamoon_q);

    int delta = drazil_pos - dreamoon_pos;

    cout.precision(12);

    if ((dreamoon_q - delta) % 2 != 0 || dreamoon_q < abs(delta)) {
        cout << 0.0 << endl;
    } else {
        int alpha = (dreamoon_q - delta)/2;
        cout << double(bin[alpha]) / (1 << dreamoon_q) << endl;
    }

    return 0;
}

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>

using namespace std;

string a, b;
int pFa = 11, pFb = 11, sP = 0, n;

double dreamonAndWifi()
{
    double cantG = 0, cant = 0;

    int DP[15][29];

    memset(DP, 0, sizeof(DP));

    DP[0][11] = 1;

    for(int i = 0; i < 12; i++)
    {
        for(int j = 0; j < 23; j++) if(DP[i][j])
        {
            DP[i + 1][j + 1] += DP[i][j];
            if(j) DP[i + 1][j - 1] += DP[i][j];
        }
    }

    for(int i = 0; i < 23; i++){
        cantG += DP[sP][i];

        if(i == (11 + pFa - pFb))
            cant = DP[sP][i];
    }

    if(!cantG)
        return 0.000000000000;

    return double(cant / cantG);
}

int main()
{
    cin >> a >> b;

    n = int(a.size());

    for(int i = 0; i < n; i++)
    {
        if(a[i] == '+') pFa++;
        if(a[i] == '-') pFa--;
        if(b[i] == '+') pFb++;
        if(b[i] == '-') pFb--;
        if(b[i] == '?') sP++;
    }

    printf("%.15f\n", dreamonAndWifi());

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

double ncr(int n, int r)
{
    r = min(r, n - r);

    int res = 1;
    for (int i = 1; i <= r; i++) res = res * (n - r + i) / i;
    return res;
}

int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);

    string s1, s2;
    cin >> s1 >> s2;

    int num_p = 0, num_q = 0;
    for (int i = 0; i < s1.size(); i++)
    {
        if (s1[i] == '+') ++num_p;
        if (s2[i] == '+') --num_p;
        if (s2[i] == '?') ++num_q;
    }

    cout << fixed << setprecision(12);
    cout << (num_p >= 0 && num_p <= num_q ? ncr(num_q, num_p) / (1 << num_q) : 0) << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#ifndef ONLINE_JUDGE
#define freopen freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#else
#define freopen //comment
#endif
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define pb push_back
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

 main()
{
   #define int long long int
   //freopen
   io
   double ans;
   string s,t;
   cin>>s>>t;
   int sz=s.size();
   int val=0;
   for(int i=0;i<sz;i++)
   {
    if(s[i]=='+')val++;
    else val--;
   }
   int ok=1,valu=0,q=0;
   for(int i=0;i<sz;i++)
   {
    if(t[i]=='?'){ok=0;q++;}
    if(t[i]=='+')valu++;
    else if(t[i]=='-')valu--;
   }

   if(val==valu && ok){ans=1;cout<<setprecision(10)<<fixed<<ans<<endl;return 0;}
   else if(val!=valu && ok){ans=0;cout<<setprecision(10)<<fixed<<ans<<endl;return 0;}
   int fin;
   double num=0.0,den=(1<<q);
   for(int i=0;i<den;i++)
   {
     fin=valu;
     bitset<10>bit(i);
     for(int j=0;j<q;j++)
     {
      if(bit[j])fin++;
      else fin--;
     }
     if(fin==val)num++;
   }
   ans=num/den;
   cout<<setprecision(10)<<fixed<<ans<<endl;

  return 0;

}

/**
 * Motto:   fight till end
 * Author: fyter_112
 **/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ump unordered_map<int,int>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,string>
#define mp make_pair
#define pb push_back
#define rep(i,a,n) for(i=a;i<(n);i++)
#define all(x) x.begin(),x.end()
#define reps(i,j,n)   for(int i=(j);i>=(n);i--)
#define ld long double
#define count(i,n) for(i=n;i>0;i=i/10)
#define mod 1000000007
int ncr(int n, int r)
{

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }
    }

    else
        p = 1;
  return p;
}
int32_t main()
{
  fast
  string a,b;
  cin>>a>>b;
  int c=0,co=0,sum=0,i,ae=0;
  rep(i,0,a.length())
  {
    if(a[i]=='+')
    {
      c++;
    }
    else
    {
      c--;
    }
    if(b[i]!='+' && b[i]!='-')
    {
      ae++;
    }
    else if(b[i]=='+')
    {
      sum++;
    }
    else
    {
      sum--;
    }
  }
  int x=abs(sum-c);
  if(x>ae)
  {
    cout<< 0 <<'\n';
  }
  else
  {
    x=x+(ae-x)/2;
    sum=ncr(ae,x);
    cout << setprecision(20)<< (double)sum/pow(2,ae) <<'\n';
  }
}

#include<bits/stdc++.h>
using namespace std;
string a,b;int i,j,k,l,p,m,q;
double ans;
double c(long long x,long long y)
{
	double sum=1;
	for(long long i=x;i>=x-y+1;i--)  sum=sum*i;
	for(long long i=y;i>=1;i--) sum=(sum/i*(1.0));
	return sum;
}
int main()
{
	cin>>a>>b;
	for(i=0;i<a.length();i++) if(a[i]=='+') p++;else m++;
	for(i=0;i<b.length();i++) if(b[i]=='+') p--;else if(b[i]=='-') m--;else q++;
	if(p<0||m<0) cout<<"0";
	else if(p==0&&m==0) cout<<"1";
	else
	{
		cout<<fixed<<setprecision(12)<<c(q,p)/pow(2,q);
	}
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <iomanip>

using namespace std;

set<string> s;
string s1, s2;
int neg = 0, pos = 0;

void solve(int idx, string cur, int cur_pos, int cur_neg, int &count)
{
	if (cur.length() == s1.length())
	{
		if (cur_pos == pos && cur_neg == neg)
			s.insert(cur);
		count++;
		return;
	}
	if (s2[idx] == '?')
	{
		solve(idx + 1, cur + "+", cur_pos + 1, cur_neg, count);
		solve(idx + 1, cur + "-", cur_pos, cur_neg + 1, count);
	}
	else if (s2[idx] == '+')
		solve(idx + 1, cur + "+", cur_pos + 1, cur_neg, count);
	else
		solve(idx + 1, cur + "-", cur_pos, cur_neg + 1, count);
}

int main()
{
	cin >> s1 >> s2;
	for (int i = 0; i < s1.length(); i++)
	{
		if (s1[i] == '+')
			pos++;
		else
			neg++;
	}
	int count = 0;
	string str;
	solve(0, str, 0, 0, count);
	//cout << count << endl;
	//cout << s.size() << endl;
	double ans = s.size() * 1.0 / count;
	cout << setprecision(10) << fixed << ans << endl;
}

#include<iostream>
using namespace std;
#include<string>
#include<math.h>
#include<algorithm>
#include<iomanip>
int main(){
	string num1, num2;
	int n1 = 0, n2 = 0, numofsym = 0;
	long double final_result = 1;
	cin >> num1 >> num2;
	int i = 0;
	long double factorial_num, factorial_size = 1;
	while (i != num1.size()){

		if (num1[i] == '+')
			n1++;
		else
			n1--;
		if (num2[i] == '+')
			n2++;
		else if (num2[i] == '-')
			n2--;
		else if (num2[i] == '?')
			numofsym++;

		i++;
	}
	int n;
	if (numofsym == 0)
	{
		if (n1 == n2)
		if (n1 < 0)
			cout << n1*-1 << endl;
		else
			cout << n2;
		else
			cout << 0;
		return 0;
	}
	n = numofsym;
	long double factorial_max = 1;
	factorial_size = 1;

	if (n1 > n2)
	{
		if ((n2 + numofsym) == n1)
		{
			factorial_num = 1;
			i = 0;
			while (true){
				if (n > 0)
					factorial_size *= n;
				if ((numofsym - i) > 0)
				{
					factorial_num *= (numofsym - i);
				}
				i++;
				n--;
				if (n <= 0 && (numofsym - i) <= 0)
					break;
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;
		}
		else if ((n2 + numofsym) > n1)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}

	else if (n2 > n1){
		if ((n1 + numofsym) == n2)
		{
			factorial_num = 1;
			i = 0;
			while (true){
				if ((numofsym - i) > 0)
				{
					factorial_num *= (numofsym - i);
				}
				if (n > 0)
					factorial_size *= n;
				i++;
				n--;
				if (n <= 0 && (numofsym - i) <= 0)
					break;
			}
			//cout << "f.size" << factorial_size << endl << "f.n " << factorial_num << endl << " f.max " << factorial_max << endl;
			final_result = (factorial_size) / (factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;
		}
		else if ((n1 + numofsym) > n2)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}
	else if (n1 == n2)
	{
		if (numofsym % 2 == 0)
		{
			factorial_num = 1;

			int start = numofsym, end = 0;
			i = 0;
			bool ok = false;
			while (true){
				if (start - end != (n2 - n1))
				{
					start--;
					end++;
					ok = true;
				}

				if (n > 0)
					factorial_size *= n;

				n--;
				if (n <= 0 && ok == true)
					break;
			}
			if (start != 0){
				if (start>0)
				while (start > 0)
				{
					factorial_num *= start;
					start--;
				}
				else{
					while (start<0){
						factorial_num *= start;
						start++;
					}
				}
			}
			if (end != 0){
				if (end > 0){
					while (end > 0){
						factorial_max *= end;
						end--;
					}
				}
				else
				{
					while (end < 0){
						factorial_max *= end;
						end++;
					}

				}
			}
			final_result = (factorial_size) / (factorial_max*factorial_num);
			final_result /= pow(2, numofsym);
			cout << setprecision(10) << final_result << endl;

		}
		else
			cout << 0;
	}
}

#include <bits/stdc++.h>

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
bool vis[N];
int dist[2000];
int dp[20][2000];
int n,sum,cur=0,ways=1;
string s,s1;
int solve(int idx,int sum_so_far){
    int cur =0;
    if(sum_so_far<0)cur=1000;
    if(idx==n){
        dist[sum_so_far]++;
        return  sum_so_far!=sum? 0:1;
    }

    int &ret =dp[idx][sum_so_far+cur];
    if(~ret)
        return ret;

    if(s1[idx]=='-')
        ret  = solve(idx+1,sum_so_far-1);
    else if(s1[idx]=='+')
        ret  = solve(idx+1,sum_so_far+1);
    else {
         ret = solve(idx+1,sum_so_far-1);
         ret += max(ret,solve(idx+1,sum_so_far+1));
    }

    return ret;

}
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif

    cin>>s>>s1;
    n=SZ(s),sum=0;
    lp(i,n){
        if(s[i]=='-')sum+=-1;
        else sum+=1;
    }
    memset(dp,-1,sizeof(dp));
    lp(i,n)if(s1[i]=='?')ways*=2;

    double res = 1;
    int x =  solve(0,0);
    // cout<<x<<endl;
    // cout<<dist[sum]<<endl;
    if(x==0)res=0,printf("%.11lf",res);
    else printf("%.11lf",(1.0*dist[sum])/(1.0*ways));
    return 0;
}

#include<iostream>
#include<string>

using namespace std;

int fact(int n)
{
	int fac=1;

	for(int i = 2; i <= n; i++)
		fac *= i;
	return fac;
}

int main()
{
	string s1, s2;
	int pos1=0, pos2=0, neg1=0, neg2=0, q=0;

	cin >> s1 >> s2;

	for(int i = 0; i < s1.length(); i++)
	{
		if(s1[i] == '+')
			pos1++;
		if(s1[i] == '-')
			neg1++;
	}

	for(int i = 0; i < s2.length(); i++)
	{
		if(s2[i] == '+')
			pos2++;
		if(s2[i] == '-')
			neg2++;
		if(s2[i] == '?')
			q++;
	}

	if(neg1 == neg2 && pos1 == pos2 && q == 0)
	{
		cout << "1.000000000000" << endl;
		return 0;
	}

	if(pos1 > pos2 + q)
	{
		cout << "0.000000000000" << endl;
		return 0;
	}

	int temp = pos1 - pos2;

	double anw = (fact(q)/(fact(temp)*fact(temp-q)))/(double)pow(2,(float)q);

	printf( "%.10lf\n" , anw);

}

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main() {
	string s1,s2;
	bool b = 0;
	int c1 = 0, c2 = 0, QMcount = 0;
	double ans = 0, sol;
	cin >> s1 >> s2;
	for (int i = 0; i < s1.size(); i++) {
		if (s1[i] == '+')
			c1++;
		else
			c1--;
		if (s2[i] == '+')
			c2++;
		else if (s2[i] == '-')
			c2--;
		else
			QMcount++;
	}
	if (!QMcount) {
		if (c1 == c2)
			cout << 1 << '\n';
		else
			cout << 0 << '\n';
		return 0;
	}
	vector<int>poss(QMcount + 1);
	int j = 1,i = 0;
	while (j <= QMcount) {
		poss[i] = j - (QMcount - j) + c2;
		if ( j == QMcount && j + c2 == c1)
			b = 1;
		j++,i++;
	}
	if (-QMcount + c2 == c1)
		b = 1;
	poss[QMcount] = -QMcount + c2;
	for (int i = 0; i <= QMcount; i++)
		if (poss[i] == c1) {
			ans++;
			break;
		}
	if (b || ans == 0)
		sol = ans / pow(2,QMcount);
	else
		sol = (ans + (QMcount - 1)) / pow(2, QMcount);
	cout << fixed << showpoint << setprecision(12) << sol << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s1;
    cin >> s1;
    string s2;
    cin >> s2;
    int cnt = 0, un = 0, pl = 0, pl1 = 0, mi = 0, mi1 = 0;
    for(int i = 0; i < s1.size(); i++)
    {
        if(s1[i] == '+')
            pl1++;
    }
    mi1 = s1.size() - pl1;
    for(int i = 0; i < s2.size(); i++)
    {
        if(s2[i] == '?')
                un++;
        else
        {
            for(int j = 0; j < s1.size(); j++)
            {
                if(s2[i] == s1[j])
                {
                    cnt++;
                    if(s2[i] == '+')
                        pl++;
                    else
                        mi++;
                    s1[j] = '*';
                    break;
                }
            }
        }
    }
    float ans = 0.0;
    if(!cnt)
        cout << ans << endl;
    else
    {
        if(mi1 - mi == 0 && pl1 - pl == 0)
            cout << "1" << endl;
        else
        {
            mi1 -= mi;
            pl1 -= pl;
            int x = min(mi1, pl1);
            float ans = 1.0;
            for(int i = 1; i <= un - x; i++)
                ans *= 0.5;
            cout << ans << endl;
        }
    }
}

#include<iostream>
#include<cmath>
using namespace std;
//a中的+和-数量一定分别大于等于b中的+和-的数量 r5
int main(){
    string a,b;
    cin>>a>>b;
    int len=a.length();
    int ca1=0;
    int ca0=0;
    int cb1=0;
    int cb0=0;
    int cc=0;
    int c1=0;
    int c0=0;
    int m=1,n=1;
    float lv=0.0;

    for(int i=0;i<len;i++){
        if(a[i]!=b[i]){
            if(a[i]=='+'){
                ca1+=1;
            }
            else{
                ca0+=1;
            }
            if(b[i]=='+'){
                cb1+=1;
            }
            else if(b[i]=='-'){
                cb0+=1;
            }
            else{
                cc+=1;
            }
        }
    }
    c1=ca1-cb1;
    c0=ca0-cb0;
    if(c1*c0<0){
        lv=0.0;
    }

    else{
        if(c1*c0>0){
            for(int j=cc;j>c1;j--){
                m=m*j;
            }
            for(int k=c1;k>0;k--){
                n=n*k;
            }
            lv=m/n/pow(2,cc);
        }
        else if(c1==0 && c0==0){
            lv=1.0;
        }
        else{
            lv=1/pow(2,cc);
        }
    }

    /*
    else if(c1==0 && c0==0){
        lv=1.0;
    }
    else{
        for(int j=cc;j>c1;j--){
            m=m*j;
        }
        for(int k=c1;k>0;k--){
            n=n*k;
        }
        lv=m/n/pow(2,cc);
    }*/
    //cout<<lv;
    printf("%0.12f\n",lv);
}

// Create your own template by modifying this file!
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int i,j,n,plus=0,minus=0,q=0;
    char a[11],b[11];

    scanf("%s", a);
    scanf("%s", b);
    // cin >> a;
    // cin >> b;

    n = strlen(a);

    // printf("plus=%d, minus=%d\n", plus, minus);
    // printf("a=%s, n=%d\n", a, n);

    for (i=0; i<n; i++) {
        if (a[i] == '+') {
            plus++;
        } else {
            minus++;
        }
    }

    // printf("plus=%d, minus=%d\n", plus, minus);

    for (i=0; i<n; i++) {
        if (b[i] == '+') {
            if (plus > 0) {
                plus--;
            } else {
                cout << "0.000000000000" << endl;
                return 0;
            }
        } else if (b[i] == '-') {
            if (minus > 0) {
                minus--;
            } else {
                cout << "0.000000000000" << endl;
                return 0;
            }
        } else {
            q++;
        }
    }

    n = plus + minus;
    if (n == 0) {
        cout << "1.000000000000\n";
        return 0;
    }

    // 0 means -
    // 1 means +
    int result = 0, total=0;
    long double ans = 0.0;
    // printf("plus=%d, minus=%d\n", plus, minus);
    // cout << "total will be 1 << " << n << " : " << (1<<n) << endl;
    for (i=0; i<(1<<n); i++) {
        int p=0, m=0;
        for (j=0; j<n; j++) {
            if (i & (1<<j)) {
                p++;
            } else {
                m++;
            }
        }

        if (p==plus && m==minus) {
            result++;
        }
        total++;
    }

    ans = (result)/(total*1.0);
    printf ("%.14Lf\n", ans);
    cout << "result is " << result << endl;
    cout << "total is " << total << endl;
    // cout << ans << endl;

    return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define loop(i,s,e) for(ll i=s; i<e; i++ )
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define ss second
using namespace std;

double fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = res * i;
    return res;
}

double nCr(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

void alpha(){
	string s1, s2;

	cin>>s1>>s2;

	ll size = s1.size();

	ll pos_s1=0, neg_s1=0, pos_s2=0, neg_s2=0;

	for(ll i=0; i<size; i++){
		if(s1[i]=='+')pos_s1++;
		else neg_s1++;
		if(s2[i]=='+')pos_s2++;
		else if(s2[i]=='-')neg_s2++;
	}

	ll ques = size - neg_s2 - pos_s2;
	ll req_pos = pos_s1 - pos_s2;
	ll req_neg = neg_s1 - neg_s2;

	double ans = nCr(ques, req_pos)/pow(2,ques);

	cout<<ans<<endl;

}

int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	alpha();

	return 0;

}

#include<bits/stdc++.h>
using namespace std;

#define ll long long int

double C(double n, double r){
	if(r==0 || r==n)return 1;
	else if(r==1 || r==n-1)return n;
	else return C(n-1, r-1) + C(n, r-1);
}

int main(){
	string p, q;
	cin>>p>>q;
	double a=0, b=0;
	for(int i=0;i<(int)p.size();i++){
		if(p[i]=='+')a++;
		else b++;
	}
	double c=0, d=0, e=0;
	for(int i=0;i<(int)q.size();i++){
		if(q[i]=='+')c++;
		else if(q[i]=='-')d++;
		else e++;
	}
	if(c>a || d>b)cout<<0<<'\n';
	else{
		a-=c;
		b-=d;
		double ans = C(e, a)/pow(2.0, e);
		cout<<ans<<'\n';
	}
	return 0;
}

#include "cstdio"
#include "cstring"
#include "algorithm"
using namespace std;
long long n,a,b,ile,co,w1,w2,tab[1005],czo;
long double z,he=1,qq,q,k;
char x[1005],y[1005];
long long silnia (long long x)
{
	long long w=1;
	for (int i=2; i<=x; i++)
	{
		w*=i;
	}
	return w;
}
int main()
{
	scanf (" %s %s", x, y);
	for (int i=0; i<strlen(x); i++)
	{
		if (x[i]=='+') a++,w1++;
		else if (x[i]=='-') b++,w1--;
	}
	for (int i=0; i<strlen(y); i++)
	{
		if (y[i]=='+') a--,w2++;
		else if (y[i]=='-') b--,w2--;
		else k++;
	}
	if (abs(w1-w2)>k) printf ("%.12Lf\n", he-1);
	else if (a==k || b==k || k==0) printf ("%.12Lf\n", he);
	else
	{
		//qq=silnia(a+b)/(silnia(max(a,b))*silnia(max(a,b)-min(a,b)));
		//printf ("%.12Lf\n", he/qq);
		czo=k;
		for (int i=0; i<k; i++,czo-=2) tab[i]=czo;
		for (int i=0; i<k; i++) if (tab[i]+w2==w1) q++;
		printf ("%.12Lf\n",q/k);
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pi  3.14159265358979323846
#define mod 1000000007
#define pf push_front
#define pb push_back
#define flush fflush(stdout);
#define null NULL
#define test cout<<"#";

ll solve(ll m, ll n)
{
    ll ans = 1;
    for(ll x = 1; x <= n; x++)
    {
        ans = ans*(m+x);
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string a, b;
    cin>>a>>b;
    ll p1 = 0, m1 = 0;
    ll p2 = 0, m2 = 0;
    for(ll x = 0; x < a.length(); x++)
    {
        if(a[x] == '+')
            p1++;
        else if(a[x] == '-')
            m1++;
    }
    for(ll x = 0; x < b.length(); x++)
    {
        if(b[x] == '+')
            p2++;
        else if(b[x] == '-')
            m2++;
    }
    if(p1==p2 && m1==m2)
    {
        cout<<1.000000000000;
    }
    else if(((p1!=p2) || (m1!=m2)) && (p2+m2)==b.length())
    {
        cout<<0.000000000000;
    }
    else
    {
        ll d = (p1-p2);
        ll e = (m1-m2);
        ll f = (b.length()-p2-m2);
        //cout<<p1<<" "<<m1<<" "<<p2<<" "<<m2<<"\n";
        if(((p1==0 && p2!=0) || (m1==0 && m2!=0) || (p1!=0 && p2==0) || (m1!=0 && m2==0 && p2!=0)) && (d+e)==b.length())
            cout<<0.000000000000;
        else
        {
            ll d = (p1-p2);
            ll e = (m1-m2);
            ll f = (b.length()-p2-m2);
            ll num = solve(d, e);
            ll den = solve(0, e);
            //cout<<num<<" "<<den<<"\n";
            ll ans = (num)/(den);
            ll power = (ll)pow(2,f);
            double an = (double)(ans)/power;
            printf("%.10lf",an);
        }

    }

}

#include<bits/stdc++.h>
//#define LOCAL
using namespace std;
char str1[20],str2[20];
int len,cur,cnt,tot;
int target;
void dfs(int x)
{
//	cout<<x<<endl;
	if(x==len)
	{
		if(cur==target)cnt++;
		return;
	}
	if(str2[x]=='+'){cur++;dfs(x+1);cur--;}
	if(str2[x]=='-'){cur--;dfs(x+1);cur++;}
	if(str2[x]=='?')
	{
		cur++;
		dfs(x+1);
		cur--;
		cur--;
		dfs(x+1);
		cur++;
	}
}
int main()
{
	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	#endif // LOCAL
	scanf("%s%s",str1,str2);
	len=strlen(str1);
	target=0;
	for(int i=0;str1[i];i++)
	{
		if(str1[i]=='+')target++;
		if(str1[i]=='-')target--;
	}
	cur=0;cnt=0;tot=0;
	for(int i=0;str2[i];i++)if(str2[i]=='?')tot++;
	dfs(0);
	double power=1;
	for(int i=1;i<=tot;i++)power*=2;
	cout<<power<<endl;
	cout<<cnt<<endl;
	printf("%.12lf\n",(double)cnt/(double)power);
}

#include<bits/stdc++.h>

using namespace std;

int n, m, k, q, x1, x2;

double n0, ans;

string str0, str1;

const int N = 35;

int dp[N][N][N * N];

int f(int x) {
	int ans0 = 1;
	for (int i = 2; i <= x; i++) {
		ans0 *= i;
	}
	return ans0;
}

int c(int x, int y) {
	int ans0;
	return f(x) / f(y) * f(x - y);

}

int main () {
	cin >> str0 >> str1;
	for (int i = 0; i < str0.size(); i++) {
		if (str0[i] == '+')
			x1++;
		else
			x1--;
	}
	for (int i = 0; i < str1.size(); i++) {
		if (str1[i] == '+')
			x1--;
		if (str1[i] == '-')
			x1++;
		if (str1[i] == '?')
			x2++;
	}
	k = pow(2, x2);
	if (x1 == 0 && x2 == 0) {
		ans = 1;
		cout << fixed << setprecision(10) << ans;
		return 0;
	}
	if (x1 % 2 != x2 % 2)
		cout << fixed << setprecision(10) << ans;
	if (x1 == 0) {
		ans = 0.5;
		cout << fixed << setprecision(10) << ans;
		return 0;
	}
	else
		ans *= c(x2, x1) * c((x2 - x1), ((x2 - x1) / 2));
	cout << fixed << setprecision(10) << ans;
}

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#define sc(n) scanf("%d",&n);
#define sc_ll(n) scanf("%I64d",&n);
#define pr(n) printf("%d",n);
#define pr_ll(n) printf("%I64d",n);
int fact(int n){
    int s=1;
    for(int i=1;i<=n;i++) s*=i;
    return s;
}
using namespace std;
int main(){
    int x_plus,x_minus,sum1=0,sum2=0,i,unre=0,v;
    int p,q,r;
    double m;
   // string a,b;
    char a[100],b[100];
    //cin>>a;
    //cin>>b;//*/
    scanf("%s",a);
    scanf("%s",b);
    int l1=strlen(a);//l1=a.length();
    for(i=0;i<l1;i++)
        if(a[i]=='+') sum1++;
        else sum1--;
    for(i=0;i<l1;i++){
        if(b[i]=='+') sum2++;
        else if(b[i]=='-') sum2--;
        else  unre++;
    }
    //printf("%d %d",sum1,sum2);
   // cout<<unre<<endl;
    if(!unre) {
        if(sum1==sum2) printf("1");
        else printf("0");
        return 0;
    }
    v=sum1-sum2;
    x_plus=(unre+v)/2;
    x_minus=(unre-v)/2;
    if(x_plus<0 || x_minus<0) {printf("0");return 0;}
    if((unre+v)/2.0!=(unre+v)/2 || (unre-v)/2.0!=(unre-v)/2 || x_plus<0 || x_minus<0)
        printf("0");
    else {
        p=1;
        for(int i=1;i<=unre;i++) p*=2;
        q=fact(unre);
        r=fact(unre-x_plus)*fact(x_plus)*p;
        m=(double)q/double(r);
        printf("%.12lf",m);
    }
 //   /
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int fact(int n,int r){
    if(n==0 || n==1 || r==0 || r==n) return 1;
    if(r==1 || r==n-1) return n;
    else return fact(n-1,r)+fact(n-1,r-1);
}

int position(string s,int n,int start){
    for(int i=0;i<n;i++){
        if(s[i]=='+') start++;
        else if(s[i]=='-') start--;
    }
    return start;
}

int main(){
    int n;
    string s1,s2;
    cin>>s1>>s2;
    int pos1=0,pos2=0,ques=0;
    pos1 = position(s1,s1.size(),0);
    pos2 = position(s2,s2.size(),0);
    for(int i=0;i<s2.size();i++){
        if(s2[i]=='?') ques++;
    }
    //int diff1 = pos1-pos2;
    int diff = abs(pos1-pos2);
    if((ques%2==0 && diff%2==1) || (ques%2==1 && diff%2==0)  ){
        //cout.precision(9);
        //cout<<fixed<<double(0)<<endl;
    }
    else if(ques%2==0 && diff%2==0 && diff<ques){
        //cout.precision(9);
        if(diff==0) cout<<fact(ques,int(diff/2)+1)/pow(2,ques)<<endl;
        else cout<<fact(ques,int(ques/diff)+1)/pow(2,ques)<<endl;
    }
    else if(ques%2==1 && diff%2==1 && diff<ques){
        //cout.precision(9);
        cout<<fact(ques,diff)/pow(2,ques)<<endl;
    }
    else cout<<0<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int sum1 = 0;
bool calc(string &s,int pos, int sum)
{
	if(pos == s.size())
	{
		if(sum == sum1)
			return 1;
		else
			return 0;
	}
	int res = 0;
	if(s[pos] == '?')
	{
		res |= calc(s,pos + 1,sum + 1);
		res |= calc(s,pos + 1, sum - 1);
	}
	if(s[pos] == '+')
		res |= calc(s,pos + 1,sum + 1);
	if(s[pos] == '-')
		res |= calc(s,pos + 1, sum - 1);
	return res;
}
int main()
{
//	ifstream cin("input.txt");
	string s;
	cin >> s;
	string s1;
	cin >> s1;
	for(int i = 0; i < s.size(); ++i)
	{
		if(s[i] == '+')
			++sum1;
		else
			--sum1;
	}
	int qa = 0;
	for(int i = 0; i < s1.size(); ++i)
	{
		if(s1[i] == '?')
			qa = 1;
	}
	if(calc(s1,0,0))
	{
		if(!qa)
			cout << "1.000000000000";
		else
			cout << "0.500000000000";
	}
	else
	{
		cout << "0.000000000000";
	}
}

 #include<iostream>
#include<string.h>
#include<math.h>

using namespace std;

long fact(int n)
{ long f=1;
    int i;
    for(i=1;i<=n;i++)
    f=f*i;

    return f;

}

int main()
{
    char s1[10],s2[10];
    cin>>s1;
    cin>>s2;
    int p=0,pr=0,m=0,mr=0,q=0;
    int l1=strlen(s1),l2=strlen(s2);
    int i;
    long double ans;
    for(i=0;i<l1;i++)
    {
        if(s1[i]=='+')
        p++;
        else if(s1[i]=='-')
        m++;
    }

    for(i=0;i<l2;i++)
    {
        if(s2[i]=='+')
        pr++;
        else if(s2[i]=='-')
        mr++;
        else if(s2[i]=='?')
        q++;
    }
    float nmrt,denm;
    pr=p-pr;
    mr=m-mr;
    if(pr==0&& mr==0)
    ans=1;
    else if(pr<0 || mr<0)
	ans=0;
    else
    {
        nmrt=(fact(q)/((fact(pr))*(fact(mr))));
        denm=pow(2,q);
        ans=(nmrt/denm);
    }
    cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define phbk push_back
int main()
{
	string a,b;
	lli k=0,x=0;
	cin>>a>>b;
	for(lli i=0;i<a.length();++i)
		k+=((a[i]=='+'?1:-1) - (b[i]=='+'?1:(b[i]=='-'?-1:0)));
	//cout<<k<<endl;
	for(lli i=0;i<b.length();++i)
		if(b[i]=='?')
			x++;
	//cout<<x<<endl;
	if(x<abs(k))
		printf("0.000000000");
	else if(abs(x-abs(k))&1)
		printf("0.000000000");
	else
	{
		//cout<<"!";
		lli y=(x+abs(k))/2;
		lli z=(x-abs(k))/2;
		lli ans=1,ans2=1;
		for(lli i=1;i<=y;++i)
			ans*=i;
		for(lli i=2;i<=z;++i)
			ans*=i;
		for(lli i=2;i<=x;++i)
			ans2*=i;
		/*cout<<ans<<endl;
		cout<<ans2<<endl;*/
		printf("%.9lf",double(ans*1.0/ans2));
	}
}

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int c = 0, answer = 0;
string a, b, x;

int Count(string z){
    int counter = 0;
    for (int i = 0; i < z.size(); i++){
        if (z[i] == '+')counter++;
        if (z[i] == '-')counter--;
    }
    return counter;

}

void shit(){
    if (c == b.size()) return;

    for (int i = 0; i < 2; i++){
        if (b[c] == '+')b[c] = '-';
        else b[c] = '+';
        if (c == b.size() - 1){
            if (Count(b) + Count(x) == Count(a)) answer++;
        }
        c++;
        shit();
        c--;
    }
}

int main(){
    cin >> a >> x;
    sort (a.begin(), a.end());
    sort (x.begin(), x.end());
    int Q = 0, P = 0, N = 0;
    for (int i = 0; i < a.size(); i++){
        if (x[i] == '?')Q++;
    }

    for (int i = 0; i < Q; i++)b += '-';

    shit();

    if (a == x) cout << 1;
    else
    cout << fixed << (double)answer/ (double)( pow(2, Q));
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, k, n) for ((i) = (k); (i) < (n); (i)++)
#define FORD(i, k, n) for ((i) = (k); (i) >= (n); (i)--)
#define FORE(i, w) for (typeof((w).begin())(i) = (w).begin(); (i) != (w).end(); ++(i))
#define EACH(x, a) for (auto &x : a)
#define ll long long
#define PB(x) push_back(x)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define cpy(a, b) memcpy(a, b, sizeof(a))
#define sortall(x) sort(all(x))
#define out(x) cout << x << " ";
#define line() cout << "\n";
#define print(x) cout << x << "\n";
typedef vector<int> vi;
typedef vector<long long> vl;
#define vt vector
#define ar array

const int MOD = 1'000'000'007;
const int N = 2e6 + 13, M = N;

template <typename T, typename U>
static void amin(T &x, U y);
template <typename T, typename U>
static void amax(T &x, U y);
template <class A>
void read(vt<A> &v);
template <class A, size_t S>
void read(ar<A, S> &a);
template <class T>
void read(T &x);
void read(double &d);
void read(long double &d);
template <class A>
void read(vt<A> &x);
template <class A>
void write(vt<A> &x);
void write(vt<string> &x);
//==========================================================================
int fact[N];

void precomp()
{
    fact[0] = 1;
    for (int i = 1; i < N; i++)
        fact[i] = fact[i - 1] * i;
}

int C(int n, int k)
{
    return fact[n] / (fact[k] * fact[n - k]);
}
void solve()
{
    string sent, received;
    cin >> sent >> received;
    int sentPlus = 0, sentMinus = 0;
    int recPlus = 0, recMinus = 0, question = 0;
    int i, n = sent.length();
    FOR(i, 0, n)
    {
        if (sent[i] == '+')
            sentPlus++;
        else
            sentMinus++;
    }
    FOR(i, 0, n)
    {
        if (received[i] == '+')
            recPlus++;
        else if (received[i] == '-')
            recMinus++;
        else
            question++;
    }
    double ans = (double)0;
    cout << setprecision(9);
    int pReq = sentPlus - recPlus;
    int mReq = sentMinus - recMinus;
    if (pReq + mReq != question || pReq < 0 || mReq < 0 || (pReq == 0 && mReq == 0))
    {
        std::cout << std::setprecision(9) << (double)0 << '\n';
        return;
    }
    int k = (n - (abs(mReq - pReq))) / 2;
    ans = (double)C(n, k) / (1 << n);
    std::cout << std::setprecision(9) << (double)ans << '\n';
}
//==========================================================================
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    precomp();
#ifndef ONLINE_JUDGE
#define ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

template <typename T, typename U>
static void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template <typename T, typename U>
static void amax(T &x, U y)
{
    if (x < y)
        x = y;
}

template <class T>
void read(T &x)
{
    cin >> x;
}
void read(double &d)
{
    string t;
    read(t);
    d = stod(t);
}
void read(long double &d)
{
    string t;
    read(t);
    d = stold(t);
}
template <class A>
void read(vt<A> &x)
{
    EACH(a, x)
    read(a);
}
template <class A>
void write(vt<A> &x)
{
    EACH(a, x)
    {
        out(a);
    }
    line();
}

void write(vt<string> &x)
{
    EACH(a, x)
    {
        out(a);
        line();
    }
}

#include <bits/stdc++.h>

using namespace std;

#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define ler freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define imprime(x, Y)                              \
  for (int X = 0; X < Y; X++) cerr << x[X] << " "; \
  cerr << endl;
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vector<ii> > vvii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;

string w1, w2;
int tam;
long double total, correct;

void solve( int pos, int res1, int res2 ) {
    if( pos>=tam ) {
        if( res1==res2 ) correct++;
        total++;
        return;
    }
    if( w1[pos] == '+' ) res1++;
    else res1--;

    if( w2[pos] == '+' ) {
        solve( pos+1, res1, res2+1);
    } else if( w2[pos] == '-') {
        solve( pos+1, res1, res2-1);
    } else {
        solve( pos+1, res1, res2+1);
        solve( pos+1, res1, res2-1);
    }
}

int main() {
    getline(cin,w1);
    getline(cin,w2);

    tam = w1.size();
    total = correct = 0;

    solve(0,0,0);

    long double res = correct/total;

    printf("%.10Lf\n",res);
    return 0;
}

// 1487459481137

#include <vector>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

// The main recursive method
// to print all possible
// strings of length k
void printAllKLengthRec(char set[], string prefix, int n, int k,vector<string> v)
{

    // Base case: k is 0,
    // print prefix
    if (k == 0)
    {
        v.push_back(prefix) ;
        //cout << (prefix) << endl;
        return;
    }

    // One by one add all characters
    // from set and recursively
    // call for k equals to k-1
    for (int i = 0; i < n; i++)
    {
        string newPrefix;

        // Next character of input added
        newPrefix = prefix + set[i];

        // k is decreased, because
        // we have added a new character
        printAllKLengthRec(set, newPrefix, n, k - 1 ,v);
    }

}

void printAllKLength(char set[], int k,int n,vector<string>v)
{
    printAllKLengthRec(set, "", n, k ,v);
}

// Driver Code
int main()
{

    string str1 , str2;
    cin>> str1 >> str2;
    int n_q =0 ;
    int sum1 = 0;
    int sum2 = 0;
    for (int i = 0 ;i <str1.length(); i++)
    {
        if (str1[i]=='+') sum1 ++ ;
        else sum1 -- ;
    }
    for ( int i = 0; i<str2.length() ; i++)
    {
        if (str2[i]=='?') n_q ++;
    }

    if (n_q == 0)
    {
        for (int i = 0 ;i <str2.length(); i++)
         {
              if (str2[i]=='+') sum2 ++ ;
              else  sum2 -- ;
         }
         if (sum1 == sum2) cout<<"1";
         else cout<<"0";
         return 0 ;
    }

    int q = pow (2,n_q);
    std::vector<string> v(q) ;
    char set1[] = {'+', '-'};
    int k = n_q;
    printAllKLength(set1, k, 2 ,v);
    std::vector<string> final (q);
    size_t found = str2.find('?');
    int index = found;
    for (int i = 0 ; i <q ; i++)
    {
        final [i] = str2.substr(0,index) + v [i]; //+  str2.substr(index +q) ;
    }

        for (int i = 0 ; i <q ; i++)
    {
        cout<<final[i]<<endl;
        cout<<v[i]<<endl;
    }

     cout << k <<q <<n_q;

}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
char s1[50],s2[50],jia1=0,jia2=0,jian1=0,jian2=0,wen=0;
int c(int n,int m)
{
    if(n==m)
        return 1;
    int sum=1,res=1;
    for(int i=n;i>n-m;i--)
    {
        sum*=i;
    }
    for(int i=n-m;i>=1;i--)
    {
        res*=i;
    }
   // printf("%d ",res);
    return sum/res;
}
int main()
{
    scanf("%s%s",s1,s2);
    int len=strlen(s1);
    for(int i=0;i<len;i++)
    {
        if(s1[i]=='+')
            jia1++;
        if(s1[i]=='-')
            jian1++;
        if(s2[i]=='+')
        jia2++;
        if(s2[i]=='-')
            jian2++;
        if(s2[i]=='?')
            wen++;
    }
    int jia=jia1-jia2;
    int jian=jian1-jian2;
    if(jia>wen||jian>wen||jia+jian>wen)
    {
        printf("%.12lf",0/1.0);
    }
    else if(jia==0&&jian==0)
    {
        printf("%.12lf",1*1.0);
    }
    else
    {
        c(wen,jia);
        printf("%.12lf",c(wen,jia)/(pow(2,wen)+0.0001));
    }

}
//2019-07-26 20:40:19.891

#include<climits>
#include<algorithm>
#include<numeric>
#include<cstring>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include <sstream>
using namespace std;

#define LOOP(i,s,n) for(int i=(s);i<(n);i++)
#define loop(i,n) for(int i=0;i<(n);i++)
#define MAX(mVal, oVal) (mVal) = max((mVal),(oVal))
#define MIN(mVal, oVal) (mVal) = min((mVal),(oVal))
#define All(c) (c).begin(),(c).end()
#define ZERO(arr) memset(arr,0,sizeof(arr))
#define FILL(arr,val) memset(arr,val,sizeof(arr))

#define vi vector<int>
#define vii vector<int,int>
#define vl vector<long>
#define vll vector<long,long>
#define vd vector<double>
#define vdd vector<double,double>
#define vs vector<string>
#define vb vector<bool>
#define mp make_pair
#define pb push_back

#define PI 3.14159265358979
#define INF 1e9
#define DIFF 1e-9
#define MOD 1000000007
#define _N 100
int dp[_N][_N];

int main()
{
	double ans=1;
	string X, Y;
	cin>>X>>Y;
	sort(All(X));
	sort(All(Y));
	int p1=0,m1=0;
	loop(i,X.size()) if(X[i]==(signed)'+')p1++;
	m1=X.size()-p1;

	double p2=0,m2=0,q2;
	loop(i,X.size()) if(Y[i]==(signed)'+') p2++;
	loop(i,X.size()) if(Y[i]==(signed)'-') m2++;
	q2=X.size()-p2-m2;

	p1-=p2;
	m1-=m2;

	double a=max(p1,m1);
	double c=q2-a+1;
	if(c<=0) ans=0;
	else ans=1;
	while(c<=q2){ans*=c;c++;}
	if(q2) ans/=pow(q2,2);
	cout<<ans<<endl;
	return 0;
}

#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>

#define xx first
#define yy second
#define mod 1000000007
#define pb push_back
#define mp make_pair
//#define MAX 2000000000
using namespace std;

int dirx[8] = {1,0,-1,0,1,-1,-1,1};
int diry[8] = {0,1,0,-1,1,1,-1,-1};

string str1,str2;
int main() {
    //freopen("input.input","r",stdin);
    cin >> str1 >> str2;
    int n = str1.size(), cnt = 0, k = 0, cnt2=0;
    for(int i=0;i<n;i++)
        if(str1[i]=='+') cnt ++;
        else cnt --;
    for(int i=0;i<n;i++)
        if(str2[i] == '+') cnt2 ++;
        else if(str2[i] == '-') cnt2 --;
        else k ++;
    int mask = 1<<k;mask--;
    int a, r = 0;
    if(mask == 0) {
        r = 1<<k;
    }
    else {
        while(mask--) {
            int m = mask, tt = 0;
            a = 0;
            while(m>0) {
                if(m%2==1) a = (a+m%2);
                m/=2;
            }
            a -= (k-a);
            if(a+cnt2 == cnt) r ++;
        }
    }
    double t = r;
    int m = 1<<k;
    t = t/(double)m;
    printf("%.9lf",t);
}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
    string s1,s2;
    cin>>s1>>s2;
    long long int ans1=0;
    long long int ans2=0;
    long long int qm=0;
    int length=s1.length();
    for(int i=0;i<length;i++)
    {
        if(s1[i]=='+')
            ans1=ans1+1;
        else
            ans1=ans1-1;
        if(s2[i]=='+')
            ans2=ans2+1;
        else if(s2[i]=='-')
            ans2=ans2-1;
        else
            qm=qm+1;
        }
    long long int ans=ans1-ans2;
    long long int total=pow(2,qm);
    if(ans==0 && qm==0)
     cout<<"1.000000000000";
    else if((ans!=0 && qm==0) || abs(ans)>qm)
        cout<<"0.000000000000";
    else
        {
            if(qm%2==ans%2)
                {
                    long long int num=1,den=1,prob;
                    for (int i=1;i<=(qm/2+abs(ans));i++)
                        den=den*i;
                    for (int i=(qm/2+abs(ans)+1);i<=qm;i++)
                        num=num*i;
                    prob=num/den;
                    prob=(prob*1000000000000)/total;
                    cout<<"0."<<prob;
                }
            else
                cout<<"0.000000000000";
            }

    return 0;
}

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <math.h>
#include <iomanip>
#include <fstream>
#include <map>
using namespace std;
string decToBinary1(int n)
{
	// array to store binary number
	string s = "";

	// counter for binary array
	int i = 0;
	while (n > 0) {

		// storing remainder in binary array
		s += n % 2 + '0';
		n = n / 2;
		i++;
	}
	reverse(s.begin(), s.end());
	return s;

}
int main() {
	string s1,s2;
	cin >> s1 >> s2;
	int pos = 0;
	int size = s1.size();
	for (int i = 0; i < size; i++) {
		if (s1[i] == '+') pos++;
		else pos--;
	}
	vector<string> possible;
	int noQ = 0;

		vector<int> ind;
		for (int i = 0; i < size; i++) {
			if (s2[i] == '?') {
				noQ++;
				ind.push_back(i);
			}
		}
	if (noQ > 0) {
		int noPoss = pow(2, noQ);
		int max = ind.size();
		for (int i = 0; i < noPoss; i++) {

			string h = decToBinary1(i);
			//cout << "  h " << h << endl;
			string a = "";
			for (int j = h.size(); j <= max; j++) {
				a += "0";
			}
			//cout << "a " << a << endl;
			h = a + h;
			string sc = s2;
			//cout << "hf " << h << endl;
			for (int j = 0; j < max; j++) {
				//cout <<" q "<< sc[ind[j]]<<" index "<<ind[j] << endl;
				if (h[j] == '0') {
					sc[ ind[j] ] = '-';
				}
				else {
					sc[ind[j]] = '+';
				}

			}
			//cout << sc << endl;
			possible.push_back(sc);
		}
		double g = 0;
		for (int i = 0; i < possible.size(); i++) {
			int p = 0;
			for (int j = 0; j < size; j++) {
				if (possible[i][j] == '+') p++;
				else p--;
			}
			//cout << " p " << p << endl;
			if (p == pos) g++;
		}
		cout << setprecision(10) << g / possible.size() << endl;
	}
	else {
		int p2 = 0;
		for (int i = 0; i < size; i++) {
			if (s2[i] == '+') p2++;
			else p2--;
		}
		//cout << p2 << " " << pos << endl;
		if (p2 == pos) cout << 1 << endl;
		else cout << 0 << endl;
	}

	return 0;
}

//CodeForces 476B
#include<iostream>
#include <iomanip>
#include<string>
#include<math.h>

using namespace std;

long long int C(int n,int k)
{

  long long int a = 1;
  for(int i = 0;i < k; i++)
  {

      a *= (double)(n-i) / (double)(n-k+i);

  }
  return a;
}

int main()
{

  string s1;
  string s2;
  cin>>s1>>s2;

  int p1 = 0;
  int p2 = 0;
  int q2 = 0;
  double p = 0.0;

  for(int i=0;i<s1.length();i++)
  {

    if(s1[i] == '+') p1++;
    if(s2[i] == '+') p2++;
    else if(s2[i] == '?') q2++;

  }
  if(p1<p2||q2<(p1-p2))
  {

    p = 0.0;
    cout << fixed;
    cout << setprecision(10) << p << endl;

  }
  else
  {

    cout << fixed;
    cout << setprecision(10) << (double)C(q2,(p1-p2)) / pow(2,q2) << endl;

  }

}

#include <bits/stdc++.h>
#include <vector>
using namespace std;

long long int fact (int a)
{
    if (a==0){return 1;}
    else {return a*fact(a-1);}
}
int main()
{
    int a=0,b=0,a1=0,b1=0,c1=-1;
    string ch,sh;
    cin>>ch>>sh;
    for (int i=0;i<ch.size();i++)
    {
        if (ch[i]=='+'){a++;}else {b++;}
        if (sh[i]=='+')
        {
            if (a1==-1){a1=1;}
            else {a1++;}
        }
        else if (sh[i]=='-')
        {
            if (b1==-1){b1=1;}
            else {b1++;}
        }
        else {
            if (c1==-1){c1=1;}
            else {c1++;}
        }
    }
    if (c1==-1){cout<<1;}
    else if ((a1>a)||(b1>b)){cout<<0;}
    else {  cout<<pow(2,ch.size())<<"  "<<c1<<"  "<<a1<<endl;
            cout<<fixed<<setprecision(9)<<fact(c1)/(fact(a-a1)*fact(c1-a+a1)*pow(2,c1));}

}

#include <iostream>
#include <math.h>
using namespace std;
#include <vector>
#include <algorithm>
int d = 1000000007;
int main()
{
 //   long long n, m;
    //cin>>n>>m;
    //long long s = 0;
    //if (m == 1)
    //{
    //  cout<<"0"<<endl;
    //  return 0;
    //}
    //long long k = (n>=m)? m - 1 : n;
    //for (int i = 0; i < k; ++i)
    //{
    //  s += (((n)%d + ((n  +i + 1)* (n)/(i + 1)/2)%d * (m) * (i + 1))% d) ;
    //  s %= d;
    //}
    //cout<<s<<endl;

    char a[11];
    char b[11];
    cin>>a>>b;
    int i = 0;
    int r1 = 0;
    while (a[i]=='+'||a[i]=='-')
    {
        if (a[i] == '+')
            ++r1;
        else --r1;
        ++i;
    }
    int c = 0;
    int r2 = 0;
    for (int j = 0; j < i; ++j)
    {
        if (b[j] == '+')
            ++r2;
        else if (b[j] == '-') --r2;
        else ++c;
    }
    double res = 0.0;
    if (abs(r1 - r2) > c || (r1 + r2 + c) % 2)
    {
        cout<<res<<endl;
        return 0;
    }
    double z = 1.0;
    for (int i = 0; i < c; ++i)
    {
        z /= 2;
    }
    int p = abs(r1 - r2) + (c - abs(r1 - r2))/2;
    int fc = 1.0;
    for (int i = 2; i <= c; ++i)
        fc*=i;
    int fp = 1;
    for (int i = 2; i <= p; ++i)
        fp*=i;
    int fz = 1;
    for (int i = 2; i <= c - p; ++i)
        fz*=i;
    res = z * fc / fp / fz;
    cout<<res<<endl;
    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<climits>
#include<string>
#include<vector>

#include<map>
//#include<unordered_set>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<deque>
//#include<unordered_map>
#include<algorithm>
#include<iterator>
#include<cmath>
#include<vector>

//container manipulation and traversal macro
#define for_all(i,a,b)  for(i=a;i<b;i++)
#define for_it(v,c)     for(typeof( (c).begin()) v = (c).begin(); v != (c).begin(); v != (c).end(); ++v)
#define all(a)          a.begin(),a.end()
#define in(a,b)         ( (b).find(a) != (b).end())
#define pb              push_back
#define fill(a,v)       memset(a,v,sizeof(a))
#define sz(a)           ((int)(a.size()))
#define mp              make_pair
#define fst             first
#define sec             second
#define sqr             ( (x) * (x))
#define sqrt            sqrt(abs(x))
/*
//input macros
//#define s(n)    scanf("%d",&n)
//#define sc(n)   scanf("%c",&n)
//#define sl(n)   scanf("%lld",&n)
//#define sf(n)   scanf("%lf",&n)
//#define ss(n)   scanf("%s",n)

//typedefs
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef double D;
//typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;
*/
using namespace std;
int fact(int n)
{
      return (n == 1 || n == 0) ? 1 : fact(n - 1) * n;
}
int p,n,pp,nn;

int main(){
    string s_orig,s_recv;
    cin>>s_orig>>s_recv;
    int i,j;
    for_all(i,0,s_orig.size()){
        if(s_orig[i] == '+')
            p++;
        else
            n++;
    }
    for_all(i,0,s_recv.size()){
        if(s_recv[i]== '+')
            pp++;
        else if(s_recv[i]=='-')
            nn++;
    }
    int perm = sz(s_orig)-(nn+pp);
    long double prob=1.0L;
    if(n==nn && p==pp ){
        cout<<double(1.0)<<endl;
        return 0;
    }
    int x;

    x=sz(s_orig)-(nn+pp);
    //cout<<"x "<<x<<"n "<<n<<"p "<<p<<"nn "<<nn<<"pp "<<pp<<endl;
    int f=fact(x)/(fact(abs(n-nn))*fact(abs(p-pp)));

    if((abs(n-nn) + abs(p-pp)) == x){
        for_all(i,0,x){
            prob *= 0.5;
        }
        prob = prob*(f);
        cout<<prob<<endl;
    }else{
        cout<<double(0.0)<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
    ll Final ;
    string s ;
    string ss;

string bit(ll a)
{
    string s1;
    ll k;
    while(a)
    {
    k = a % 2;
    if (k)
        s1+='+';
    else
        s1+='-';
    a/=2;
    }

    reverse(s1.begin(),s1.end());

    return s1;

}

bool compare(string sss)
{
    if (sss.size()!=ss.size())
        return false;
    ll i;
    for(i = 0;i<sss.size();i++)
    {
        if ((sss[i]==ss[i])||(ss[i]=='?'));
            else
            return false;
    }

    return true;
}

bool check(string s1)
{
    ll ans = 0;
    ll i;
    for(i = 0;i<s1.size();i++)
    {
        if (s1[i]=='+')
            ans++;
        else
            ans--;
    }
    if (ans == Final)
        return true;
    return false;
}

int main()
{
    cin>>s>>ss;

    ll i , j  , b , n;
    n = s.size();
ll All = 1;
    for(i = 0;i<n;i++)
    {
        if(ss[i]=='?') All*=2;
        if (s[i]=='+')
            Final++;
        else
            Final--;
    }

   //cout<<check("+---");
//cout<<Final<<" ";
//cout<<bit(8)<<" ";

    ll all = 0 , good = 0;
    for(i = 0;i<1024;i++)
    {
        string  b = bit(i);
        if (compare(b))
        {
            all++;
            if (check(b))
                good++;
        }

    }

    if ((good == 0)||(all == 0))
    {
        cout<<"0.000000000";
        return 0;
    }
    long double ans = 1.0*good / All;
    cout<<fixed<<setprecision(9)<<ans;

    //cout<<all<<" "<<good;

    return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

char s1[11];
char s2[11];
int pos=0;
int l,n=0;
int i,j;
double prob=1;
int a=1,b=1,c=1;

int main()
{
    gets(s1);
    gets(s2);
    l=strlen(s1);
    for(i=0;i<l;i++)
    {
        if(s1[i]=='+') pos++;
        else pos--;
        if(s2[i]=='+') pos--;
        else if(s2[i]=='-') pos++;
        else n++;
    }
    pos=abs(pos);
    if((n-pos)%2!=0||pos>n) prob=0;
    else
    {
        for(i=n;i>=2;i--)
        {
            a*=i;
        }
        for(i=2;i<=((n-pos)/2);i++)
        {
            b*=i;
        }
        for(i=2;i<=pos+((n-pos)/2);i++)
        {
            c*=i;
        }
        prob=(double)b*c/a;
    }
    printf("%.9lf\n",prob);
}

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <list>
#include <stack>
#include <deque>
#include <queue>
#define all(v) v.rbegin(),v.rend()
#define mp make_pair
typedef double db;
typedef long long ll;
using namespace std;
vector<int> ans;
void f(int k, int i){
	int t=ans[i];
	while (k--){
		ans.push_back(t);
	}
}

int main(){
	string s, ex;
	cin >> ex >> s;
	int p=0;
	int n=s.size();
	for (int i=0; i<n; ++i)
		if (ex[i]=='+')
			p++;
		else
			p--;
	string mask;
	int kol=0, kol2=0;
	for (int i=0; i<n; ++i){
		if (s[i]=='?'){
			mask.push_back('x');
			kol++;
		}
		else{
			if (s[i]=='+'){
				kol2++;
				mask.push_back('-');
			}
			else{
				kol2--;
				mask.push_back('-');
			}
		}
	}
	if (kol==0){
		cout << "1.000000000000";
		return 0;
	}

	int q=0;
	vector<int> used;
	for(int i=kol2-kol; i<=kol2+kol; i+=2){
		ans.push_back(i);
		if (i==p){
			used.push_back(ans.size()-1);

		}
	}

	if (kol==2){
		f(1, 1);
	}
	if (kol==3){
		f(2, 1);
		f(2, 2);
	}
	if (kol==4){
		f(3, 1);
		f(5, 2);
		f(3, 3);
	}
	if (kol==5){
		f(4, 1);
		f(9, 2);
		f(9, 3);
		f(4, 4);
	}
	if (kol==6){
		f(5, 1);
		f(14, 2);
		f(19, 3);
		f(14, 4);
		f(5, 5);
	}
	if (kol==7){
		f(6, 1);
		f(20, 2);
		f(34, 3);
		f(34, 4);
		f(20, 5);
		f(6, 6);
	}
	if (kol==8){
		f(7, 1);
		f(27, 2);
		f(55, 3);
		f(69, 4);
		f(55, 5);
		f(27, 6);
		f(7, 7);
	}
	if (kol==9){
		f(8, 1);
		f(35, 2);
		f(83, 3);
		f(125, 4);
		f(125, 5);
		f(83, 6);
		f(35, 7);
		f(8, 8);
	}

	for (int i=0; i<ans.size(); ++i)
		if (ans[i]==p)
			q++;

	if (q==0)
		"0.000000000000";
	else
		printf("%.10lf", (double)q/ans.size());

}

#include <bits/stdc++.h>

using namespace std;

int cal (int x)
{
    if(x==0)
        return 1;
    int a=1;
    for(int i=x;i>=1;i--)
        a*=i;
    return a;
}
int comb(int x,int y)
{
    int s=x-y;
    return cal(x)/(cal(y)*cal(s));
}

int main()
{
    string x,y;
    cin>>x>>y;
    int a,b;
    a=x.length();
    b=0;
    int ax,ay;
    ax=ay=0;
    for(int i=0;i<a;i++)
    {
        if(x[i]=='+')ax+=1;
        if(x[i]=='-')ax+=-1;
        if(y[i]=='+'){ay+=1;b+=1;}
        if(y[i]=='-'){ay+=-1;b+=1;}
    }
    if(a==b){cout<<1;return 0;}
    int c=a-b;
    int n=(c/2)+abs(ax-ay);
    int z=comb(c,n);
    double q=1;
    for(int i=1;i<z;i++)
        q*=0.5;
    cout<<q;
}

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
long long int factorial(int n)
{
	int i;
	long long int ans=1;
	for(i=1;i<=n;i++)
		ans=ans*i;
	return ans;
}
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	int position=0;
	int i;
	for(i=0;i<s1.size();i++)
	{
		if(s1[i]=='+')
		{
			position++;
		}
		else if(s1[i]=='-')
		{
			position--;
		}
	}
	int new_position=0;
	int count_q=0;
	for(i=0;i<s2.size();i++)
	{
		if(s2[i]=='+')
		{
			new_position++;
		}
		else if(s2[i]=='-')
		{
			new_position--;
		}
		else if(s2[i]=='?')
		{
			count_q++;
		}
	}
	//	cout<<position<<new_position<<endl;
	int left=position+new_position;
	if(left==0 and count_q==0)
		cout<<"1.0";
	else
	{
		//cout<<left;
		int plus=count_q+left;
		//cout<<plus<<endl;
		if(plus%2!=0 or plus>count_q)
			cout<<"0.0";
		else
		{
			//cout<<"here";
			plus=plus/2;
			//cout<<plus;
			int minus=left+plus;
			float win_ways=float(factorial(count_q)/(factorial(plus)*factorial(minus)));
			float temp=pow(2,count_q);
			//cout<<temp;
			//cout<<factorial(plus);
			float ans =float(win_ways/temp);
			cout<<ans;
		}
	}
	return 0;
}

#include <iostream>
#include <queue>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <vector>
//#define for(i,n) for(int i=0;i<n;i++)
using namespace std;
bool prime(int n)
{
  if(n==1)
    return 0;
  int dal=0;
  for(int i=2;i<=sqrt(n*1.0);i++)
  {
    if(n%i==0)
      return 0;
  }
  return 1;
}
long long CC(int a,int n)
{
  double san=1;
  for(int i=0;i<a;i++)
  {
    san*=(n-i)/(a*1.0-i);
    //cout<<san<<endl;
  }
  return san;
}
long long fact(long long n)
{
  long long x=1;
  for(int i=1;i<=n;i++)
    x*=i;
  return x;
}
int main()
{
  string a,b;
  int a1=0,a2=0,b1=0,b2=0,b3=0;
  cin>>a>>b;
  for(int i=0;i<a.length();i++)
  {
    if(a[i]=='+')
      a1++;
    else
      a2++;
    if(b[i]=='+')
      b1++;
    else if(b[i]=='-')
      b2++;
    else
      b3++;
  }
  if(b3==0)
  cout<<1;
  else if(b2>a2 || b1>a1)
  cout<<0;
  else
  {
    a1-=b1;
    a2-=b2;
    cout<<setprecision(10)<<fixed<<CC(a1,a1+a2)/(pow(2.,a1+a2*1.0));
  }
}

#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    char s1[12], s2[12];
    scanf("%s%s", s1, s2);
    int n = strlen(s1);
    int c1 = 0, c2 = 0, c = 0;
    for(int i = 0; i < n; ++i) if(s1[i] == '+') c1++;
    for(int i = 0; i < n; ++i) if(s2[i] == '+') c2++;
    for(int i = 0; i < n; ++i) if(s2[i] == '?') c++;
    int nd = c1 - c2;
    double ans = 0;
    if(nd == 0) ans = 1.0;
    else if(nd > c) ans = 0.0;
    else {

        n = c; int m = nd;
        int tmp1 = 1, tmp2 = 1, tmp3 = 1;
        for(int i = 1; i <= n; ++i) tmp1 *= i;
        for(int i = 1; i <= m; ++i) tmp2 *= i;
        for(int i = 1; i <= n - m; ++i) tmp3 *= i;
        ans = 1.0 * tmp1 / (tmp2 * tmp3);
        int mul = 1;
        for(int i = 1; i <= n; ++i) mul *= 2;
        ans /= mul;
    }
    printf("%f\n", ans);
    return 0;
}

#include <bits/stdc++.h>

using namespace std ;

typedef long long ll;

int main()
{
    //freopen("cbarn.out", "w", stdout) ;
   //freopen("cbarn.in", "r", stdin) ;
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    string s1 , s2 ; cin >> s1 >> s2 ;
    int n = s1.size() ;
    int po = 0 ;
    for ( int i = 0 ; i < n ; i++ )
    {
        if ( s1[i] == '+' ) po++ ;
        else po-- ;
    }
    double counter = 0 ;
    ll p = 0 ;
    for ( int i = 0 ; i < n ; i++ )
    {
        if ( s2[i] == '+' ) p++ ;
        else if ( s2[i] == '-' )  p-- ;
        else counter++ ;
    }
    int mini = p - counter ;
    int maxi = p + counter ;
    //if ( p % 2 == po % 2 && counter % 2 == 1 ) { cout << "0" ; return 0 ; }
   // else if ( p % 2 !+ po % 2 && counter % 2 == 0  ) { cout << "0" ; return 0 ; }
    //else if ( counter == 0 ) { cout << "1" ; return 0 ; }
    double ans = 0 ;
    for ( int i = mini ; i <= maxi ; i+=2 ){
        if ( i == po ) ans++ ;
    }
    counter = pow( 2 , counter ) ;
     cout << fixed << setprecision(17) << ans/counter ;

    return  0 ;
}

#include <algorithm>
#include <iostream>
#include <string>

int calculateDistance(const std::string& s)
{
  int distance = 0;
  for (char c : s)
  {
    if (c == '1')
      ++distance;
    else
      --distance;
  }

  return distance;
}

std::string getStringOfOnes(unsigned length)
{
  std::string s;
  for (unsigned i = 0; i < length; ++i)
    s.push_back('1');

  return s;
}

std::pair<unsigned, unsigned> calculateMatchings(unsigned length, int sumTo)
{
  unsigned matching = 0;
  unsigned notMatching = 0;
  std::string s = getStringOfOnes(length);
  for (unsigned i = 0; i <= length; ++i)
  {
    do
    {
      const int distance = calculateDistance(s);
      if (distance == sumTo)
        ++matching;
      else
        ++notMatching;

    } while (std::next_permutation(s.begin(), s.end()));
    s = getStringOfOnes(length);
    for (unsigned x = 0; x <= i; ++x)
      s[x] = '0';
  }

  return std::make_pair(matching, notMatching);
}

int main(void)
{
  std::cin.sync_with_stdio(false);
  std::cout.sync_with_stdio(false);

  std::string input;
  std::string output;
  std::cin >> input >> output;

  int inputPosition = 0;
  for (char c : input)
  {
    if (c == '+')
      ++inputPosition;
    else
      --inputPosition;
  }

  unsigned unknowns = 0;
  int outputPosition = 0;
  for (char c : output)
  {
    if (c == '?')
      ++unknowns;
    else if (c == '+')
      ++outputPosition;
    else
      --outputPosition;
  }

  const auto result = calculateMatchings(unknowns, inputPosition-outputPosition);
  unsigned matching = result.first;
  unsigned notMatching = result.second;
  std::cout << matching << std::endl;
  std::cout << notMatching << std::endl;

  const double r = (double)matching/(matching + notMatching);
  std::cout.precision(15);
  std::cout << r << std::endl;

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long fac[12];
double c(int a, int b) {
	return fac[a] / (fac[b] * fac[a-b]);
}
int main() {
	fac[0] = 1;
	for(int i = 1;i <= 11; i++) {
		fac[i] = fac[i-1] * i;
	}
	string s1, s2;
	cin >> s1 >> s2;
	int n = s1.size();
	int final_pos = 0;
	for(int i = 0; i < n; i++) {
		if(s1[i]=='+') final_pos++;
		else final_pos--;
	}
	int u = 0;
	int moves = 0;
	for(int i = 0; i < n; i++) {
		if(s2[i]=='+') u++;
		else if(s2[i]=='-')u--;
		else moves++;
	}
	//cout << final_pos << "  " << u << endl;
	double ans;
	if(abs(u - final_pos) > moves) ans = 0;
	else if(u ==  final_pos) {
		if(moves == 0) ans = 1;
		else if(moves%2==0) {
			ans = 0.5;
		}
		else {
			ans = 0;
		}
	}
	else ans = c(moves, abs(u - final_pos)) / pow(2, moves);
	printf("%0.12lf", ans);
  return 0;
}

#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
using namespace std;

int main( )
{
    char str1[100],str2[100];
    int i , j;
    cin>>str1>>str2;
    i = 0;
    int t = 0;
    while(str1[i]!='\0')
    {
        if(str1[i]=='+')
        {
            t++;
        }
        i++;
    }
    i = 0;
    int k=0;
    while(str2[i]!='\0')
    {
        if(str2[i]=='+')
        {
            t--;
        }
        else if(str2[i]=='?')
        {
            k++;
        }
        i++;
    }
    if(t<0)
    {
        printf("0.000000000000\n");
        return 0;
    }
    else if(t==0)
    {
        if(k%2==1)
        {
            printf("0.000000000000\n");
            return 0;
        }
        else
        {
            double cm = 1.0;
            for(i = 0;i < t; ++i)
            {
                cm = cm * (k - i)/(i + 1);
            }
            for(i = 0;i < k; ++i)
            {
                cm = cm/2.0;
            }
            printf("%.12f\n",cm);
            return 0;
        }
    }
    else
    {
        if(k==0)
        {
            printf("0.000000000000\n");
            return 0;
        }
        else if(k%2==1)
        {
            printf("0.000000000000\n");
            return 0;
        }
        else
        {
            double cm = 1.0;
            for(i = 0;i < t; ++i)
            {
                cm = cm * (k - i)/(i + 1);
            }
            for(i = 0;i < k; ++i)
            {
                cm = cm/2.0;
            }
            printf("%.12f\n",cm);
            return 0;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int32_t main()
{
	cout << fixed << setprecision(15);
	string s,t;
	cin >> s >> t;
	int cnt1=0,cnt2=0,cnt3=0;
	for(int i=0;i<s.size();i++)
	{
		if(t[i]=='+')
		cnt2++;
		else if(t[i]=='-')
		cnt2--;

		if(s[i]=='+')
		cnt1++;
		else if(s[i]=='-')
		cnt1--;
		else
		cnt3++;
	}
	if(cnt3==0)
	{
		if(cnt1==cnt2)
		{
			cout << "1" ;
			return 0;
		}
		else
		{
			cout << "0";
			return 0;
		}
	}

	int zero=0,one=0;
	if(cnt1>=cnt2)
	{
		zero=cnt1-cnt2;
		if(zero>cnt3)
		{
			cout << "-1";
			return 0;
		}

		one=cnt3-zero;
	}
	else
	{
		one=cnt2-cnt1;
		if(one>cnt3)
		{
			cout << "-1";
			return 0;
		}
		zero=cnt3-one;
	}
	int var=0;
	int temp=(1<<cnt3);
	for(int i=0;i<temp;i++)
	{
		int z=0,o=0;
		string str=to_string(i);
		for(int j=0;j<str.size();j++)
		{
			if(str[j]=='0')
			z++;
			else
			o++;
		}

		if(z==zero && o==one)
		{
			var++;
		}
	}
	cout << (var*1.0)/temp;

}

#include<bits/stdc++.h>
using namespace std;

// Hey kid, you got this!

#define ll long long
#define endl "\n"
#define FASTIO() ios_base::sync_with_stdio(false);cin.tie(0);
#define show(x) cout << #x << " = " << x << endl
typedef pair<int, int> pii;
typedef pair<ll, ll>   pll;

ll factorial[21] = {0};

void calcFact()
{
    factorial[0] = 1;
    for(ll i = 1; i <= 21; i++)
        factorial[i] = i * factorial[i-1];
}

void solution()
{
    string drazil, dreamoon;
    cin >> drazil;
    cin >> dreamoon;
    bool question = false;
    int countQ = 0;
    int drazilSum = 0;
    int dreamoonSum = 0;
    for(int i = 0; i < drazil.size(); i++)
    {
        if(drazil[i] == '+') drazilSum++;
        //else drazilSum--;
    }

    for(int i = 0; i < dreamoon.size(); i++)
    {
        if(!question && dreamoon[i] == '?')
        {
            question = true;
            countQ++;
        }
        else if(dreamoon[i] == '?') countQ++;
        else if(dreamoon[i] == '+') dreamoonSum++;
        //else dreamoonSum--;
    }

    float prob = 0;

    if(!question)
    {
        if(drazilSum == dreamoonSum) prob = 1;
        else prob = 0;
    }
    else
    {
        int arr[] = {-1, 1};
        int x = drazilSum - dreamoonSum;
        float num = (float)factorial[countQ] / (float)(factorial[x] * factorial[countQ - x]);
        float dem = pow(2, countQ);
        prob = num / dem;
        if(num == 0) prob = 0;
        if(prob < 0) prob *= -1;
    }

    cout << fixed << setprecision(10) << prob << endl;
}

int main()
{
    FASTIO();
    int t = 1;
    //cin >> t;
    calcFact();
    while(t--)
    {
        solution();
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long int
//#define INF 1000001
using namespace std;
//#define Freed freopen ("in.txt","r",stdin);
//#define Fout freopen ("out.txt","w",stdout);
//set<ll>st;
//set<ll>::iterator it;
//vector<pair<ll,ll> >v;
//string s;
//map<ll,ll>r,c;
//map<string,ll>::iterator it;
//ll MAX_N=1000000002;
//int prime[1000001],t,check[1000001];
//vector<ll>v;
//vector<ll>::iterator it;
/*ll bin_search(ll val,ll b){
   ll l=0,r=v.size()-1,mid;
   while(l<=r){
      mid=(l+r)/2;
      ll x=v[mid]*2+b*2;
      if(val%x==0)return x;
      else if(x>val)r=mid-1;
      else l=mid+1;
   }
 return -1;
}*/
/*bool cmp(vector<ll>v1,vector<ll>v2){
 return v1<v2;
}*/
ll fact(double n){
  ll ans=1;
  if(n<2)return 1;
 for(ll i=n;i>=2;i--)
   ans*=i;
 return ans;
}
ll ncr(ll n,ll r){
  return (fact(n))/(fact(r)*fact(n-r));
}
void sol(){
  ll a=0,b=0,q=0;
  string s,s1;
  cin>>s;
  cin>>s1;
  ll l=s.size();
  for(ll i=0;i<l;i++){
    if(s[i]=='+')a++;
    else a--;
    if(s1[i]=='?')q++;
    else if(s1[i]=='+')b++;
    else b--;
  }
  ll res=abs(a-b);
  cout<<res<<" "<<q<<endl;
  if(res>q){
    cout<<fixed<<setprecision(12)<<0.0<<endl;
  }
  else{
    if(res&1){
     if(q&1){
      ll x=(q-res)/2+res;
      double m=(double)ncr(x,q);
      double n=pow(2,q);
      cout<<fixed<<setprecision(12)<<m/n;
      cout<<endl;
     }
     else
    cout<<fixed<<setprecision(12)<<0.0<<endl;
    }
   else{
    if(!(q&1)){
      ll x=(q-res)/2+res;
      double m=(double)ncr(q,x);
      double n=pow(2,q);
      cout<<fixed<<setprecision(12)<<m/n;
      cout<<endl;
     }
    else
    cout<<fixed<<setprecision(12)<<0.0<<endl;
   }
  }
}
int main(){
 ios::sync_with_stdio(0);cin.tie(0);
 ll t;
  //cin>>t;
 // while(t--)
     sol();
 return 0;
}

#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long int ll;

ll nCr(ll n, ll r, vector< vector<ll> >& v) {
  v[0][0] = 1;
  for(int i=1;i<=n;i++) {
    for(int j=0;j<=r;j++) {
      v[i][j] = v[i-1][j-1] + v[i-1][j];
    }
  }
  return 0;
}
int main(int argc, char const *argv[])
{
  ll n= 10, r=10;
  vector< vector<ll> > v(11, vector<ll>(11, 0));
  nCr(n, r, v);

  string s1, s2;
  cin >> s1;
  cin >> s2;

  int  q=0;
  r=0;
  for(int i=0;i<s1.length();i++) {
    if(s1[i] == '+') r++;
    else r--;
    if(s2[i] == '-') r++;
    else if(s2[i] == '+') r--;
    else q++;
  }
  double ans = 0.0;
  if((abs(r) % 2 == 0 && q % 2 == 1) || (abs(r) % 2 == 1 && q % 2 == 0)) {
    cout<<setprecision(12)<<fixed<<ans<<endl;
    return 0;
  }
  ll x = (r + q) / 2;
  if(abs(x) > q) {
    cout<<setprecision(12)<<fixed<<ans<<endl;
    return 0;
  }
  // cout<<"here"<<v[q][x];
  ans = v[q][x] / double(1<<q);
  cout<<setprecision(12)<<fixed<<ans<<endl;
  return 0;
}

#include<iostream>
#include<bits/stdc++.h>
#define ll long long int
#define ss string
#define mod 1000000007
using namespace std;

void go(ll n,ll k)
{  //cout<<n<<k;
   ll c[k+1];memset(c,0,sizeof(c));
   c[0]=1;
   for(ll i=1;i<=n;i++)
   for(ll j=min(i,k);j>0;j--)
   c[j]+=c[j-1];

   // cout<<c[k]<<endl;
     double p=c[k]/pow(2,n);
     cout<<fixed<<setprecision(12)<<p;
}

int main()
{
    ss s,r;
    cin>>s>>r;
    ll sum=0;
    for(ll i=0;i<s.length();i++)
    if(s[i]=='+')sum++;
    else
    sum--;
    ll q=0;
    ll sum2=0;
    for(ll i=0;i<r.length();i++)
    if(r[i]!='?')
    {
        if(r[i]=='+')sum2++;
        else
        sum2--;
    }
    else
    q++;

    if(q==0&&sum==sum2)
    {
        cout<<"1.000000000000";return 0;
    }
    if(q==0&&sum!=sum2)
    {
        cout<<"0.000000000000";return 0;
    }
    double pro=0;
    if(abs(q+sum2)<abs(sum))
    {cout<<fixed<<setprecision(12)<<pro;
    return 0;}

    else
    {
        ll left=sum-sum2;

          ll k=0;
            for(ll i=-q;i<=q;i+=2)
            {
                if(i==left)
                {go(q,k);break;}
                else k++;
            }

    }

    return 0;
}

#include <stdio.h>
#include <string.h>

int i,sum1,sum2,banyak,atas,simpan;
char str1[20],str2[20];
int combin(int a,int b)
{
    if (b==0) return 1;

    return (combin(a,b-1)*(a-b+1))/b;
}
int main()
{
    //freopen("dream.in","r",stdin);

    scanf("%s",str1);
    scanf("\n%s",str2);

    atas=strlen(str1);
    sum1=0;
    for (i=0;i<atas;i++)
    {
        if (str1[i]=='+') sum1++; else sum1--;
    }
    banyak=0; sum2=0;
    for (i=0;i<atas;i++)
    {
        if (str2[i]=='+') sum2++;
        else if (str2[i]=='-') sum2--;
        else banyak++;
    }

    sum2-=banyak;
    //printf("%d %d %d\n",(sum1-sum2+10000000)%2,sum2+2*banyak,sum1);

    if (((sum1-sum2+10000000)%2==1)||((sum2+2*banyak)<sum1))
    {
        printf("%lf\n",0.0);

        return 0;
    }

    simpan=sum1-sum2; //printf("%d\n",simpan);
    printf("%lf\n",combin(banyak,simpan/2)/double(1<<banyak));
    return 0;
}

/**************/
/***ANPrince***/
/**************/
#include<bits/stdc++.h>
using namespace std;

#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,b) memset(a,b,sizeof(a))
#define PB push_back
#define AREA(x1,y1,x2,y2,x3,y3) ( x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2) )
#define SQR(x) ((x)*(x))
#define EPS 1e-9
#define INF (1<<29)
#define PI acos(-1.0)

#define Si(a) scanf("%d",&a)
#define Slld(a) scanf("%I64d",&a)
#define Slf(a) scanf("%lf",&a)
#define Sc(a) scanf("%c",&a)
#define Ss(a) scanf("%s",a)

#define Pi(a) printf("%d\n",a)
#define Pii(a) printf("%d",a)
#define Plld(a) printf("%I64d",a)
#define Plf(a) printf("%lf",a)
#define Pc(a) printf("%c",a)
#define Ps(a) printf("%s\n",a)
#define Psp() printf(" ")
#define Pendl() printf("\n")

#define For(i,a,n)  for(i=a;i<=n;i++)
#define ForL(i,a,n)  for(i=a;i<n;i++)
#define ForR(i,a,n)  for(i=n;i>=a;i--)

#define IN(i,a,n,arr) for(i=a;i<=n;i++) scanf("%d",&arr[i])
#define OUT(i,a,n,arr) for(i=a;i<=n;i++) printf("%d ",arr[i])
#define ConSum(i,arrs,arrt)( arrs[0]=0; for(i=1;i<=n;i++) arrs[i]=arrs[i-1]+arrt[i]);
#define MAX 200007
#define MOD 1000000009
typedef long long LL;

inline long Max(long x, long y) { return (((y-x)>>(32-1))&(x^y))^y; }
inline long Min(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; }

int IR[] = { 0,-1,0,1,-1,-1,1,1 };
int IC[] = { 1,0,-1,0,1,-1,-1,1 };

int N,M;
int A[MAX+7];
vector<int>Edge[MAX+7];
int Arr[2500][1000];
int Sum[MAX+7];
int DP[1111][1111];
char Str[1000];

int diru[] = {-1,-1,-1,0,0,1,1,1};
int dirv[] = {-1,0,1,-1,1,-1,0,1};
int Set(int N,int pos){return N=N | (1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
int Pos;
void binary(int x,int P)
{
    //printf("%d\n",x);
    if(x==0) return;
    Arr[P][Pos++]=x%2;
    binary(x/2,P);

    //printf("%d",x%2);
}
int main()
{
    int n,m,i,j,k,l,sum,t,cs=1,flag,x,y,com,first;
    double co;
    int ans;
    char ch;
    //freopen("Input.txt","r",stdin);

        scanf("%s",&Str);
        l=strlen(Str);
        ans=0;
        int ans2=0;
        For(i,0,l-1)
        {
            if(Str[i]=='+') ans++;
            else ans--;
        }
        //Pi(ans);
        scanf("%s",&Str);
        flag=0;
        l=strlen(Str);
        x=0;
        For(i,0,l-1)
        {
            if(Str[i]=='+') ans2++;
            else if(Str[i]=='-') ans2--;
            else
            {
                flag=1;
                x++;
            }
        }
        if(!flag)
        {
            if(ans==ans2) printf("1.000000000000\n");
            else printf("0.000000000000\n");
            return 0;
        }

        Pos=1;
        double mul=2;
        //printf("J %d\n",x);
        for(i=1;i<x;i++) mul*=2;
        //printf("Mul %lf\n",mul);
        co=0;
        int bal=0;
        if(ans2-x==ans) co++;
        for(i=1;i<mul;i++)
        {
            Pos=1;
            //binary(i);
            //printf("%d =>",i);
            bal=0;
            for(j=0;j<x;j++)
            {
            //    printf("%d",Arr[j]);
                if(check(i,j)) bal++;
                else bal--;
            }
            //printf("\nbal %d\n",bal);
            //Pendl();
            if(ans2+bal==ans)
            {
                co++;
              //  printf("J %d %d\n",j,ans2+bal);
            }
        }
        //printf("total %lf %lf\n",co,mul);
        double ANS=(double(co)/double(mul));
        printf("%lf\n",ANS);

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;
	cin>>s1;
	cin>>s2;
	int x,y,x1,x2,x3;
	x=count(s1.begin(),s1.end(),'+');
	y=count(s1.begin(),s1.end(),'-');
	x1=count(s2.begin(),s2.end(),'+');
	x2=count(s2.begin(),s2.end(),'-');
	x3=count(s2.begin(),s2.end(),'?');
	//cout<<x<<" "<<y<<"\n";
	//cout<<x1<<" "<<x2<<" "<<x3<<"\n";
	float p=0;
	if(x1>x || x2>y)
	printf("%.12f \n",p);
	else
	{
		float fact =pow(2,x3);
		float ans= (1/fact);
		printf("%.12f \n",ans);
	}
	return 0;
}

#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
    string a;
    getline(cin,a);
    string b;
    getline(cin,b);
    int num1;
    num1=a.length();
    int num2;
    num2=b.length();
    int num3=0;
    int num4=0;
    int num5=0;

    for (int c=0;c<num1;c++)
    {
        if (a[c]=='+')
        {
            num3++;
        }
    }

    for (int c=0;c<num2;c++)
    {
        if (b[c]=='+')
        {
            num4++;
        }
        else
        if (b[c]=='?')
        {
            num5++;
        }
    }
    double num=1;

    for (int f=1;f<(num3-num4);f++)
    {
        num*=f;
    }

    int numm=1;

    for (int f=1;f<=num5;f++)
        {
            numm*=f;
        }
        int l;
        if(num3!=num4)
        l=numm/(num*num*(num3-num4));
        else
            l=pow(2,num5);
        double coutt;
        coutt=pow(0.5,num5)*l;
    cout <<fixed<<setprecision(12)<<coutt;

return 0;
}

#include<bits/stdc++.h>
#define MOD (1000000007)
#define pb   push_back
using namespace std ;

long long a[31];
long long fact(long long r){
    if(r==1)
        return 1;
    if(a[r]!=-1)
        return a[r];
    a[r]=r*fact(r-1);
    return a[r];
}

long long C(long long n,long long r){
    if(r==0)
        return 1;
    if(r==n)
        return 1;
    return fact(n)/(fact(r)*fact(n-r));
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif

    string s1,s2; cin>>s1>>s2;
    long long res=0,ans=0,n=s1.length(),b=0,sum=0;
    vector<long long>ve,vec;

    memset(a,-1,sizeof(a));
    for(long long i=0; i<n; i++){
        if(s1[i]=='+')
            res++;
        else
            res--;
    }
    for(long long i=0; i<n; i++){
        if(s2[i]=='+')
            sum++;
        if(s2[i]=='-')
            sum--;
        if(s2[i]=='?')
            ans++;
    }
    if(res==sum && ans==0){
        cout<<1;
        return 0;
    }
    res-=sum;

    for(long long i=ans; i>=-ans; i-=2)
        ve.pb(i);
    for(long long r=0; r<=ans; r++)
        vec.pb(C(ans,r));
    for(long long i=0; i<ans; i++)
        if(res==ve[i]){
            b=vec[i];
            break;
        }

    cout.precision(7);
    cout<<fixed<<1.0*b/powl(2,ans);
}

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

inline void use_io_optimizations()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

long long fac(long long n)
{
    long long res = 1;

    for (long long i = 2; i <= n; ++i)
    {
        res *= i;
    }

    return res;
}

int main()
{
    use_io_optimizations();

    string s1;
    string s2;

    cin >> s1 >> s2;

    int plus = 0;
    int minus = 0;
    int question = 0;

    for (char c : s1)
    {
        switch (c)
        {
        case '+':
            ++plus;
            break;

        case '-':
            ++minus;
            break;
        }
    }

    for (char c : s2)
    {
        switch (c)
        {
        case '+':
            --plus;
            break;

        case '-':
            --minus;
            break;

        case '?':
            ++question;
            break;
        }
    }

    if (plus < 0 || minus < 0)
    {
        cout << 0.0 << '\n';
        return 0;
    }

    if (plus == 0 && minus == 0)
    {
        cout << 1.0 << '\n';
        return 0;
    }

    double comb = pow(2.0, question) / (plus * minus);

    cout << (fac(question) / (fac(plus) * fac(question - plus))) / comb << '\n';

    return 0;
}

#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define dout(x) cout << fixed << setprecision(x)
using namespace std;

const long long N = 5 * 1e3 + 1;
string s1, s2;
int n;
int pos;
struct str_info {
    int a, b, p;
    void add(char x) {
        if (x == '+') a++;
        else if (x == '-') b++;
        else p++;
    }
    int med() {
        return a - b;
    }
} t1, t2;
int cmp(char x, char y) {
    return x != '?';
}
int main () {
    cin >> s1 >> s2;
    n = s1.size();
    for (int i=0; i<n; i++) {
        t1.add(s1[i]);
    }
    sort(all(s2));
    sort(all(s1));
    if (s1 == s2) return dout(10) << 1.0, 0;
    sort(all(s2), cmp);
    for (int i=0; i<n; i++) {
        t2.add(s2[i]);
    }
    double ans = 1;
    if (abs(t2.med() - t1.med()) > t2.p || 1&(t1.med()-t2.med() - t2.p))
        return dout(10) << 0.000000000000, 0;
    if (t2.p) ans /= (1 << (max(t2.p-1, t1.med()-t2.med())));
    dout(10) << ans << '\n';
}

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    char m[12],n[12];
    cin>>m>>n;
    double res=1;
    int num1=0,num2=0,num3=0,num=0;
    for(int i=0;m[i];i++)
    {
       num++;
       if(m[i]=='-')
       num1++;
       if(n[i]=='-')
       num2++;
       if(n[i]=='?')
       num3++;
    }
    if(num1==num2&&num3==0)
    printf("%.10lf\n",res);
    if(num1>num2)
    {
        int m=num1-num2;
        int p=num3-m;
        for(int i=0;i<num3;i++)
        {
               res=res*0.5;

        }
        double s=1;
        for(int i=0;i<p;i++)
        {
            s/=i+1;
        }
        for(int i=0;i<num3;i++)
        {
            s*=i+1;
        }
        for(int i=0;i<m;i++)
        {
            s/=i+1;
        }
        res=s*res;
        printf("%.10lf\n",res);
    }
    if(num1<num2)
    printf("%.10lf\n",0);
    return 0;
}

#include <iostream>
#include <cstring>
#include <algorithm>
#include <iomanip>

using namespace std;
int b,z,d,v[801][801],h[100005],n,m,i,j,ok,k,st[200001],dr[200005],maxi,a;
char s[100005],c[100005];
double x,r=1;
int main()
{
    cin>>s;
    for(i=0;i<strlen(s);i++)
    {
        if(s[i]=='+')
            a++;
        else
            b++;
    }
     cin>>s;
    for(i=0;i<strlen(s);i++)
    {
        if(s[i]=='+')
            a--;
        else if(s[i]=='-')
            b--;
            else
            r*=2,x++;

    }
    if(!x)x=1;
    cout<<fixed;
    if(a<0||b<0)
        cout<<"0.000000000000";
    else
        cout<<setprecision(9)<<(double)x/(double)r;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
    ll Final ;
    string s ;
    string ss;

string bit(ll a)
{
    string s1;
    ll k;
    while(a)
    {
    k = a % 2;
    if (k)
        s1+='+';
    else
        s1+='-';
    a/=2;
    }

    reverse(s1.begin(),s1.end());

    return s1;

}

bool compare(string sss)
{
    if (sss.size()!=ss.size())
        return false;
    ll i;
    for(i = 0;i<sss.size();i++)
    {
        if ((sss[i]==ss[i])||(ss[i]=='?'));
            else
            return false;
    }

    return true;
}

bool check(string s1)
{
    ll ans = 0;
    ll i;
    for(i = 0;i<s1.size();i++)
    {
        if (s1[i]=='+')
            ans++;
        else
            ans--;
    }
    if (ans == Final)
        return true;
    return false;
}

int main()
{
    cin>>s>>ss;

    ll i , j  , b , n;
    n = s.size();

    for(i = 0;i<n;i++)
    {
        if (s[i]=='+')
            Final++;
        else
            Final--;
    }

   // cout<<check("+---");
//cout<<Final<<" ";
//cout<<bit(8)<<" ";
    ll all = 0 , good = 0;
    for(i = 0;i<1024;i++)
    {
        string  b = bit(i);
        if (compare(b))
        {
            all++;
            if (check(b))
                good++;
        }

    }

    if ((good == 0)||(all == 0))
    {
        cout<<"0.000000000";
        return 0;
    }
    long double ans = 1.0*good / all;
    cout<<fixed<<setprecision(9)<<ans;

    //cout<<all<<" "<<good;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;
int pl1=0,mi1=0,pl2=0,mi2=0;
string s1,s2;
double solve(int i,int p,int m)
{   if(p==pl1&&m==mi1)return 1;
    if(p>pl1||m>mi1)return 0;
    if(s2[i]=='+')return solve(i+1,p+1,m);
    else if(s2[i]=='-')return solve(i+1,p,m+1);
    else
    {
        double c1=0.5*solve(i+1,p+1,m);
        double c2=0.5*solve(i+1,p,m+1);
        return c1+c2;
    }
}

int main()
{
    cin>>s1>>s2;
    //s1
    for(int i=0;i<s1.length();i++)
      if(s1[i]=='+') pl1++; else mi1++;
//    //s2
//    for(int i=0;i<s2.length();i++)
//      if(s2[i]=='+') pl2++; else mi2++;
//    printf("%1.12f",solve(0,0,0));

    return 0;
}

/***Good Luck***/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <functional>
#include <cmath>

#define Zero(a) memset(a, 0, sizeof(a))
#define Neg(a)  memset(a, -1, sizeof(a))
#define All(a) a.begin(), a.end()
#define PB push_back
#define inf 0x3f3f3f3f
#define inf2 0x7fffffffffffffff
#define ll long long
using namespace std;
//#pragma comment(linker, "/STACK:102400000,102400000")
void get_val(int &a) {
	int value = 0, s = 1;
	char c;
	while ((c = getchar()) == ' ' || c == '\n');
	if (c == '-') s = -s; else value = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		value = value * 10 + c - 48;
	a = s * value;
}
const int maxn = 200010;

int main() {
	//freopen("data.out", "w", stdout);
	//freopen("data.in", "r", stdin);
	//cin.sync_with_stdio(false);
	/*int T;
	cin >> T;*/
	string c, r;
	cin >> c >> r;
	int p = 0, n = 0;
	for (size_t i = 0; i < c.size(); i++) {
		if (c[i] == '-') {
			n++;
		}
		else {
			p++;
		}
	}
	int rp = 0, rn = 0;
	int w = 0;

	for (size_t i = 0; i < r.size(); i++) {
		if (r[i] == '-') {
			rn++;
		}
		else if(r[i] == '+') {
			rp++;
		}
		else {
			w++;
		}
	}

	int sub = p - n;
	if (abs(rp - rn - sub) > w) {
		printf("0.000000000000\n");
	}
	else if (abs(rp - rn - sub) == 0 && w == 0) {
		printf("1.000000000000\n");
	}
	else {
		p = (w + sub) / 2;
		n = (w - sub) / 2;
		double ans = 1;
		int tmp = w;
		while (tmp--) {
			ans *= 0.5;
		}
		double fm = 1;
		double fz = 1;
		for (int i = 1; i <= p; i++) {
			fz *= i;
		}
		for (int i = w; i > w - p; i--) {
			fm *= i;
		}
		ans = (fm / fz) * ans;
		printf("%.9lf\n", ans);
	}

	return 0;

 }

#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define loop(i,s,e) for(ll i=s; i<e; i++ )
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define ss second
using namespace std;

int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

void alpha(){
	string s1, s2;

	cin>>s1>>s2;

	ll size = s1.size();

	ll pos_s1=0, neg_s1=0, pos_s2=0, neg_s2=0;

	for(ll i=0; i<size; i++){
		if(s1[i]=='+')pos_s1++;
		else neg_s1++;
		if(s2[i]=='+')pos_s2++;
		else if(s2[i]=='-')neg_s2++;
	}

	ll ques = size - neg_s2 - pos_s2;
	ll req_pos = pos_s1 - pos_s2;
	ll req_neg = neg_s1 - neg_s2;

	double ans = nCr(ques, req_pos)/pow(2,ques);

	cout<<ans<<endl;

}

int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	alpha();

	return 0;

}

#include <bits/stdc++.h>
#define VI vector<int>
#define VB vector<bool>
#define pii pair<int, int>
#define ll long long
#define ld long double
using namespace std;

ld P(int n, int r)
{
    // n!/r!(n-r)!
    ld res = 1;
    int t = n;
    while(t>r)
    {
        res*=t;
        t--;
    }
    return res;
}

int main()
{
    string real, rec;
    cin>>real>>rec;

    int n = real.length();
    int realp = 0, realm = 0, recp = 0, recm = 0;
    for(int i=0; i<n; i++)
    {
        real[i]=='+' ? realp++ : realm++;
        if(rec[i]=='+') recp++;
        else if(rec[i]=='-') recm++;
    }
    ld ans = 0;
    if(realp==recp && realm==recm) ans = 1;
    else if((realp==0 && recp>0) || (realm==0 && recp>0)) ans = 0;
    else
    {
        // sample space
        ld ss = pow(2, (n-(recp+recm)));
        // for correct
        int plus = realp - recp;
        int minus = realm - recm;
        int N = n - (recp + recm);

        // cout<<plus<<" "<<minus<<'\n';

        ld Pp = plus==0 ? P(N, minus) : P(N, plus);
        ans = Pp / ss;
    }

    printf("%.12Lf\n", ans);
}

#include <bits/stdc++.h>
#include <string.h>
using namespace std;

int main(){

	int pascal[11][11]={0};
	for(int i=0;i<=10;i++)
		pascal[i][0]=1;
		pascal[0][1]=1;
	for(int i=1;i<10;i++){
		for(int j=1;j<=i+1;j++)
			pascal[i][j]=pascal[i-1][j-1]+pascal[i-1][j];
	}
//pascal[i][j]= (i+1)C(j)

	string s1,s2;
	cin >> s1 >> s2;

	int plus1=0;
	int len =s1.length();
	for(int i=0;i<len;i++){
		if(s1[i]=='+')
			plus1++;
	}

	int qm =0;
	int plus2=0;
	for(int i=0;i<len;i++){
		if(s2[i]=='+')
			plus2++;
		else if(s2[i]=='?')
			qm++;

	}

	// cout<< pascal[qm-1][plus1-plus2] <<"\n";
	if(qm==0 && plus1==plus2)
		cout<<"1.0000000"<<"\n";
	else if(plus2> plus1 || qm+plus2>len)	//minus2=len-qm-plus2
		cout<<"0.00000"<<"\n";
	else{
		cout<< setprecision(12)<< pascal[qm-1][plus1-plus2]/(double)pow(2,qm) <<"\n";	//?C+/2^?
	}

	return 0;

}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;

typedef vector<int> VI;
typedef pair<int, int> PII;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define INF 1000100007

long double w[50];
long double pom[50];
char s[20];

int main()
{
	ios_base::sync_with_stdio(0);
	int x = 15;
	cin >> s;

	for(int i = 0; s[i]; ++i)
	{
		if(s[i] == '+') x++;
		else x--;
	}

	cin >> s;

	w[15] = 1.0;

	for(int i = 0; s[i]; ++i)
	{
		if(s[i] == '+') FORD(i, 30, 2) w[i] = w[i - 1];
		else if(s[i] == '-') FOR(i, 2, 30) w[i] = w[i + 1];
		else
		{
			FOR(i, 2, 30)
			{
				pom[i - 1] += w[i] / 2.0;
				pom[i + 1] += w[i] / 2.0;
			}
			FOR(i, 2, 30)
			{
				w[i] = pom[i];
				pom[i] = 0;
			}
		}
	}

	cout << w[x] << endl;
	return 0;
}

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

int funF(int n)
{
	if(n==1 || n==0) return 1;
	return n* funF(n-1);
}

int main()
{

    string s, t;
	cin>>s>>t;
	int len = s.length();
	bool b1=false;
	int sumS=0;
	int sumT=0;

	int kolVop=0;
	for(int i=0; i<len; i++)
	{

		if(s[i]=='+')
		{
			sumS++;
		}
		else if (s[i]=='-')
		{
			sumS--;
		}
		if(t[i]=='+')
		{
			sumT++;
		}
		else if (t[i]=='-')
		{
			sumT--;
		}
		if(t[i]=='?')
		{
			b1=true;
			kolVop++;
		}
	}
	if(b1==false)
	{
		if(sumT==sumS)
		{
		double po=1.0;
	     cout << fixed << setprecision(9) << po << endl;
		return 0;
			}
		if (sumT!=sumS)
		{
		double po=0.0;
	     cout << fixed << setprecision(9) << po << endl;

		return 0;
	    }
	}
	else
	{
		int koll=0;
		int FF=funF(kolVop)+2;
	    double result;
		int res=1;
		if (sumT+(double)kolVop==sumS)
			{
				result=(double)res;
	        	cout << fixed << setprecision(9) << (result/FF) << endl;
	 		    return 0;
			}
		res=0;
		int uuu=kolVop;
		while(true)
		{
		     if(sumT+(double)kolVop<0)
			 {
				double po1=0.0;
	            cout << fixed << setprecision(9) << po1 << endl;
	     	    return 0;
			 }
			if (sumT+(double)kolVop==sumS)
			{
				result=(double)res;
	        	cout << fixed << setprecision(9) << (result/FF) << endl;
	 		    return 0;
			}
			kolVop-=2;
            if(uuu%2==0)
			{
				if(kolVop>=0)
				{
					res+=2;
				}
				else
				{
					res-=2;
				}
			}
			else
			{
				if(kolVop>=1)
				{
					res+=2;
				}
				else
				{
					res-=2;
				}
			}
		 result=(double)res;
	        cout << fixed << setprecision(9) << (result/FF) << endl;
		}
		result=(double)res;
		cout << fixed << setprecision(9) << (result/FF) << endl;
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 50;

string s;
int x, q;
int f[N], inv[N];

ll fexp (ll b, ll e) {
    ll ans = 1;
    while (e) {
        if (e&1) ans = (ans*b) % MOD;
        b = (b*b) % MOD;
        e >>= 1;
    }
    return ans;
}

ll bin (ll i, ll j) {
    ll ans = f[i];
    ans *= inv[j];        ans %= MOD;
    ans *= inv[abs(i-j)]; ans %= MOD;
    return ans;
}

int main () {
    f[0] = f[1] = 1;
    for (int i = 2; i < N; i++) f[i] = (i*f[i-1]) % MOD;
    for (int i = 0; i < N; i++) inv[i] = fexp(f[i], MOD-2);
    cin >> s;
    for (auto c : s) {
        if (c == '+') x++;
        if (c == '-') x--;
    }
    cin >> s;
    for (auto c : s) {
        if (c == '-') x++;
        if (c == '+') x--;
        if (c == '?') q++;
    }
    ll num = 0;
    for (int i = 0; i <= q; i++)
        if (abs(2*i-q) == abs(x))
            num = bin(q, i);
    printf("%.10Lf\n", (ld) num/fexp(2, q));
    return 0;
}

// 1520891423775

#include <bits/stdc++.h>

#define eps 1e-8
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

using namespace std;

int fact(int n)
{
   if (n == 0 || n == 1)
      return 1;
   else
      return n * fact(n - 1);
}

int C(int n,int r)
{
	return fact(n) / ( fact(r) * fact(n-r) );
}

int main()
{
	string s1,s2;
	cin >> s1 >> s2;
	int x = 0 , q = 0 , len1 = s1.length() , len2 = s2.length();
	REP(i,len1)
	{
		if(s1[i]=='+') x++;
		else x--;
	}
	REP(i,len2)
	{
		if( s2[i] == '+' ) x--;
		else if( s2[i] == '-' ) x++;
		else q++;
	}
	double ans = 0;
	if(q==0)
	{
		if(x==0) cout << fixed << setprecision(12) << ans;
		else
		{
			ans++;
			cout << fixed << setprecision(12) << ans;
		}
		return 0;
	}

	if(  (x+q) % 2 != 0 )
	{
		cout << fixed << setprecision(12) << ans;
		return 0;
	}

	int tmp = -1*q,a=0;
	REP(i,q+1)
	{
		if(tmp==x) a = i;
		tmp += 2;
	}

	ans = (double) C(q,a) / pow(2,q);
	cout << fixed << setprecision(12) << ans;

	return 0;
}

// Create your own template by modifying this file!
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int i,j,n,plus=0,minus=0,q=0;
    char a[11],b[11];

    scanf("%s", a);
    scanf("%s", b);
    // cin >> a;
    // cin >> b;

    n = strlen(a);

    printf("plus=%d, minus=%d\n", plus, minus);
    printf("a=%s, n=%d\n", a, n);

    for (i=0; i<n; i++) {
        if (a[i] == '+') {
            plus++;
        } else {
            minus++;
        }
    }

    printf("plus=%d, minus=%d\n", plus, minus);

    for (i=0; i<n; i++) {
        if (b[i] == '+') {
            if (plus > 0) {
                plus--;
            } else {
                cout << "0.000000000000" << endl;
                return 0;
            }
        } else if (b[i] == '-') {
            if (minus > 0) {
                minus--;
            } else {
                cout << "0.000000000000" << endl;
                return 0;
            }
        } else {
            q++;
        }
    }

    n = plus + minus;
    if (n == 0) {
        cout << "1.000000000000\n";
        return 0;
    }

    // 0 means -
    // 1 means +
    int result = 0, total=0;
    long double ans = 0.0;
    printf("plus=%d, minus=%d\n", plus, minus);
    cout << "total will be 1 << " << n << " : " << (1<<n) << endl;
    for (i=0; i<(1<<n); i++) {
        int p=0, m=0;
        for (j=0; j<n; j++) {
            if (i & (1<<j)) {
                p++;
            } else {
                m++;
            }
        }

        if (p==plus && m==minus) {
            result++;
        }
        total++;
    }

    ans = (result*1.0)/(total*1.000000000);
    printf ("%Le\n", ans);
    // cout << "result is " << result << endl;
    // cout << "total is " << total << endl;
    // cout << ans << endl;

    return 0;
}

#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
void inp(string a,int x[])
{
    for (int i=0;i<a.size();i++)
        if (a[i]=='-') x[0]++;
            else if (a[i]=='+') x[1]++;
            else x[2]++;
}
int main()
{
    string a,b;
    float k,prob=1;
    int x[3]={0},y[3]={0};
    cin>>a>>b;
    inp(a,x);
    inp(b,y);
    if ((x[0]==y[0])&&(x[1]==y[1])) prob=1;
    else if(abs(x[0]-y[0])+abs(x[1]-y[1])>y[2]) prob=0;
    else prob=0.5;
    cout<<prob<<endl;
}

#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int countt(int h,string s2,int* k)
{

    int g=0; for(int i=0;i<s2.length();i++)
    { if(s2[i]=='?') g++;
      else
        {
            if(s2[i]=='+') {*k=*k+1; }
            else if(s2[i]=='-') *k=*k-1;
        }
    }
    return g;
}
int main()
{
    string s1,s2; cin >>s1>>s2;
    int flag=0,x,h,v=0,n=0,q=1,m=1,j=1,k=0;  double numpro,t; double po;
    for(int i=0;i<s1.length();i++)
    {
        if(s1[i]=='+') n=n+1;
        else if(s1[i]=='-') n=n-1;
    }
    for(int i=0;i<s2.length();i++)
    {
        if(s2[i]!='?')
        {
            if(s1[i]=='+') v=v+1;
            else if(s1[i]=='-') v=v-1;
            flag=1;
        }
        else {h=i;flag=0; break;}
    }
    if(flag==1){if(v==n)cout <<"1.000000000000"; else cout<<"0.000000000000";}
    else
    {
        x=countt(h,s2,&k);
        numpro=pow(2,x);
        k=n-k;
        if(k==0){cout<<"0.500000000000"<<endl;}
        else if(x>k){for(int i=x;i>0;i--){q=q*i;}for(int i=(x-k);i>0;i--){m=m*i;}for(int i=k;i>0;i--){j=j*i;} t=q/(m*j); po=t/numpro; printf("%.12f\n",po);   }
        else if(k==x){ po=1/numpro; printf("%.12f\n",po);}
        else{cout<<"0.000000000000";}
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

double ncr(int n, int r)
{
    r = min(r, n - r);

    int res = 1;
    for (int i = 1; i <= r; i++) res = res * (n - r + i) / i;
    return res;
}

int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);

    string s1, s2;
    cin >> s1 >> s2;

    int num_p = 0, num_q = 0;
    for (int i = 0; i < s1.size(); i++)
    {
        if (s1[i] == '+') ++num_p;
        if (s2[i] == '+') --num_p;
        if (s2[i] == '?') ++num_q;
    }

    cout << fixed << setprecision(9);
    cout << (num_p >= 0 && num_p < s1.size() ? ncr(num_q, num_p) / (1 << num_q) : 0) << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, k, n) for ((i) = (k); (i) < (n); (i)++)
#define FORD(i, k, n) for ((i) = (k); (i) >= (n); (i)--)
#define FORE(i, w) for (typeof((w).begin())(i) = (w).begin(); (i) != (w).end(); ++(i))
#define EACH(x, a) for (auto &x : a)
#define ll long long
#define PB(x) push_back(x)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define cpy(a, b) memcpy(a, b, sizeof(a))
#define sortall(x) sort(all(x))
#define out(x) cout << x << " ";
#define line() cout << "\n";
#define print(x) cout << x << "\n";
typedef vector<int> vi;
typedef vector<long long> vl;
#define vt vector
#define ar array

const int MOD = 1'000'000'007;
const int N = 2e6 + 13, M = N;

template <typename T, typename U>
static void amin(T &x, U y);
template <typename T, typename U>
static void amax(T &x, U y);
template <class A>
void read(vt<A> &v);
template <class A, size_t S>
void read(ar<A, S> &a);
template <class T>
void read(T &x);
void read(double &d);
void read(long double &d);
template <class A>
void read(vt<A> &x);
template <class A>
void write(vt<A> &x);
void write(vt<string> &x);
//==========================================================================
int ans = 0;

void recursion(string input, int i, int x, int n, int cnt)
{
    if (i == n)
    {
        if (x == cnt)
            ans++;
        return;
    }
    if (input[i] == '+')
        recursion(input, i + 1, x + 1, n, cnt);
    else if (input[i] == '-')
        recursion(input, i + 1, x - 1, n, cnt);
    else
    {
        recursion(input, i + 1, x + 1, n, cnt);
        recursion(input, i + 1, x - 1, n, cnt);
    }
}
void solve()
{
    string sent, received;
    cin >> sent >> received;
    int i, n = sent.length();
    int cnt = 0;
    ans = 0;
    FOR(i, 0, n)
    {
        if (sent[i] == '+')
            cnt++;
        else
            cnt--;
    }
    int question = 0;
    EACH(a, received)
    if (a == '?')
        question++;
    recursion(received, 0, 0, n, cnt);
    float ret = (float)ans / (1 << question);
    printf("%15f\n", ret);
}
//==========================================================================
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
#ifndef ONLINE_JUDGE
#define ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

template <typename T, typename U>
static void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template <typename T, typename U>
static void amax(T &x, U y)
{
    if (x < y)
        x = y;
}

template <class T>
void read(T &x)
{
    cin >> x;
}
void read(double &d)
{
    string t;
    read(t);
    d = stod(t);
}
void read(long double &d)
{
    string t;
    read(t);
    d = stold(t);
}
template <class A>
void read(vt<A> &x)
{
    EACH(a, x)
    read(a);
}
template <class A>
void write(vt<A> &x)
{
    EACH(a, x)
    {
        out(a);
    }
    line();
}

void write(vt<string> &x)
{
    EACH(a, x)
    {
        out(a);
        line();
    }
}

#include<bits/stdc++.h>
using namespace std;
#define lli long long
#define For(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
int factorial(int x)
{
    if(x==1)
        return 1;
    if(x==0)
        return 1;
    return x*factorial(x-1) ;
}
int main(){
    int sum1=0,sum2=0,count=0;
    float prob=1;
    string s1,s2;
    cin>>s1>>s2;
    For(i,s1.length())
    {
        if(s1[i]=='+') sum1++;
        else sum1--;
        if(s2[i]=='+') sum2++;
        else if(s2[i]=='-') sum2--;
        else count++;
    }
    //cout<<count<<" "<<sum2<<" "<<sum1<<" ";
    if(count==0)
    {
        if(sum1==sum2) cout<<prob;
        else cout<<"0";
    }
    else if(count+sum2<abs(sum1))
        cout<<"0";
    else
    {
        int one=0;
           For(i,s1.length())
        {
            if(s2[i]=='?' && s1[i]=='+') one++;
        }
        prob=factorial(count)/(factorial(one)*factorial(count-one)*pow(2,count));
        cout<<setprecision(20)<<prob;
    }
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <cstring>
#include <vector>
#include <map>
#include <strstream>

using namespace std;

int mypow(int a)
{
    int ans=1;
    for(int i=0; i<a; ++i)
    {
        ans*=2;
    }
    return ans;
}

set<int>a,s;
map<int,int>cnt;

int main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    string s1,s2;
    int sum1=0,sum2=0,ans=0;
    cin>>s1>>s2;
    for(int i=0; i<s1.length(); ++i)
    {
        if(s1[i]=='+')
        {
            sum1++;
        }
        else
        {
            sum1--;
        }
    }
    for(int i=0; i<s2.length(); ++i)
    {
        if(s2[i]=='+')
        {
            sum2++;
        }
        else if(s2[i]=='-')
        {
            sum2--;
        }

        if(s2[i]=='?')
        {
            ans++;
        }
    }

    if(ans==0)
    {
        if(sum1!=sum2)
        {
            cout<<"0.000000000000"<<endl;
            return 0;
        }
        else
        {
            cout<<"1.000000000000"<<endl;
            return 0;
        }
    }

    int sum=0,anss=mypow(ans);
    a.insert(0);
    set<int>::iterator it;
    bool f=true;
    for(int i=0; i<ans-1; ++i)
    {
        if(f)
        {
            it=a.begin();
            while(it!=a.end())
            {
                s.insert(*it+1);
                s.insert(*it-1);
                ++it;
            }
            a.clear();
            f=!f;
        }
        else
        {
            it=s.begin();
            while(it!=s.end())
            {
                a.insert(*it+1);
                a.insert(*it-1);
                ++it;
            }
            s.clear();
            f=!f;
        }
    }
    if(a.size()!=0)
    {
        it=a.begin();
        while(it!=a.end())
        {
            s.insert(*it+1);
            s.insert(*it-1);
            cnt[*it-1]++;
            cnt[*it+1]++;
            ++it;
        }

        it=s.begin();
        while(it!=s.end())
        {
            if(*it+sum2==sum1)sum+=cnt[*it];
            ++it;
        }
    }
    else
    {
        it=s.begin();
        while(it!=s.end())
        {
            a.insert(*it+1);
            a.insert(*it-1);
            cnt[*it-1]++;
            cnt[*it+1]++;
            ++it;
        }

        it=a.begin();
        while(it!=a.end())
        {
            if(*it+sum2==sum1)sum+=cnt[*it];
            ++it;
        }
    }
    cout.precision(10);
    cout<<fixed<<(sum*1.0)/anss<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define br                "\n"
#define ss                second
#define int               long long
#define pb                push_back
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type *arr=new type(n);
#define w(x)              int x; cin>>x; while(x--)
#define FOR(i,a,b)        for(int i=(a);i<(b);i++)
#define ROF(i,a,b)        for(int i=(a);i>=(b);i--)
#define so(a,n)           sort(a,a+n)
#define rso(a,n)          sort(a,a+n),reverse(a,a+n)
const                     int maxn=100010;
#define all(v)            (v).begin(),(v).end()

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input1.txt", "r", stdin);
  freopen("outp1.txt", "w", stdout);
#endif
}

int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int dp[100005];
void solve()
{

  string s;cin>>s;
  string t;cin>>t;
  int x=s.length();
  int y=t.length();
  int sum=0,sum1=0;
  FOR(i,0,x)
  {
  	if(s[i]=='+')sum+=1;
  	else if(s[i]=='-')sum+=-1;
  }
  int counter=0;
  int index=-1;
  FOR(i,0,y)
  {
  	if(t[i]=='+')sum1+=1;
  	else if(t[i]=='-')sum1+=-1;
    else if(t[i]=='?')counter++;
  }
  if(counter==0)
  {
   cout<<"1.000";
   return;
  }
  int j=0;
  for(int i=-1*counter;i<=1*counter;i+=2)
  {if(sum1+i==sum)index=j;
  j++;}
  if(counter*-1+sum1==sum||counter*1+sum1==sum)
  	cout<<1/(1.0*(pow(2,counter)));
  else
  	{
  		int zz=fact(counter) / (fact(index) * fact(counter- index));
  		cout<<zz/(1.0*(pow(2,counter)));
  	}
}
int32_t main()
{
  c_p_c();
  //w(t)
  solve();
}

#include <bits/stdc++.h>
using namespace std;

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	ll i, j, n;
	vector <double> fat (15, 1);
	for (i = 2; i < fat.size (); ++i)
		fat[i] = i*fat[i - 1];
	string orig, sent;
	cin >> orig >> sent;
	ll orig_p, orig_m, sent_p, sent_m, sent_i = 0;
	orig_p = orig_m = sent_p = sent_m = 0;
	trav (s, orig)
		if (s == '+') ++orig_p;
		else ++orig_m;
	trav (s, sent)
		if (s == '+') ++sent_p;
		else if (s == '-') ++sent_m;
		else ++sent_i;
	if (orig_p < sent_p || orig_m < sent_m)
	{
		cout << "0.000000000\n";
		return 0;
	}
	cout << (fat[sent_i]/fat[orig_p - sent_p]*fat[sent_i - orig_p + sent_p])/pow(2, sent_i) << '\n';

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long double fact(int n){
	long double res=1;
	if(n==0){
		return res;
	}
	for(int i=1;i<=n;i++){
		res*=i;
	}
	return res;
}
int main(){
	string s1;
	cin>>s1;
	string s2;
	cin>>s2;
	int pos1=0;
	int pos2=0;
	for(int i=0;i<s1.length();i++){
		if(s1[i]=='+'){
			pos1++;
		}
		else{
			pos1--;
		}
	}
	int quest=0;
	for(int i=0;i<s2.length();i++){
		if(s2[i]=='+'){
			pos2++;
		}
		else if(s2[i]=='-'){
			pos2--;
		}
		else{
			quest++;
		}
	}
	if(quest==0){
		if(pos1==pos2){
			cout<<1;
		}
	}
	else if(pos1>=pos2){
		int dis=pos1-pos2;
		int plus=dis;
		int minus=(quest-dis)/2;
		plus+=minus;
		cout<<plus<<endl<<minus<<endl<<quest<<endl;
		if(dis<=quest){
			cout<<(long double)((long double)fact(quest)/(fact(minus)*fact(plus)))/((long double)pow(2,quest));
		}
		else{
			cout<<0;
		}
	}
	else if(pos1<pos2){
		int dis=pos2-pos1;
		int minus=dis;
		int plus=(quest-dis)/2;
		minus+=plus;
		cout<<plus<<endl<<minus<<endl<<quest<<endl;
		if(dis<=quest){
			cout<<(long double)((long double)fact(quest)/(fact(minus)*fact(plus)))/((long double)pow(2,quest));
		}
		else{
			cout<<0;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main () {
	string s1,s2;
	int sum=0, a=0,n;
	float mu =1;
	cin >> s1 >> s2;
	n=s1.length();
	for (int i = 0 ; i < n ; i++) {
		if (s1[i] == '+') sum++;
		else sum--;
		if (s2[i] == '+') sum--;
		else if (s2[i] == '-') sum ++;
		else a++;
	}
	if (a==0 && sum == 0) {
		cout << 1 <<endl;

		return 0;
	}
	else if (sum > n) {
		cout << 0 <<endl;

		return 0;
	}
	else if (sum%2 == 0 && a%2 != 0){
		cout <<0<< endl;
						cout << a << " " <<sum<<endl;
		return 0;
	}
	for (int i =0; i < a;i++){
		mu=2*mu;
	}
	float r;
	r =float (a/mu);
	cout << fixed<< setprecision(9) << r <<endl;
	return 0;
}

#include <algorithm>
#include <cstring>
#include <set>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int dd(int j,int k)
{
    int f=1;
    if(j!=k)
    {
        for(int i=j-k+1;i<=j;++i)
            f*=i;
        for(int i=1;i<=j-k;++i)
            f/=i;
    }
    return f;
}
int main()
{
    char s1[12],s2[12];
    cin>>s1>>s2;
    int cnt=10;
    int sum=0;
    int a,b,c;
    a=b=c=0;
    int x1,y1,x2,y2,mm;
    x1=y1=x2=y2=mm=0;
    bool ok=0;
    for(int i=0;i<cnt;++i){
        if(s1[i]=='+')
            x1++;
        else if(s1[i]=='-')
            y1++;
    }
    for(int i=0;i<=cnt;++i)
    {
        if(s2[i]=='+')
            x2++;
        else if(s2[i]=='-')
            y2++;
        else if(s2[i]=='?')
            mm++;
    }
    if(x1<x2||y1<y2)
        ok=1;
    double z=1;
    if(mm==0)
        cout<<z<<endl;

    else
    {
        if(ok)
        {
            z=0;
            cout<<z<<endl;
        }
        else
        {
            z=(double)(dd(mm,x1-x2)*1.0/pow(2,mm));
            cout<<z<<endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define freopen freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#else
#define freopen //comment
#endif
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define pb push_back
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int ncr(int n,int r)
{
  r=min(r,n-r);
  int a=1,b=1,gcd;
  while(r)
  {
    a*=n;
    b*=r;
    gcd=__gcd(a,b);
    a/=gcd;
    b/=gcd;
    n--;
    r--;
  }
  return a/b;

}
int main()
{
 //freopen
 io
 string s,t;
 cin>>s>>t;
 int sz=s.size(),val=0,vali=0,q=0;
 for(int i=0;i<sz;i++)
  {
    if(s[i]=='+')val++;
    else val--;
  }
  for(int i=0;i<sz;i++)
  {
   if(t[i]=='+')vali++;
   else if(t[i]=='-')vali--;
   else q++;
  }
  if(q==0 && vali==val){cout<<"0.000000000"<<endl;return 0;}
  else if(q==0 && vali!=val){cout<<-1<<endl;return 0;}

  int ans=ncr(q,(q+abs(val-vali))/2);
  int tot=1<<q;
  double prob=(float)ans/(float)tot;
  printf("%.9f\n",prob);

}

#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <algorithm>
#define ll long long
using namespace std;

int calc(string s){
    int ans = 0;
    for (int i = 0; i < s.size(); i++)
        if (s[i] == '+')
            ans++;
        else if (s[i] == '-')
            ans--;
    return ans;
}

double solve(int goal, int cur, int unk){
    int i = 0, t= 1 << unk, ok = 0;
    while(i < t){
        int ex = i;
        int res = 0;
        while (ex){
            if (ex%2) res++;
            else res--;
            ex >>= 1;
        }
        if (cur + res == goal) ok++;
        i++;
    }

    return (double)ok / t;

}

int main(){
    string s1, s2;
    cin >> s1 >> s2;
    int goal = calc(s1);
    int current = calc(s2);
    int unknown = 0;
    for (int i = 0; i < s2.size(); i++)
        if (s2[i] == '?')
            unknown++;

    cout << setprecision(10);
  //  if (unknown)
        cout << solve(goal, current, unknown);
  //  else
  //      cout << (double)1.000000000000;
}

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

string s1, s2;

int main(){
	int plus=0, minus=0;
	int s2plus=0, s2minus=0, s2qs=0;

	cin >> s1;
	cin >> s2;

	for(int i=0; i<s1.length();i++){
		if(s1[i]=='+')
			plus++;
		else if(s1[i]=='-')
			minus++;
	}

	for(int i=0; i<s2.length();i++){
		if(s2[i]=='+')
			s2plus++;
		else if(s2[i]=='-')
			s2minus++;
		else if(s2[i]=='?')
			s2qs++;
	}
	if(plus==s2plus && minus==s2minus && s2qs==0){
		cout<<fixed<<setprecision(12)<<1.0;
	}
	else if((s2plus > plus || s2minus > minus)){
		cout<<fixed<<setprecision(12)<<0.0;
	}
	else if(s2qs > 0){
		if(s2qs == (plus-s2plus)+(minus-s2minus)){
			double pr=0;
			pr = pow((double)2.0, (double)s2qs);
			pr = s2qs/pr;
			if(plus==0 || minus==0)
				pr = 1;
			cout<<fixed<<setprecision(12)<<pr;
		}else{
			cout<<fixed<<setprecision(12)<<0.0;
		}
	}
}

#include <bits/stdc++.h>
using namespace std;

#define INF 1000000007
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
typedef vector<vector<pair<int,int> > > vvii;

#define all(x) x.begin(), x.end()
#define tr(x,it) for(auto it = x.begin();it!=x.end();++it)
#define ntr(x,it) for(auto it = x.rbegin();it!=x.rend();++it)
#define sz(a) int((a).size())
#define pb push_back
#define MP make_pair
#define fpresent(c,x) ((c).find(x) != (c).end())  // set,map
#define present(c,x) (find(all(c),x) != (c).end())  //vector
#define F first
#define S second
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define NFOR(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,a) for(int i=0;i<a;i++)
#define M(a,b) memset(a,b,sizeof(a));

int main()
{
    char a[15],b[15];
    scanf("%s%s",a,b);
    int c1=0,c2=0,c3=0;
    FOR(i,0,strlen(a)-1) {
    (a[i]=='-')? c1--:c1++;
    (b[i]=='-')? c2--:(b[i]=='+')? c2++:c3++;;
    }
    c2=c1-c2;
    if(!c3){ if(!c2)printf("1\n"); else printf("0\n"); return 0;}

    int y=0,tot=1<<c3,ac=0;
    FOR(i,0,1<<c3){
        y=0;
        FOR(j,0,c3-1){
            if(i&(1<<j))y++;
            else y--;
        }
        if(y==c2) ac++;
    }
    long double ans=(long double)ac/(long double)tot;
    printf("%.9Lf\n",ans);
}

//
//  Created by Ruslan Jankurazov.
//  Copyright © 2018 Ruslan Jankurazov. All rights reserved.
//

#pragma GCC optimize("Ofast")

#include "bits/stdc++.h"

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define uint unsigned int

using namespace std;

int main() {
#define FILE_INPUT 0
#define FILE ""
#ifndef DEBUG
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#if FILE_INPUT == 1
#warning "FREOPEN is on"
    freopen(FILE".in", "r", stdin);
    freopen(FILE".out", "w", stdout);
#endif
#endif
    string a, b;
    cin >> a >> b;
    int q, w;
    q = w = 0;
    for (auto i:a)
        q += i == '+' ? 1 : -1;
    int cnt = 0;
    for (auto i:b)
        if (i == '?')
            cnt++;
        else
            w += i == '+' ? 1 : -1;
    int k = q - w;
    double ans = 1;
//    if (k == 0 && !cnt)
//        cout << 1;
    if (cnt < abs(k) || (cnt - abs(k))%2 != 0) {
        cout << 0;
        return 0;
    }
//    else {
    double f = 1;
    for (int i = 0; i < cnt; ++i)
        f *= 0.5;
    double res = 1;
    for (int i = 1; i <= cnt; ++i) {
        res *= i;
    }
    for (int i = 1; i <= (cnt - abs(k) - (cnt - abs(k))/2); ++i)
        res /= i;

    printf("%0.9f", ans*(res*f));
//    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
long long factorial (long long n) {
    if(n == 0) return 1;
    long long res;
    res = n * factorial(n - 1);
    return res;
}
int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    int mins, pls, counter = 0, sum = 0, ex = 0, outc = 0;
    for(int i = 0; i < s1.size(); i++) {
        if(s1[i] == '-') {
            --sum;
        } else {
            ++sum;
        }
    }
    for(int i = 0; i < s2.size(); i++) {
        if(s2[i] == '-') {
            --ex;
        } else if(s2[i] == '+'){
            ++ex;
        } else {
            counter++;
        }
    }
    mins = counter;
    pls = 0;
    double ans = 0;
    if(counter == 0) {
        while(pls <= counter / 2) {

            if((ex + mins - pls) == sum) {
                ans = factorial(counter) / (factorial(mins) * factorial(pls));
            }
            else if((ex - mins + pls) == sum) {
                ans = factorial(counter) / (factorial(mins) * factorial(pls));
            }

            --mins;
            ++pls;
            ++outc;

        }
        printf("%.12f" , double(ans / (2 * (double)outc)));
    } else {
        printf("%.12f" , 1.0);
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
	ifstream cin("input.txt");
	ofstream cout("output.txt");
	string s1, s2;
	cin >> s1 >> s2;
	int fpos = 0;
	int n1 = (int)s1.size(), n2 = (int)s2.size();
	for(int i = 0; i < n1; ++i)
	{
		if(s1[i] == '+')
			++fpos;
		else
			--fpos;
	}
	queue <int> st;
	st.push(0);
	double ans = 0;
	int qa  =0;
	//cerr << "fpos " << fpos << '\n';
	for(int i = 0; i <= n2; ++i)
	{
		int sz = (int)st.size();
		//cerr <<"i " << i << '\n';
		for(int j = 0; j < sz; ++j)
		{
			int pos = st.front();
			st.pop();
			//cerr << "pos " << pos << ' ';
			if(i == n2 && pos == fpos)
				++ans;
			if(i == n2 )
				continue;
			if(s2[i] == '+')
				st.push(pos + 1);
			else if(s2[i] == '-')
				st.push(pos - 1);
			else
			{
				st.push(pos + 1);
				st.push(pos - 1);
			}
		}
		if(s2[i] == '?')
			++qa;
		// cerr << "\n";
	}
	cerr << ans << " " <<(1<<qa) << '\n';
		cout << fixed << setprecision(9);
	if(ans == 0)
		cout << (double)0 << '\n';
	else
		cout << (double)ans / (double)(1<<qa) << '\n';
}

//~ #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

using namespace std;
typedef unsigned long long int llu;

vector<int> v;
void solve(int unrec, int pos) {
	//cout << unrec << " " << pos << endl;
	if (!unrec) {
		v.push_back(pos);
		return;
	}

	solve(unrec - 1, pos - 1);
	solve(unrec - 1, pos + 1);
}

int main() { ios_base::sync_with_stdio(false);
	int dpos = 0;
	int cpos = 0;
	int unrec = 0;
	string s;
	cin >> s;
	for (auto c: s)
		if (c == '-') dpos--;
		else dpos++;

	cin >> s;
	for (auto c: s) {
		if (c == '-') cpos--;
		else if (c == '+') cpos++;
		else unrec++;
	}

	// cout << delta << endl << endl;

	//~
	//~
	//~ if (delta > unrec) {
		//~ cout << 0.0F;
	//~ } else {
		//~ float p = 1;
		//~ while (delta--) {
			//~ p *= 0.5;
			//~ unrec--;
		//~ }
		//~
		//~ while (unrec > 1) {
			//~ unrec -= 2;
			//~ p *= 0.5;
		//~ }
		//~
		//~ cout << p;
	//~ }
	//~

	solve(unrec, cpos);
	//~ for(auto e: v) {
		//~ cout << e << " ";
	//~ }cout << endl;
	int count = 0;
	for (auto e: v)
		if (e == dpos)
			count++;

	cout << ((float) count / v.size());

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long C(int n, int r) {
    if(r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
main()
{
	string orig,fin;
	cin>>orig>>fin;
	float po=0,mo=0,pf=0,mf=0,unknown=0;
	for(int i=0;i<orig.length();i++)
	{
		if(orig.at(i)=='+')
		{
			po++;
		}
		if(orig.at(i)=='-')
		{
			mo++;
		}
		if(fin.at(i)=='+')
		{
			pf++;
		}
		if(fin.at(i)=='-')
		{
			mf++;
		}
		if(fin.at(i)=='?')
		{
			unknown++;
		}
	}
	float ans=0;
//	cout<<po<<" "<<mo<<" "<<mf<<" "<<pf<<" "<<unknown;
	if(unknown==0)
	{
		if(po+mo-mf-pf==0)
		ans=1;
		else
		ans=0;
	}
	else
	{
		float rp=po-pf,rm=mo-mf;
		rm=max((float)0,rm);
		rp=max((float)0,rp);
		if(unknown==rp+rm)
		{
			ans=(C(rp+rm,rm))/pow(2,rp+rm);
		}
		else
		{
			ans=0;
		}
	}
	printf("%.9f\n",ans);
}

#include<sstream>
#include<string.h>
#include<iomanip>
#include<vector>
#include<map>
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair

using namespace std;

int cntdecimal(int x, int y)
{
    int ans = 0;  // Initialize result

    map<int, int> m;

    // calculating remainder
    while (x % y != 0) {

        x = x % y;

        ans++;

        if (m.find(x) != m.end())
            return -1;

        m[x] = 1;
        x = x * 10;
    }
    return ans;
}

int vsum(vector < char > v)
{
    int c=0;
    rep(i,0,sz(v))
    {
        if(v[i]=='+')
           c++;
        else if(v[i]=='-')
            c--;
    }
    return c;
}

int main()
{
    char s[100];
    vector < char > s1;
    vector < char > s2;
    cin>>s;
    rep(i,0,strlen(s))
    {
        s1.pb(s[i]);
    }
    cin>>s;
    rep(i,0,strlen(s))
    {
        s2.pb(s[i]);
    }
    if(sz(s1)==1&&s1[0]=='+')
    {
        if(s1[0]==s2[0])
            cout<< "1.000000000";
        else
            cout<< "0.000000000";
    }
    else if(sz(s1)==1&&s1[0]=='-')
    {
        if(s1[0]==s2[0])
            cout<< "1.000000000";
        else
            cout<< "0.000000000";
    }
    else
    {
    float ans=0;
    int c1=vsum(s1);
    int c2=vsum(s2);
    int q=count(all(s2),'?');
    vector < char > temp(q,'-');
    rep(i,0,q+1)
    {

        //rep(j,0,q)
        //{
          //  cout<<temp[j];
        //}
        //cout<<endl;
        if(vsum(temp)==c2-c1)
        {
            do
            {
              ans++;
            }while(next_permutation(all(temp)));
            break;
        }
        temp[i]='+';
    }
    if(ans==0)
        cout<< "0.";
    else if(ans==pow(2,q))
    {
        cout<< "1.";
    }
    else
        cout<< setprecision(9)<<ans/pow(2,q);
    if(cntdecimal(ans,pow(2,q))<=9||cntdecimal(ans,pow(2,q)>9)!=-1)
    {
        rep(i,0,9-cntdecimal(ans,pow(2,q)))
            cout<< "0";
    }
    }
}