#include <bits/stdc++.h>
using namespace std;
long long co(long long n, long long j) {
  long long t = 1, c = 0;
  for (long long t = 1; t < 1l << j; t <<= 1l)
    if (t & n)
      c++;
    else
      c--;
  return c;
}
long long calc(string s) {
  long long c = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '+')
      c++;
    else if (s[i] == '-')
      c--;
  }
  return c;
}
long long calc2(string s) {
  long long c = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '?') c++;
  }
  return c;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string t, r;
  cin >> t >> r;
  long long a = calc(t);
  long long b = calc(r);
  long long c = calc2(r);
  long long z = a - b;
  long long k = 0;
  for (long long i = 0; i < 1l << c; i++)
    if (co(i, c) == z) k++;
  double g = k;
  g /= 1l << c;
  cout << setprecision(11) << g << endl;
  return 0;
}
