#include <bits/stdc++.h>
using namespace std;
char buf[11];
const int MAXC = 20;
double C[MAXC][MAXC + 1];
void count(int &sum, int &q) {
  char buf[11];
  cin >> buf;
  sum = 0;
  q = 0;
  for (char *p = buf; *p; ++p) {
    switch (*p) {
      case '+':
        ++sum;
        break;
      case '-':
        --sum;
        break;
      case '?':
        ++q;
    }
  }
}
void init_C() {
  C[0][0] = 1.0;
  for (int i = 1; i < MAXC; ++i) {
    C[i][0] = C[i][i] = 1.0;
    for (int j = 1; j < i; ++j) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
  }
}
int main() {
  init_C();
  int sum1, sum2, quest;
  count(sum1, quest);
  count(sum2, quest);
  int diff = sum1 - sum2;
  int t = (quest + diff) / 2;
  if (abs(diff) > quest || (quest + diff) % 2) {
    cout << "0.0\n";
  } else {
    cout << setprecision(12) << C[quest][t] / (1 << quest) << "\n";
  }
  return 0;
}
