#include <bits/stdc++.h>
using namespace std;
double dp[15][30];
string s, r;
double calc(int i, int pos) {
  if (i == -1) {
    if (pos == 10)
      return 1;
    else
      return 0;
  }
  if (dp[i][pos] != -1) return dp[i][pos];
  if (s[i] == '?')
    return dp[i][pos] = calc(i - 1, pos - 1) * 0.5 + calc(i - 1, pos + 1) * 0.5;
  if (s[i] == '+') return dp[i][pos] = calc(i - 1, pos - 1);
  if (s[i] == '-') return dp[i][pos] = calc(i - 1, pos + 1);
  return 0;
}
int main() {
  for (int i = 0; i < 15; i++)
    for (int j = 0; j < 30; j++) dp[i][j] = -1;
  cin >> r >> s;
  int n = s.length();
  int posllegada = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] == '+') posllegada++;
    if (r[i] == '-') posllegada--;
  }
  printf("%0.12f\n", calc(n - 1, posllegada + 10));
}
