#include <bits/stdc++.h>
using namespace std;
string S, t;
long long sure, sum, total;
void rec(long long dest, long long pos) {
  for (int i = pos; i < t.size(); i++) {
    if (t[i] == '+') {
      dest++;
    } else if (t[i] == '-') {
      dest--;
    } else {
      rec(dest + 1, i + 1);
      rec(dest - 1, i + 1);
      return;
    }
  }
  if (dest == sure) {
    sum++;
  }
  total++;
}
int main() {
  cin >> S >> t;
  sure = 0;
  sum = 0;
  total = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == '+') {
      sure++;
    } else {
      sure--;
    }
  }
  rec(0, 0);
  cout << fixed << setprecision(10) << (double)sum / total << endl;
  return 0;
}
