#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int x = 0;
  int y = 0;
  int ques = 0;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] == '+')
      x += 1;
    else
      x -= 1;
    if (s2[i] == '+')
      y += 1;
    else if (s2[i] == '-')
      y -= 1;
    else
      ques++;
  }
  double count = 0;
  for (int i = 0; i < pow(2, ques); i++) {
    int a = x;
    for (int j = 0; j < ques; j++) {
      if ((i & (1 << j)) == 0)
        a--;
      else
        a++;
    }
    if (a == y) {
      count++;
    }
  }
  double ans = count / double(1 << ques);
  cout << fixed << setprecision(11) << ans;
}
