#include <bits/stdc++.h>
using namespace std;
string st1, st2;
int comparador1, comparador2, proba = 0;
int main() {
  cin >> st1 >> st2;
  int pos =
      count(st1.begin(), st1.end(), '+') - count(st1.begin(), st1.end(), '-');
  int pos2 =
      count(st2.begin(), st2.end(), '+') - count(st2.begin(), st2.end(), '-');
  int ci = count(st2.begin(), st2.end(), '?');
  float x = pow(2, ci);
  int med;
  for (int a = 0; a < x; a++) {
    comparador1 = 0;
    if (a == 0) {
      comparador2 = (ci) * (-1);
    } else {
      int z = a;
      while (z) {
        med = z % 2;
        if (med == 1) {
          comparador1 += 1;
        }
        z = z / 2;
      }
    }
    comparador2 = ((ci - comparador1) * (-1)) + comparador1;
    if ((pos2 + comparador2) == pos) {
      proba += 1;
    }
  }
  cout << fixed << setprecision(12) << proba / x << '\n';
  return 0;
}
