#include <bits/stdc++.h>
using namespace std;
int num1 = 0;
string s1, s2;
int counter = 0;
int ques = 0;
int main() {
  cin >> s1 >> s2;
  int num2 = 0;
  for (int i = 0; i < s1.length(); i++)
    if (s1[i] == '+')
      num1++;
    else
      num1--;
  for (int i = 0; i < s2.length(); i++)
    if (s2[i] == '+')
      num2++;
    else if (s2[i] == '-')
      num2--;
    else
      ques++;
  float num = 0;
  int limit = (1 << ques);
  for (int i = 0; i < limit; i++) {
    int sum = num2;
    for (int j = 0; j < ques; j++) {
      if ((1 << j) & i)
        sum++;
      else
        sum--;
    }
    if (sum == num1) counter++;
  }
  if (ques != 0) {
    num = (float)counter / (1 << ques);
  } else if (num2 == num1)
    num = 1;
  printf("%0.12f\n", num);
}
