#include <bits/stdc++.h>
char s1[20], s2[20];
int main() {
  int i, k, aa, bb, d, a, b, c;
  while (scanf("%s%s", s1, s2) != EOF) {
    aa = 0;
    bb = 0;
    for (i = 0; s1[i]; i++) {
      if (s1[i] == '+')
        aa++;
      else
        bb++;
    }
    a = 0;
    b = 0;
    c = 0;
    for (i = 0; s2[i]; i++) {
      if (s2[i] == '+')
        a++;
      else if (s2[i] == '-')
        b++;
      else
        c++;
    }
    if (aa < a || bb < b) {
      printf("0.000000000000\n");
      continue;
    }
    a = aa - a;
    b = bb - b;
    if (a == 0 && b == 0) {
      printf("1.000000000000\n");
      continue;
    }
    k = 0;
    for (i = 0; i < (1 << c); i++) {
      aa = 0;
      bb = c;
      d = i;
      while (d) {
        if (d % 2 == 1) {
          aa++;
          bb--;
        }
        d /= 2;
      }
      if (aa == a && bb == b) k++;
    }
    printf("%.12f\n", 1.0 * k / (1 << c));
  }
  return 0;
}
