#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int main() {
  double count = 0.00;
  cin >> s1;
  cin >> s2;
  int desired_position = 0;
  for (auto k : s1) {
    if (k == '+')
      desired_position++;
    else
      desired_position--;
  }
  int fixed_postion = 0, question_marks = 0;
  for (auto k : s2) {
    if (k == '+')
      fixed_postion++;
    else if (k == '-')
      fixed_postion--;
    else
      question_marks++;
  }
  for (int i = 0; i < (2 << question_marks); i++) {
    int temp = fixed_postion;
    for (int j = 0; j < question_marks; j++) {
      if (i & (1 << j)) {
        temp++;
      } else
        temp--;
    }
    if (temp == desired_position) count++;
  }
  cout << setprecision(12) << fixed << count / (2 << question_marks) << "\n";
  return 0;
}
