#include <bits/stdc++.h>
using namespace std;
int C[11][11];
void cal_c() {
  for (int i = 0; i <= 10; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
    }
  }
}
double solve(string p, string q) {
  cal_c();
  int d1 = count(p.begin(), p.end(), '+') - count(q.begin(), q.end(), '+');
  int d2 = count(p.begin(), p.end(), '-') - count(q.begin(), q.end(), '-');
  if (d1 < 0 || d2 < 0) {
    return 0;
  }
  return 1.0 * C[d1 + d2][d1] / (1 << (d1 + d2));
}
int main() {
  ios_base::sync_with_stdio(false);
  string p, q;
  cin >> p >> q;
  cout.precision(10);
  cout.setf(ios::fixed);
  cout << solve(p, q);
  return 0;
}
