#include <bits/stdc++.h>
using namespace std;
double check(char *a, char *b, int i, int m, int n) {
  if (i == strlen(a) && m == n) {
    return 1.000000000000;
  } else if (i == strlen(a)) {
    return 0.000000000000;
  }
  if (b[i] == '+') {
    n++;
  } else if (b[i] == '-') {
    n--;
  } else {
    return (check(a, b, i + 1, m, n + 1) + check(a, b, i + 1, m, n - 1));
  }
  return (check(a, b, i + 1, m, n));
}
int main() {
  int i, j, k, l, m, n;
  double f = 0.50000000000;
  char a[11], b[11];
  cin >> a >> b;
  m = 0;
  n = 0;
  l = 0;
  for (i = 0; i < strlen(a); i++) {
    if (a[i] == '+') {
      m++;
    } else {
      m--;
    }
  }
  for (i = 0; i < strlen(b); i++) {
    if (b[i] == '?') {
      l++;
    }
  }
  double p = 0.000000000000 + (double)check(a, b, 0, m, 0);
  cout.precision(12);
  cout << p / (double)pow(2, l) << endl;
  return 0;
}
