#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > pq;
int dp[11][11];
void ini() {
  int i, j;
  for (int i = 0; i < 11; i++)
    for (j = 0; j <= max(i, 10); j++) {
      if (i == 0)
        dp[i][j] = 0;
      else if (i == j || j == 0)
        dp[i][j] = 1;
      else if (j == 1)
        dp[i][j] = i;
      else
        dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1];
    }
}
int main() {
  ini();
  int b, i, n, t, m, sum, x, y;
  string s1, s2;
  cin >> s1;
  cin >> s2;
  int l = s1.length();
  sum = 0;
  x = 0;
  y = 0;
  for (int i = 0; i < l; i++)
    if (s1[i] == '+') sum++;
  int sum2 = 0;
  for (int i = 0; i < l; i++) {
    if (s2[i] == '+')
      sum2++;
    else if (s2[i] == '?')
      x++;
  }
  int anss = 0;
  double answ = 0;
  if (sum - sum2 < 0)
    answ = 0;
  else if (sum == sum2 && x == 0)
    answ = 1;
  else if (sum != sum2 && x == 0)
    answ = 0;
  else {
    anss = dp[x][sum - sum2];
    answ = (double)anss / pow(2, x);
  }
  printf("%0.11lf", answ);
}
