#include <bits/stdc++.h>
using namespace std;
char s1[20], s2[20];
int acou = 0, dao = 0, sum = 0;
int n1, n2;
void solve(int n, int at) {
  if (n == n2) {
    if (at == acou) dao++;
    sum++;
    return;
  }
  if (s2[n] == '+')
    solve(n + 1, at + 1);
  else if (s2[n] == '-')
    solve(n + 1, at - 1);
  else {
    solve(n + 1, at + 1);
    solve(n + 1, at - 1);
  }
}
int main() {
  scanf("%s", s1);
  scanf("%s", s2);
  n1 = strlen(s1);
  n2 = strlen(s2);
  for (int i = 0; i < n1; i++)
    if (s1[i] == '+')
      acou++;
    else
      acou--;
  solve(0, 0);
  printf("%.12f\n", (double)(dao) / (sum));
  return 0;
}
