#include <bits/stdc++.h>
using namespace std;
int calc(string s) {
  int ans = 0;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '0')
      ans--;
    else
      ans++;
  return ans;
}
string tos(int x, int len) {
  string ans;
  while (x > 0) {
    ans += (x % 2) + '0';
    x /= 2;
  }
  reverse(ans.begin(), ans.end());
  while (ans.length() < len) ans = '0' + ans;
  return ans;
}
double prob(string s, int x) {
  vector<int> p;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '?') p.push_back(i);
  int k = 0, num = pow(2, int(p.size()));
  int ans = 0;
  while (k < num) {
    string t = tos(k, int(p.size()));
    for (int i = 0; i < p.size(); i++) s[p[i]] = t[i];
    if (calc(s) == x) ans++;
    k++;
  }
  double l = ans, h = num;
  return l / h;
}
int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '-')
      s[i] = '0';
    else
      s[i] = '1';
  for (int i = 0; i < t.length(); i++)
    if (t[i] == '-')
      t[i] = '0';
    else if (t[i] == '+')
      t[i] = '1';
  printf("%.10lf\n", prob(t, calc(s)));
  return 0;
}
