#include <bits/stdc++.h>
using namespace std;
string foo, bar;
int foosum = 0;
int valid = 0;
void solve(int i, int sum) {
  if (i == bar.size()) {
    if (sum == foosum) ++valid;
    return;
  }
  if (bar[i] == '?') {
    solve(i + 1, sum + 1);
    solve(i + 1, sum - 1);
  } else if (bar[i] == '+') {
    solve(i + 1, sum + 1);
  } else {
    solve(i + 1, sum - 1);
  }
}
int main() {
  cin >> foo >> bar;
  int ques = 0;
  for (int i = 0; i < foo.size(); ++i) {
    if (foo[i] == '+')
      ++foosum;
    else
      --foosum;
  }
  for (int i = 0; i < bar.size(); ++i) {
    if (bar[i] == '?') ++ques;
  }
  solve(0, 0);
  printf("%.12lf\n", (1.0 * valid) / (1 << ques));
  return 0;
}
