#include <bits/stdc++.h>
using namespace std;
int top(string str) {
  int s = 0, n;
  n = str.length();
  for (int i = 0; i < n; i++)
    if (str[i] == '+')
      s += 1;
    else
      s -= 1;
  return s;
}
int fak(int n, int k) {
  int s = 1, max1 = 1, max2 = 1;
  for (int i = 1; i <= n; i++) s *= i;
  for (int i = 1; i <= n - k; i++) max1 *= i;
  for (int i = 1; i <= k; i++) max2 *= i;
  return s / (max1 * max2);
}
int main() {
  int a, b = 0, len, n = 0, m, ans = 0;
  string s1, s2;
  float nat;
  cin >> s1 >> s2;
  a = top(s1);
  m = s2.length();
  for (int i = 0; i < m; i++)
    if (s2[i] == '?')
      n++;
    else {
      if (s2[i] == '+')
        b += 1;
      else
        b -= 1;
    }
  if (n == 0) {
    b = top(s2);
    if (a == b) {
      nat = 1.0;
      printf("%.9f", nat);
    } else {
      nat = 0.0;
      printf("%.9f", nat);
    }
  } else {
    int k = 0;
    for (int i = -1 * n; i <= n; i += 2) {
      if (b + i == a) {
        ans = fak(n, k);
      }
      k++;
    }
    nat = (ans + 0.) / pow(2.0, n);
    printf("%.9f", nat);
  }
  return 0;
}
