#include <bits/stdc++.h>
using namespace std;
char s1[12], s2[12];
vector<int> idx;
int cnt, cnt_b, cnt_all;
int res;
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < strlen(s1); i++) {
    if (s2[i] == '?') cnt++, idx.push_back(i);
  }
  for (int i = 0; i < strlen(s1); i++) {
    if (s1[i] == '+')
      res++;
    else
      res--;
  }
  for (int i = 0; i < (1 << cnt); i++) {
    for (int j = 0; j < idx.size(); j++) {
      if ((1 << j) & i) {
        s2[idx[j]] = '+';
      } else
        s2[idx[j]] = '-';
    }
    int res_sm = 0;
    for (int j = 0; j < strlen(s1); j++) {
      if (s2[j] == '+')
        res_sm++;
      else
        res_sm--;
    }
    if (res_sm == res) cnt_b++;
    cnt_all++;
  }
  cout.setf(ios::fixed);
  cout.precision(9);
  cout << (double)cnt_b / cnt_all << '\n';
  return 0;
}
