#include <bits/stdc++.h>
using namespace std;
void me() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
string a, b;
long long ans, pos, c = 1, pos2;
void solve(int idx, int curr) {
  if (idx == b.size()) {
    if (curr == pos) ans++;
    return;
  }
  if (b[idx] == '+')
    solve(idx + 1, curr + 1);
  else if (b[idx] == '-')
    solve(idx + 1, curr - 1);
  else {
    solve(idx + 1, curr + 1);
    solve(idx + 1, curr - 1);
  }
}
int main() {
  me();
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) {
    a[i] == '+' ? pos += 1 : pos -= 1;
    if (b[i] == '+')
      pos2 += 1;
    else if (b[i] == '-')
      pos2 -= 1;
    else
      c *= 2;
  }
  solve(0, 0);
  cout << fixed << setprecision(12) << double((1.0 * ans) / c) << '\n';
  return 0;
}
