#include <bits/stdc++.h>
using namespace std;
int p1 = 0, m1 = 0;
int total = 0, res = 0;
string s, t;
void solve(int idx, int p, int m) {
  if (idx == t.size()) {
    total++;
    if (p == p1 && m == m1) res++;
    return;
  }
  if (t[idx] == '+') {
    solve(idx + 1, p + 1, m);
  } else if (t[idx] == '-') {
    solve(idx + 1, p, m + 1);
  } else {
    solve(idx + 1, p + 1, m);
    solve(idx + 1, p, m + 1);
  }
  return;
}
int main() {
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '+')
      p1++;
    else
      m1++;
  }
  solve(0, 0, 0);
  printf("%.9f", (1.0 * res) / total);
}
