#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int r = 0;
  int n = 0, m = 0;
  for (int i = 0; i < s1.size(); i++)
    if (s1[i] == '+') r++;
  for (int i = 0; i < s2.size(); i++) {
    if (s2[i] == '?') n++;
    if (s2[i] == '+') m++;
  }
  r = r - m;
  double ans = 0;
  for (int i = 0; i < 1 << n; i++) {
    int j = i;
    int cnt = 0;
    while (j) {
      j = j & (j - 1);
      cnt++;
    }
    if (cnt == r) ans++;
  }
  printf("%.10lf", ans / (1 << n));
  return 0;
}
