#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
set<int> ss;
int n, fin;
string s1, s2;
int solve(int i = 0, int cur = 0) {
  if (i == n) {
    return (cur == fin);
  }
  int ans = 0, ch1 = 0, ch2 = 0;
  if (s2[i] == '?') {
    ch1 = solve(i + 1, cur - 1);
    ch2 = solve(i + 1, cur + 1);
  }
  if (s2[i] == '+') ch1 = solve(i + 1, cur + 1);
  if (s2[i] == '-') ch2 = solve(i + 1, cur - 1);
  ans = ch1 + ch2;
  return ans;
}
int main() {
  cin >> s1 >> s2;
  n = (int)s1.size();
  fin = 0;
  int totalno = 1;
  for (int i = 0; s1[i]; ++i) {
    if (s1[i] == '+') {
      fin++;
    } else {
      fin--;
    }
  }
  for (int i = 0; s2[i]; ++i) {
    if (s2[i] == '?') totalno *= 2;
  }
  int valid = solve();
  double ans = (double)valid / totalno;
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}
