#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long qpow(long long n, long long k) {
  long long ans = 1;
  while (k > 0) {
    if (k & 1) ans = ans * n;
    n = n * n;
    k >>= 1;
  }
  return ans;
}
const long long MAX = 1e6 + 10;
long long a[MAX];
long long b[MAX];
long long c[15][15];
long long ans[MAX];
long long totol[MAX];
int main() {
  long long n, k, m, sum, t, len;
  string s, d;
  memset(c, 0, sizeof c);
  c[0][0] = 1;
  for (long long i = (0); i <= (10); ++i) {
    c[i][i] = c[i][0] = 1;
    for (long long j = 1; j <= i; j++) {
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
  }
  while (cin >> s >> d) {
    int flag = 1;
    ans[0] = 0;
    totol[0] = 0;
    sum = 0;
    t = 0;
    long long len1, len2;
    long long t1, t2;
    t1 = 0;
    t2 = 0;
    len1 = s.size();
    len2 = d.size();
    for (long long i = (0); i < (len1); ++i)
      if (s[i] == '+')
        sum++;
      else
        sum--;
    for (long long i = (0); i < (len2); ++i) {
      if (d[i] == '+') t1++;
      if (d[i] == '-') t1--;
      if (d[i] == '?') t++;
    }
    sum = abs(sum - t1);
    if (t < sum)
      cout << "0" << endl;
    else if (sum % 2 == 0 && t % 2 == 1 || sum % 2 == 1 && t % 2 == 0)
      cout << "0" << endl;
    else if (t == 0 && sum == 0)
      cout << "1" << endl;
    else {
      double x = (double)(qpow(2, t));
      double y = (double)(c[t][(t - sum) / 2]);
      if (sum == t)
        cout << setprecision(10) << 1 / x << endl;
      else
        cout << setprecision(10) << y / x << endl;
    }
  }
  return 0;
}
