#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int cpo = 0, cmo = 0, cop = 0, com = 0, coq = 0;
  double res = 0, z = 0, o = 1;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] == '+')
      cpo++;
    else
      cmo++;
    if (s2[i] == '+')
      cop++;
    else if (s2[i] == '-')
      com++;
    else
      coq++;
  }
  if (cop > cpo || com > cmo) {
    cout << fixed << setprecision(12) << z;
    return 0;
  } else if (cop == cpo && com == cmo) {
    cout << fixed << setprecision(12) << o;
    return 0;
  }
  cpo -= cop;
  cmo -= com;
  for (int i = 0; i < (1 << coq); i++) {
    int countp = coq;
    int countm = 0;
    for (int j = 0; j < coq; j++)
      if ((i >> j) & 1) {
        countm++;
        countp--;
      }
    if (cpo == countp && cmo == countm) res++;
  }
  cout << fixed << setprecision(12) << res / pow(2, coq);
  return 0;
}
