#include <bits/stdc++.h>
using namespace std;
string a, b;
int total;
float w, t;
void calc(int i, int x) {
  if (i == b.size()) {
    t++;
    if (x == total) w++;
    return;
  }
  if (b[i] == '?') {
    calc(i + 1, x - 1);
    calc(i + 1, x + 1);
  } else if (b[i] == '+')
    calc(i + 1, x + 1);
  else
    calc(i + 1, x - 1);
}
int main() {
  cin >> a >> b;
  total = 0;
  for (auto c : a) {
    if (c == '+')
      total++;
    else
      total--;
  }
  w = t = 0;
  calc(0, 0);
  cout << setprecision(9) << fixed << w / t << endl;
}
