#include <bits/stdc++.h>
int dx[] = {0, -1, 0, 1, -1, 1, -1, 1};
int dy[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int MOD = 1e9 + 7, N = 2e5 + 5, oo = 1e9;
const double pi = acos(-1);
using namespace std;
string s, t;
int sum = 0, total = 0, ok = 0;
void solve(int id, int cnt) {
  if (id == (int)(s).size()) {
    total++;
    ok += (sum == cnt);
    return;
  }
  if (t[id] == '+')
    solve(id + 1, cnt + 1);
  else if (t[id] == '-')
    solve(id + 1, cnt - 1);
  else {
    solve(id + 1, cnt + 1);
    solve(id + 1, cnt - 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  for (int i = 0; i < (int)(s).size(); i++) {
    if (s[i] == '+')
      sum++;
    else
      sum--;
  }
  solve(0, 0);
  if (!total)
    cout << "1.000000000000";
  else
    cout << fixed << setprecision(12) << (long double)ok / total;
  return 0;
}
