#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre(){freopen("c://test//input.in","r",stdin);freopen("c://test//output.out","w",stdout);}
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1,class T2>inline void gmax(T1 &a,T2 b){if(b>a)a=b;}
template <class T1,class T2>inline void gmin(T1 &a,T2 b){if(b<a)a=b;}
const int N=0,M=0,Z=1e9+7,ms63=0x3f3f3f3f;
int casenum,casei;
char a[12],b[12];
int aim,num,tmp,ans;
void dfs(int p,int tmp)
{
if(b[p]==0)
{
if(tmp==aim)++ans;
return;
}
if(b[p]=='+'||b[p]=='?')
{
dfs(p+1,tmp+1);
}
if(b[p]=='-'||b[p]=='?')
{
dfs(p+1,tmp-1);
}
}
void way1()
{
ans=0;
dfs(0,0);
printf("%.15f\n",1.0*ans/(1<<num));
}
int C(int n,int m)
{
int c[12][12];MS(c,0);
c[0][0]=1;
for(int i=1;i<=n;++i)
{
c[i][0]=1;
for(int j=1;j<=i;++j)
{
c[i][j]=c[i-1][j-1]+c[i-1][j];
}
}
return c[n][m];
}
void way2()
{
int dis=aim-tmp;
int x=num+dis>>1;
int y=num-dis>>1;
if(x>=0&&y>=0&&x+y==num)printf("%.15f\n",1.0*C(num,x)/(1<<num));
else puts("0");
}
int main()
{
while(~scanf("%s%s",a,b))
{
aim=0;
for(int i=0;a[i];++i)
{
if(a[i]=='+')++aim;
else --aim;
}
tmp=0;
num=0;
for(int i=0;b[i];++i)
{
if(b[i]=='+')++tmp;
else if(b[i]=='-')--tmp;
else ++num;
}
//way1();
way2();
}
return 0;
}
/*
【trick&&吐槽】
做题一定要注意观察数据规模,选择最适合的算法就是最好的哦。
【题意】
给你两个等长的串。
第一个串只含 '+' 和 '-',代表 +1 或 -1,于是会有一个最终的增量aim
第二个串含有 '+' 个 '-',还有'?',我们可以任意填充'?',想使得第二个串的最终增量也恰好为aim
问填充方案数
【类型】
暴力dfs or 组合数
【分析】
方法一:暴力dfs
数据太小,暴力dfs不要太舒服。
方法二:组合数
设aim-tmp的差值为dis。
设加号x个,减号y个,那么有——
x+y==num
x-y==dis
x=num+dis>>1
y=num-dis>>1
求出x和y,如果合理,答案就是c[num][x]。
*/