#include <bits/stdc++.h>
using namespace std;
void dfs(string& s, int ind, int curr_pos, int final_pos, int& counts) {
  if (ind >= s.length()) {
    if (curr_pos == final_pos) counts++;
    return;
  }
  if (s[ind] == '+') {
    dfs(s, ind + 1, curr_pos + 1, final_pos, counts);
  } else if (s[ind] == '-') {
    dfs(s, ind + 1, curr_pos - 1, final_pos, counts);
  } else {
    dfs(s, ind + 1, curr_pos + 1, final_pos, counts);
    dfs(s, ind + 1, curr_pos - 1, final_pos, counts);
  }
}
int main() {
  string orig;
  cin >> orig;
  string rec;
  cin >> rec;
  int final_pos = 0;
  for (auto ch : orig) {
    final_pos = (ch == '+') ? final_pos + 1 : final_pos - 1;
  }
  int possible_pos = 0, counts = 0;
  for (auto ch : rec) {
    if (ch == '?') possible_pos++;
  }
  possible_pos = 1 << possible_pos;
  dfs(rec, 0, 0, final_pos, counts);
  printf("%.12lf\n", (((double)counts) / ((double)possible_pos)));
  return 0;
}
