#include <bits/stdc++.h>
using namespace std;
int fact(int r) {
  if (r == 0 || r == 1) return 1;
  return fact(r - 1) * r;
}
int plus1, plus2, moin1, moin2, plus3, moin3, x;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++)
    if (s1[i] == '+')
      plus1++;
    else
      moin1++;
  for (int i = 0; i < s2.size(); i++)
    if (s2[i] == '+')
      plus2++;
    else if (s2[i] == '-')
      moin2++;
    else
      x++;
  if (((x == 0) && (plus1 != plus2) && (moin1 != moin2)) ||
      ((x != 0) && ((plus1 < plus2) || (moin1 < moin2))))
    return printf("%.12f", 0.0), 0;
  if ((x == 0) && (plus1 == plus2) && (moin1 == moin2))
    return printf("%.12f", 1.0), 0;
  if (x != 0) {
    plus3 = plus1 - plus2;
    moin3 = moin1 - moin2;
    if ((plus3 == 0 && moin3 != 0) || (plus3 != 0 && moin3 == 0))
      return printf("%.12f", 1 / pow(2, x)), 0;
    int y = min(plus3, moin3);
    int result = fact(x) / (fact(y) * fact(x - y));
    return printf("%.12f", result / pow(2, x)), 0;
  }
  return 0;
}
