#include <bits/stdc++.h>
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const double pi = acos(-1), eps = 1e-9;
const int OO = 0x3f3f3f3f, N = 1e6 + 5, mod = 1e9 + 7;
using namespace std;
long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return ((x / gcd(x, y)) * y); }
void file() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int cnt = 0;
int ans1 = 0, ans2 = 0, all = 0;
string s, d, nw = "";
void solve(int idx, string cur) {
  if (idx == nw.size()) {
    int wow = 0;
    for (int i = 0; i < cur.size(); i++) {
      if (cur[i] == '+')
        wow++;
      else
        wow--;
    }
    if (ans2 + wow == ans1) cnt++;
    return;
  }
  solve(idx + 1, cur + '+');
  solve(idx + 1, cur + '-');
}
int main() {
  file();
  cin >> s >> d;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == '+')
      ans1++;
    else
      ans1--;
  for (int i = 0; i < d.size(); i++) {
    if (d[i] == '+')
      ans2++;
    else if (d[i] == '-')
      ans2--;
    else
      nw += d[i];
  }
  solve(0, "");
  double f = cnt / pow(2, nw.size());
  cout << fixed << setprecision(9) << f << '\n';
  return 0;
}
