#include <bits/stdc++.h>
long long dx[4] = {-1, 0, 1, 0};
long long dy[4] = {0, -1, 0, 1};
using namespace std;
vector<vector<long long> > g;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    string a, b;
    cin >> a >> b;
    long long p = 0, q = 0, r = 0, n = a.length();
    for (long long i = 0; i < n; i++) {
      if (a[i] == '+')
        p++;
      else
        p--;
    }
    for (long long i = 0; i < n; i++) {
      if (b[i] == '+')
        q++;
      else if (b[i] == '-')
        q--;
      else
        r++;
    }
    map<long long, long long> m;
    for (long long i = 0; i < (1 << r); i++) {
      long long sum = 0;
      for (long long j = 0; j < r; j++) {
        if (i & (1 << j)) {
          sum++;
        } else
          sum--;
      }
      m[sum + q]++;
    }
    cout << setprecision(20);
    float ans = 0;
    if (m.find(p) != m.end()) {
      float x = (1 << r);
      float y = m[p];
      ans = y / x;
    }
    cout << ans;
    cout << endl;
  }
}
