#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, a = 0, b = 0, c = 0, k;
  char s1[15], s2[15];
  scanf("%s", s1);
  scanf("%s", s2);
  for (i = 0; s1[i] != '\0'; i++) {
    if (s1[i] == '+')
      a++;
    else
      a--;
    if (s2[i] == '+')
      b++;
    else if (s2[i] == '-')
      b--;
    else
      c++;
  }
  k = a - b;
  int count = 0, p = pow(2, c), x, j;
  for (i = 0; i < p; i++) {
    int cnt = 0;
    x = i;
    for (j = 0; j < c; j++) {
      if (x % 2)
        cnt++;
      else
        cnt--;
      x /= 2;
    }
    if (cnt == k) count++;
  }
  double d = count * 1.0 / p;
  cout << fixed << setprecision(9) << d << endl;
  cin >> i;
  return 0;
}
