#include <bits/stdc++.h>
using namespace std;
const int MAXN = 15;
const int MAXV = 110;
string s1, s2;
int meta, dp[MAXN][MAXV];
double solve(int k, int pos) {
  if (k == s2.size() && pos == meta) return 1;
  if (k == s2.size()) return 0;
  if (dp[k][pos] != -1) return dp[k][pos];
  if (s2[k] == '+')
    return dp[k][pos] = solve(k + 1, pos + 1);
  else if (s2[k] == '-')
    return dp[k][pos] = solve(k + 1, pos - 1);
  else {
    int caso1 = solve(k + 1, pos + 1);
    int caso2 = solve(k + 1, pos - 1);
    return dp[k][pos] = caso1 + caso2;
  }
}
int main(void) {
  memset(dp, -1, sizeof dp);
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] == '+')
      meta++;
    else
      meta--;
  }
  int qtd = 0;
  for (int i = 0; i < s2.size(); i++)
    if (s2[i] == '?') qtd++;
  meta += 50;
  double ans = solve(0, 50);
  double k = (1 << qtd);
  printf("%.11lf\n", ans / (k));
}
