#include <bits/stdc++.h>
using namespace std;
string str1, str2;
int pos = 0, cnt = 0, re = 0;
void travers(int i, int tmpPos) {
  if (i == str2.length()) {
    cnt++;
    if (tmpPos == pos) re++;
    return;
  }
  if (str2[i] == '+')
    travers(i + 1, tmpPos + 1);
  else if (str2[i] == '-')
    travers(i + 1, tmpPos - 1);
  else {
    travers(i + 1, tmpPos + 1);
    travers(i + 1, tmpPos - 1);
  }
}
int main() {
  cin >> str1 >> str2;
  for (int i = 0; i < str1.length(); i++) {
    if (str1[i] == '+')
      pos++;
    else
      pos--;
  }
  travers(0, 0);
  cout << setprecision(10) << fixed << ((re + 0.0) / cnt) << endl;
  return 0;
}
