#include <bits/stdc++.h>
using namespace std;
long long final_point = 0;
long long no_of_unknown_move = 0;
long long n = 0;
string a, b;
long long ans = 0;
long long power(long long v, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * v;
    n = n >> 1;
    v = v * v;
  }
  return res;
}
void solve(long long i, long long curr_state) {
  if (i == n) {
    ans += (curr_state == final_point);
    return;
  }
  if (b[i] == '?') {
    solve(i + 1, curr_state + 1);
    solve(i + 1, curr_state - 1);
  } else {
    if (b[i] == '+')
      solve(i + 1, curr_state + 1);
    else
      solve(i + 1, curr_state - 1);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> a >> b;
  n = a.length();
  final_point = 0;
  no_of_unknown_move = 0;
  ans = 0;
  for (long long i = 0; i < n; i++) {
    final_point += (a[i] == '+') ? 1 : -1;
    no_of_unknown_move += (b[i] == '?');
  }
  solve(0, 0);
  cout << setprecision(10) << fixed
       << ((long double)ans / (long double)power(2, no_of_unknown_move));
}
