#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int n = s1.length(), p = 0, a = 0, p2 = 0;
  for (int i = 0; i < n; i++)
    if (s1[i] == '+') p++;
  int m = n - p;
  for (int i = 0; i < n; i++) {
    if (s2[i] == '?')
      a++;
    else if (s2[i] == '+')
      p2++;
  }
  int m2 = n - a - p2;
  if (abs(p2 - p) <= a && abs(m2 - m) <= a) {
    float y = abs(p2 - p), ans = 1;
    y = min(y, a - y);
    for (int i = a; i > a - y; i--) ans *= i;
    for (int i = 2; i <= y; i++) ans /= i;
    float s = pow(2, a);
    printf("%.9f", ans / s);
  } else
    cout << 0;
  return 0;
}
