#include <bits/stdc++.h>
using namespace std;
int ch(int b, int a) {
  if (a < b) return 0;
  int res = 1;
  for (int i = a - b + 1; i <= a; i++) res *= i;
  for (int i = 1; i <= b; i++) res /= i;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  int des = 0, qm = 0;
  for (int i = 0; i < (int)s1.size(); i++)
    if (s1[i] == '+')
      des++;
    else
      des--;
  for (int i = 0; i < (int)s2.size(); i++)
    if (s2[i] == '?')
      qm++;
    else if (s2[i] == '+')
      des--;
    else
      des++;
  des = abs(des);
  if (des > qm) return (cout << 0 << endl, 0);
  int x = (qm - des) / 2;
  cout << fixed << setprecision(10) << (double)ch(x, qm) / (1 << qm) << endl;
  return 0;
}
