#include <bits/stdc++.h>
using namespace std;
char s1[15], s2[15];
double f[15][60];
int main() {
  scanf("%s", s1);
  int End = 30;
  for (int i = 0; i < strlen(s1); i++)
    if (s1[i] == '+')
      End++;
    else
      End--;
  scanf("%s", s2);
  memset(f, 0, sizeof(0));
  f[0][30] = 1;
  for (int i = 0; i < strlen(s2); i++) {
    if (s2[i] == '+')
      for (int j = 9; j <= 41; j++) f[i + 1][j] = f[i][j - 1];
    if (s2[i] == '-')
      for (int j = 9; j <= 41; j++) f[i + 1][j] = f[i][j + 1];
    if (s2[i] == '?')
      for (int j = 9; j <= 41; j++)
        f[i + 1][j] = f[i][j - 1] * 0.5 + f[i][j + 1] * 0.5;
  }
  printf("%.12lf", f[strlen(s2)][End]);
  return 0;
}
