#include <bits/stdc++.h>
int total;
int bt(int nquestion, int target, int pos) {
  if (nquestion == 0) {
    total++;
    if (pos == target)
      return 1;
    else
      return 0;
  }
  int ret = 0;
  ret += bt(nquestion - 1, target, pos + 1);
  ret += bt(nquestion - 1, target, pos - 1);
  return ret;
}
int main() {
  int len1, len2, pos1 = 0, pos2 = 0, nquestion = 0;
  char s1[15], s2[15];
  scanf("%s", s1);
  scanf("%s", s2);
  len1 = strlen(s1);
  len2 = strlen(s2);
  for (int i = 0; i < len1; i++) pos1 += (s1[i] == '+') ? 1 : -1;
  for (int i = 0; i < len2; i++) {
    pos2 += (s2[i] == '+') ? 1 : (s2[i] == '-') ? -1 : 0;
    if (s2[i] == '?') nquestion++;
  }
  total = 0;
  int reach = bt(nquestion, pos1, pos2);
  printf("%.12lf\n", (double)reach / (double)total);
  return 0;
}
